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

gigiair
  • 2,124
  • 1
  • 8
  • 14
  • Have you tried `latex` instead of `tex-site`? – Omar Jun 07 '19 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 07 '19 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](https://emacs.stackexchange.com/questions/50890/use-package-do-not-bind-in-latex-mode-map#comment78398_50890) to replace `tex-site` with `latex` appears to be right. – Tobias Jun 08 '19 at 00: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 08 '19 at 00: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 08 '19 at 05:42

0 Answers0