Add LaTeX command improvements and new packages #3

Merged
aniva merged 3 commits from emacs into main 2023-09-19 21:19:52 -07:00
2 changed files with 33 additions and 3 deletions

View File

@ -449,6 +449,35 @@ The target indentation style of ~LaTeX~ is as follows:
\end{enumerate} \end{enumerate}
#+end_src #+end_src
The ~SPC m c~ command which by default binds to ~TeX-command-run-all~ is
modified so it runs in the directory of the nearest ~.latexmkrc~ file or the
projectile root, whichever is closer. If a ~.latexmkrc~ file is not found, we
fall back to the current directory. We improve this below by decreeing that all
compilation has to happen with the ~.latexmkrc~ file's directory as PWD.
#+begin_src emacs-lisp
(defun custom/TeX-root-directory (start)
(let* (
(dir-latexmkrc (projectile-locate-dominating-file start ".latexmkrc"))
(dir-projectile (projectile-project-root))
(is-latexmk-child-of-projectile (and dir-projectile dir-latexmkrc
(string-match-p (regexp-quote dir-projectile) dir-latexmkrc))))
(cond
((and dir-latexmkrc is-latexmk-child-of-projectile) dir-latexmkrc)
(dir-projectile dir-projectile)
(t start))))
(defun custom/TeX-master-directory-filter (dir-master)
(custom/TeX-root-directory dir-master))
(defun custom/TeX-master-file-filter (file-master)
(concat
(string-remove-prefix (custom/TeX-root-directory default-directory) default-directory)
file-master
))
(advice-add 'TeX-master-directory :filter-return #'custom/TeX-master-directory-filter)
(advice-add 'TeX-master-file :filter-return #'custom/TeX-master-file-filter)
#+end_src
For some reason the keymap binding has to use ~LaTeX-mode-map~ or ~TeX-mode-map~ For some reason the keymap binding has to use ~LaTeX-mode-map~ or ~TeX-mode-map~
instead of ~latex-mode-map~. Also some original keybindings are removed so they instead of ~latex-mode-map~. Also some original keybindings are removed so they
can be displayed correctly in prompts. See e.g. ~tex-buf.el~ for an example. can be displayed correctly in prompts. See e.g. ~tex-buf.el~ for an example.
@ -486,6 +515,7 @@ introduced.
) )
#+end_src #+end_src
*** Lean 3 *** Lean 3
#+begin_src emacs-lisp #+begin_src emacs-lisp

View File

@ -69,7 +69,7 @@
:emacs :emacs
dired ; making dired pretty [functional] dired ; making dired pretty [functional]
electric ; smarter, keyword-based electric-indent electric ; smarter, keyword-based electric-indent
;;ibuffer ; interactive buffer management (ibuffer +icons) ; interactive buffer management
undo ; persistent, smarter undo for your inevitable mistakes undo ; persistent, smarter undo for your inevitable mistakes
vc ; version-control and Emacs, sitting in a tree vc ; version-control and Emacs, sitting in a tree
@ -82,7 +82,7 @@
:checkers :checkers
syntax ; tasing you for every semicolon you forget syntax ; tasing you for every semicolon you forget
(spell +flyspell) ; tasing you for misspelling mispelling (spell +flyspell) ; tasing you for misspelling mispelling
;;grammar ; tasing grammar mistake every you make grammar ; tasing grammar mistake every you make
:tools :tools
;;ansible ;;ansible
@ -142,7 +142,7 @@
;;idris ; a language you can depend on ;;idris ; a language you can depend on
json ; At least it ain't XML json ; At least it ain't XML
;;(java +lsp) ; the poster child for carpal tunnel syndrome ;;(java +lsp) ; the poster child for carpal tunnel syndrome
;;javascript ; all(hope(abandon(ye(who(enter(here)))))) javascript ; all(hope(abandon(ye(who(enter(here))))))
;;julia ; a better, faster MATLAB ;;julia ; a better, faster MATLAB
;;kotlin ; a better, slicker Java(Script) ;;kotlin ; a better, slicker Java(Script)
(latex +latexmk +lsp) ; writing papers in Emacs has never been so fun (latex +latexmk +lsp) ; writing papers in Emacs has never been so fun