lang/latex: fix autofill in \item's #1849
This commit is contained in:
parent
66abe99dec
commit
31c95042c3
2 changed files with 18 additions and 8 deletions
|
@ -2,14 +2,14 @@
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +latex/LaTeX-indent-item ()
|
(defun +latex/LaTeX-indent-item ()
|
||||||
"Provide proper indentation for LaTeX \"itemize\",\"enumerate\", and \"description\" environments.
|
"Provide proper indentation for LaTeX \"itemize\",\"enumerate\", and
|
||||||
|
\"description\" environments.
|
||||||
|
|
||||||
\"\\item\" is indented `LaTeX-indent-level' spaces relative to
|
\"\\item\" is indented `LaTeX-indent-level' spaces relative to the the beginning
|
||||||
the the beginning of the environment.
|
of the environment.
|
||||||
|
|
||||||
Continuation lines are indented either twice
|
Continuation lines are indented either twice `LaTeX-indent-level', or
|
||||||
`LaTeX-indent-level', or `LaTeX-indent-level-item-continuation'
|
`LaTeX-indent-level-item-continuation' if the latter is bound."
|
||||||
if the latter is bound."
|
|
||||||
(save-match-data
|
(save-match-data
|
||||||
(let* ((offset LaTeX-indent-level)
|
(let* ((offset LaTeX-indent-level)
|
||||||
(contin (or (and (boundp '+latex-indent-level-item-continuation)
|
(contin (or (and (boundp '+latex-indent-level-item-continuation)
|
||||||
|
|
|
@ -93,9 +93,19 @@ If no viewers are found, `latex-preview-pane' is used.")
|
||||||
LaTeX-item-indent 0)
|
LaTeX-item-indent 0)
|
||||||
(when +latex--company-backends
|
(when +latex--company-backends
|
||||||
(set-company-backend! 'latex-mode +latex--company-backends))
|
(set-company-backend! 'latex-mode +latex--company-backends))
|
||||||
;; Set custom item indentation
|
|
||||||
|
;; 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
|
||||||
(dolist (env '("itemize" "enumerate" "description"))
|
(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/LaTeX-indent-item)))
|
||||||
|
;; Fix #1849: allow fill-paragraph in itemize/enumerate
|
||||||
|
(defadvice! +latex--dont-indent-itemize-and-enumerate-a (orig-fn &rest args)
|
||||||
|
:around #'LaTeX-fill-region-as-paragraph
|
||||||
|
(let ((LaTeX-indent-environment-list LaTeX-indent-environment-list))
|
||||||
|
(delq! "itemize" LaTeX-indent-environment-list 'assoc)
|
||||||
|
(delq! "enumerate" LaTeX-indent-environment-list 'assoc)
|
||||||
|
(apply orig-fn args))))
|
||||||
|
|
||||||
|
|
||||||
(use-package! preview
|
(use-package! preview
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue