org.el: Add function to indent environment inserted by cdlatex-enviroment

* lisp/org.el (org-cdlatex-environment-indent): New function.

New function is bound to "\C-c{" in `org-cdlatex-mode-map' to add
a LaTeX environment and indent it.

TINYCHANGE
This commit is contained in:
Federico Beffa 2014-07-31 11:08:44 +02:00 committed by Nicolas Goaziou
parent d2c0bbcf52
commit b3fbd31f17
1 changed files with 8 additions and 1 deletions

9
lisp/org.el Normal file → Executable file
View File

@ -18412,7 +18412,7 @@ When a buffer is unmodified, it is just killed. When modified, it is saved
(org-defkey org-cdlatex-mode-map "^" 'org-cdlatex-underscore-caret)
(org-defkey org-cdlatex-mode-map "`" 'cdlatex-math-symbol)
(org-defkey org-cdlatex-mode-map "'" 'org-cdlatex-math-modify)
(org-defkey org-cdlatex-mode-map "\C-c{" 'cdlatex-environment)
(org-defkey org-cdlatex-mode-map "\C-c{" 'org-cdlatex-environment-indent)
(defvar org-cdlatex-texmathp-advice-is-done nil
"Flag remembering if we have applied the advice to texmathp already.")
@ -18490,6 +18490,13 @@ Revert to the normal definition outside of these fragments."
(let (org-cdlatex-mode)
(call-interactively (key-binding (vector last-input-event))))))
(defun org-cdlatex-environment-indent (&optional environment item)
"Execute `cdlatex-environment' and indent the inserted environment."
(interactive)
(cdlatex-environment environment item)
(let ((element (org-element-at-point)))
(org-indent-region (org-element-property :begin element)
(org-element-property :end element))))
;;;; LaTeX fragments