bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#10254: 24.0.92; Local variable bibtex-dialect has no effect


From: Glenn Morris
Subject: bug#10254: 24.0.92; Local variable bibtex-dialect has no effect
Date: Mon, 09 Jan 2012 20:24:45 -0500
User-agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)

A better solution would be something like the following. However, it
seems that at present bibtex.el is simply not set up to handle a
buffer-local dialect. Eg none of the variables set by bibtex-set-dialect
(bibtex-entry-type etc) are buffer-local. So it won't work right if you
open multiple buffers with different dialects.


*** lisp/textmodes/bibtex.el    2012-01-05 09:46:05 +0000
--- lisp/textmodes/bibtex.el    2012-01-10 01:19:18 +0000
***************
*** 836,841 ****
--- 836,842 ----
    :type '(choice (const BibTeX)
                   (const biblatex)
                   (symbol :tag "Custom")))
+ ;;;###autoload(put 'bibtex-dialect 'safe-local-variable 'symbolp)
  
  (defcustom bibtex-no-opt-remove-re "\\`option"
    "If a field name matches this regexp, the prefix OPT is not removed.
***************
*** 3376,3382 ****
    (setq imenu-generic-expression
          (list (list nil bibtex-entry-head bibtex-key-in-head))
          imenu-case-fold-search t)
!   (bibtex-set-dialect bibtex-dialect))
  
  (defun bibtex-set-dialect (dialect)
    "Select BibTeX mode DIALECT.
--- 3377,3383 ----
    (setq imenu-generic-expression
          (list (list nil bibtex-entry-head bibtex-key-in-head))
          imenu-case-fold-search t)
!   (add-hook 'hack-local-variables-hook 'bibtex-hack-local-variables nil t))
  
  (defun bibtex-set-dialect (dialect)
    "Select BibTeX mode DIALECT.
***************
*** 3475,3480 ****
--- 3476,3486 ----
                                             t))
                                   bibtex-dialect-list))))))))
  
+ (defun bibtex-hack-local-variables ()
+   "BibTex mode adds this to `hack-local-variables-hook'."
+   ;; Respect any buffer-local setting of bibtex-dialect (bug#10254).
+   (bibtex-set-dialect bibtex-dialect))
+ 
  (defun bibtex-field-list (entry-type)
    "Return list of allowed fields for entry ENTRY-TYPE.
  More specifically, the return value is a cons pair (REQUIRED . OPTIONAL),






reply via email to

[Prev in Thread] Current Thread [Next in Thread]