lang/latex: rethink item continuation indentation

+ Rename +latex-indent-level-item-continuation to
  +latex-indent-item-continuation-offset, which more accurately reflects
  its purpose.
+ +latex-indent-item-continuation-offset now supports `align' and `auto'
  settings.
+ It can also be disabled by setting it to nil.

Fixes #3877
This commit is contained in:
Henrik Lissner 2020-10-20 22:55:20 -04:00
parent 1c6ea87832
commit 98826f33d0
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 40 additions and 18 deletions

View file

@ -1,7 +1,27 @@
;;; lang/latex/config.el -*- lexical-binding: t; -*-
(defvar +latex-indent-level-item-continuation 4
"Custom indentation level for items in enumeration-type environments")
(defconst +latex-indent-item-continuation-offset 'align
"Level to indent continuation of enumeration-type environments.
i.e. This affects \\item, \\enumerate, and \\description.
Set this to `align' for:
\\item lines aligned
like this.
Set to `auto' for continuation lines to be offset by `LaTeX-indent-line':
\\item lines aligned
like this, assuming LaTeX-indent-line == 2
Any other fixed integer will be added to `LaTeX-item-indent' and the current
indentation level.
Set this to `nil' to disable all this behavior.
You'll need to adjust `LaTeX-item-indent' to control indentation of \\item
itself.")
(defvar +latex-enable-unicode-math nil
"If non-nil, use `company-math-symbols-unicode' backend in LaTeX-mode,
@ -130,8 +150,9 @@ Math faces should stay fixed by the mixed-pitch blacklist, this is mostly for
;; Provide proper indentation for LaTeX "itemize","enumerate", and
;; "description" environments. See
;; http://emacs.stackexchange.com/questions/3083/how-to-indent-items-in-latex-auctex-itemize-environments
;; Set `+latex-indent-item-continuation-offset' to 0 to disable this
(dolist (env '("itemize" "enumerate" "description"))
(add-to-list 'LaTeX-indent-environment-list `(,env +latex/LaTeX-indent-item)))
(add-to-list 'LaTeX-indent-environment-list `(,env +latex-indent-item-fn)))
;; Fix #1849: allow fill-paragraph in itemize/enumerate
(defadvice! +latex--re-indent-itemize-and-enumerate-a (orig-fn &rest args)