>From cc5c549131db75a3b1bbbc9fa587f1f6df0a70f8 Mon Sep 17 00:00:00 2001 From: Ikumi Keita Date: Wed, 10 Nov 2021 01:03:42 +0900 Subject: [PATCH] Fix bibtex dialect * tex.el (TeX-auto-store): Use `(or :bibtex :latex)' instead of `:bibtex' as dialect argument for `TeX-add-style-hook' when saving auto file for BibTeX file. --- tex.el | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/tex.el b/tex.el index 9188ccd7..6b80b4e8 100644 --- a/tex.el +++ b/tex.el @@ -4101,7 +4101,8 @@ If TEX is a directory, generate style files for all files in the directory." LaTeX-verbatim-macros-with-delims-local)) (verb-macros-braces (when (boundp 'LaTeX-verbatim-macros-with-braces-local) LaTeX-verbatim-macros-with-braces-local)) - (dialect TeX-style-hook-dialect)) + (dialect TeX-style-hook-dialect) + (bibtex-p (eq major-mode 'bibtex-mode))) (TeX-unload-style style) (with-current-buffer (generate-new-buffer file) (erase-buffer) @@ -4131,7 +4132,21 @@ If TEX is a directory, generate style files for all files in the directory." (mapc (lambda (el) (TeX-auto-insert el style)) TeX-auto-parser) (insert ")") - (if dialect (insert (concat "\n " (prin1-to-string dialect)))) + (if dialect (insert (concat + "\n " + (prin1-to-string + (if bibtex-p + ;; Add :latex since functions such + ;; as `LaTeX-add-bibitems' are + ;; only meaningful in LaTeX + ;; document buffer. + ;; FIXME: BibTeX is available to + ;; plain TeX through eplain + ;; (). + ;; It would be nice if AUCTeX + ;; supports such usage. + `'(or ,dialect :latex) + dialect))))) (insert ")\n\n") (write-region (point-min) (point-max) file nil 'silent) (kill-buffer (current-buffer)))) -- 2.35.1