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 36 additions and 3 deletions
Showing only changes of commit ca3d679c54 - Show all commits

View File

@ -449,6 +449,37 @@ 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.
#+begin_src emacs-lisp
(defun custom/TeX-compile-in-root ()
"Execute ~TeX-command-run-all~ in the nearest ~.latexmkrc~ directory or
projectile project root."
(interactive)
(let*
((dir-latexmkrc
(projectile-locate-dominating-file default-directory ".latexmkrc"))
(dir-projectile (projectile-project-root))
(is-latexmk-child-of-projectile (string-match-p (regexp-quote dir-projectile) dir-latexmkrc))
(dir-work (cond
((and dir-latexmkrc is-latexmk-child-of-projectile) dir-latexmkrc)
(dir-projectile dir-projectile)
(t default-directory)))
(dir-current-rel (string-remove-prefix dir-work default-directory))
(file-current-rel (concat dir-current-rel (TeX-master-file))))
; Execute in shadowed ~default-directory~
(cl-labels ((replace-pwd () dir-work) (replace-file (&optional extension nondirectory ask) file-current-rel))
(advice-add 'TeX-master-directory :override #'replace-pwd)
(advice-add 'TeX-master-file :override #'replace-file)
(TeX-command-run-all nil)
(advice-remove 'TeX-master-file #'replace-file)
(advice-remove 'TeX-master-directory #'replace-pwd)
)))
#+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.
@ -471,6 +502,7 @@ introduced.
:desc "View Compilation Log" "l" #'TeX-recenter-output-buffer :desc "View Compilation Log" "l" #'TeX-recenter-output-buffer
:desc "Next Error" "e" #'TeX-next-error :desc "Next Error" "e" #'TeX-next-error
:desc "Close Environment" "]" #'LaTeX-close-environment :desc "Close Environment" "]" #'LaTeX-close-environment
:desc "Compile in root" "." #'custom/TeX-compile-in-root
(:prefix ("f" . "Fold") (:prefix ("f" . "Fold")
:desc "Fold Mode" "f" #'TeX-fold-mode :desc "Fold Mode" "f" #'TeX-fold-mode
:desc "Environment" "e" #'TeX-fold-env :desc "Environment" "e" #'TeX-fold-env
@ -486,6 +518,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