Move latex configs to latex.el

This commit is contained in:
Andreas Zweili 2022-08-21 14:55:23 +02:00
parent 4a3465ec80
commit b402889a8b
2 changed files with 29 additions and 28 deletions

View File

@ -30,3 +30,32 @@
:defer t
:init
(add-hook 'LaTeX-mode-hook 'company-auctex-init)))
(when (boundp 'enable-auctex)
(defun LaTeX-collapse-table ()
(interactive)
(save-excursion
(LaTeX-mark-environment)
(while (re-search-forward "[[:space:]]+\\(&\\|\\\\\\\\\\)" (region-end) t)
(replace-match " \\1"))))
(defun LaTeX-align-environment (arg)
(interactive "P")
(if arg
(LaTeX-collapse-table)
(save-excursion
(LaTeX-mark-environment)
(align (region-beginning) (region-end))))))
(when (boundp 'enable-auctex)
(defcustom LaTeX-inhibited-auto-fill-environments
'("tabular" "tikzpicture") "For which LaTeX environments not to run auto-fill.")
(defun LaTeX-limited-auto-fill ()
(let ((environment (LaTeX-current-environment)))
(when (not (member environment LaTeX-inhibited-auto-fill-environments))
(do-auto-fill)))))
(when (boundp 'enable-auctex)
(global-set-key (kbd "C-c f") 'LaTeX-align-environment)
(setq auto-fill-function 'LaTeX-limited-auto-fill))

View File

@ -99,34 +99,6 @@
(setq tramp-default-method "ssh")
(when (boundp 'enable-auctex)
(defun LaTeX-collapse-table ()
(interactive)
(save-excursion
(LaTeX-mark-environment)
(while (re-search-forward "[[:space:]]+\\(&\\|\\\\\\\\\\)" (region-end) t)
(replace-match " \\1"))))
(defun LaTeX-align-environment (arg)
(interactive "P")
(if arg
(LaTeX-collapse-table)
(save-excursion
(LaTeX-mark-environment)
(align (region-beginning) (region-end))))))
(when (boundp 'enable-auctex)
(defcustom LaTeX-inhibited-auto-fill-environments
'("tabular" "tikzpicture") "For which LaTeX environments not to run auto-fill.")
(defun LaTeX-limited-auto-fill ()
(let ((environment (LaTeX-current-environment)))
(when (not (member environment LaTeX-inhibited-auto-fill-environments))
(do-auto-fill)))))
(when (boundp 'enable-auctex)
(global-set-key (kbd "C-c f") 'LaTeX-align-environment)
(setq auto-fill-function 'LaTeX-limited-auto-fill))
(put 'dired-find-alternate-file 'disabled nil)