diff --git a/doom/config.org b/doom/config.org index 965d894..ebd3201 100644 --- a/doom/config.org +++ b/doom/config.org @@ -449,6 +449,35 @@ The target indentation style of ~LaTeX~ is as follows: \end{enumerate} #+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~ 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. @@ -486,6 +515,7 @@ introduced. ) #+end_src + *** Lean 3 #+begin_src emacs-lisp diff --git a/doom/init.el b/doom/init.el index 93760fe..d6adc36 100644 --- a/doom/init.el +++ b/doom/init.el @@ -69,7 +69,7 @@ :emacs dired ; making dired pretty [functional] electric ; smarter, keyword-based electric-indent - ;;ibuffer ; interactive buffer management + (ibuffer +icons) ; interactive buffer management undo ; persistent, smarter undo for your inevitable mistakes vc ; version-control and Emacs, sitting in a tree @@ -82,7 +82,7 @@ :checkers syntax ; tasing you for every semicolon you forget (spell +flyspell) ; tasing you for misspelling mispelling - ;;grammar ; tasing grammar mistake every you make + grammar ; tasing grammar mistake every you make :tools ;;ansible @@ -142,7 +142,7 @@ ;;idris ; a language you can depend on json ; At least it ain't XML ;;(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 ;;kotlin ; a better, slicker Java(Script) (latex +latexmk +lsp) ; writing papers in Emacs has never been so fun