mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
fix(latex): avoid stealing focus after compilation
Current LaTeX module uses `TeX-command-run-all` for compilation, which by default opens the compiled document in a viewer. This behavior causes a loss of focus from the Emacs window. We address this by adding a custom compilation function.
This commit is contained in:
@ -102,16 +102,23 @@ If no viewer is found, `latex-preview-pane-mode' is used.")
|
||||
(add-hook! '(tex-mode-local-vars-hook
|
||||
latex-mode-local-vars-hook)
|
||||
:append #'lsp!))
|
||||
;; Define a function to compile the project.
|
||||
(defun +latex/compile ()
|
||||
(interactive)
|
||||
(TeX-save-document (TeX-master-file))
|
||||
(TeX-command TeX-command-default 'TeX-master-file -1))
|
||||
(map! :localleader
|
||||
:map latex-mode-map
|
||||
:desc "View" "v" #'TeX-view
|
||||
:desc "Compile" "c" #'TeX-command-run-all
|
||||
:desc "Compile" "c" #'+latex/compile
|
||||
:desc "Run all" "a" #'TeX-command-run-all
|
||||
:desc "Run a command" "m" #'TeX-command-master)
|
||||
(map! :after latex
|
||||
:localleader
|
||||
:map LaTeX-mode-map
|
||||
:desc "View" "v" #'TeX-view
|
||||
:desc "Compile" "c" #'TeX-command-run-all
|
||||
:desc "Compile" "c" #'+latex/compile
|
||||
:desc "Run all" "a" #'TeX-command-run-all
|
||||
:desc "Run a command" "m" #'TeX-command-master))
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user