1

this is a part of my init file

(use-package tex-site
 :ensure auctex
 :mode
   ("\\.tex\\'" . latex-mode)
 :bind
   (:map LaTeX-mode-map
     ("<f5> <f5>" . TeX-command-save-buffer-and-run-all)))
 :init
  (defun TeX-command-save-buffer-and-run-all ()
  "Save the buffer and run TeX-command-run-all"
  (interactive)
  (let (TeX-save-query) (TeX-save-document (TeX-master-file)))
  (TeX-command-run-all nil))

None binding is done in latex-mode, but if I evaluate this after a tex file has been opened,it works fine.

I tried (find-file "mwe.tex) in my init file, and the bindings works. I suppose there is a smarter way to make this init file work like I want it to

  • Have you tried latex instead of tex-site? – Omar Jun 7 at 12:56
  • I did, and plenty others. for the moment, I just add (find-file "foo.tex")(kill-buffer "foo.tex") for it work. I'm just asking for a smarter solution. – gigiair Jun 7 at 13:32
  • It is clear that your current approach cannot work since tex-site.el does not define LaTeX-mode-map. LaTeX-mode-map is defined in latex.el and tex-site.el does not load latex.el. From that point of view Omar's suggestion to replace tex-site with latex appears to be right. – Tobias Jun 8 at 0:37
  • I think you can replace the loading and killing of foo.tex with (require 'latex). That is the thing that might be relevant for your problem. – Tobias Jun 8 at 0:41
  • My apologize, Omar was right, replacing tex-site by latex fixed the issue. I need learning a lot of skills in emacs-lisp... – gigiair Jun 8 at 5:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.