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:
parent
3cdf67ccce
commit
c2818bcfaa
1 changed files with 9 additions and 2 deletions
|
@ -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))
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue