From 8a8bd38fedb89b2d04cca2419698813a22862c3b Mon Sep 17 00:00:00 2001 From: Tassilo Horn Date: Wed, 28 Jan 2015 10:32:50 +0100 Subject: [PATCH] Fix issues with BibTeX entries containing ")". * textmodes/reftex.el (reftex-syntax-table-for-bib): Give ( and ) punctuation syntax since to allow bibtex fields with values such as {Test 1) and 2)} (bug#19205, bug#19707). (reftex--prepare-syntax-tables): New function. (reftex-mode): Use it. --- lisp/ChangeLog | 8 ++++++++ lisp/textmodes/reftex.el | 22 +++++++++------------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index eb6ef6b19d2..90681c80656 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2015-01-28 Tassilo Horn + + * textmodes/reftex.el (reftex-syntax-table-for-bib): Give ( and ) + punctuation syntax since to allow bibtex fields with values such + as {Test 1) and 2)} (bug#19205, bug#19707). + (reftex--prepare-syntax-tables): New function. + (reftex-mode): Use it. + 2015-01-26 Fabián Ezequiel Gallina python.el: New non-global state dependent indentation engine. diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el index 160d9fb4cdf..7cf54c6d28a 100644 --- a/lisp/textmodes/reftex.el +++ b/lisp/textmodes/reftex.el @@ -106,17 +106,21 @@ (defvar reftex-syntax-table nil) (defvar reftex-syntax-table-for-bib nil) -(unless reftex-syntax-table +(defun reftex--prepare-syntax-tables () (setq reftex-syntax-table (copy-syntax-table)) (modify-syntax-entry ?\( "." reftex-syntax-table) - (modify-syntax-entry ?\) "." reftex-syntax-table)) + (modify-syntax-entry ?\) "." reftex-syntax-table) -(unless reftex-syntax-table-for-bib (setq reftex-syntax-table-for-bib (copy-syntax-table)) (modify-syntax-entry ?\' "." reftex-syntax-table-for-bib) (modify-syntax-entry ?\" "." reftex-syntax-table-for-bib) (modify-syntax-entry ?\[ "." reftex-syntax-table-for-bib) - (modify-syntax-entry ?\] "." reftex-syntax-table-for-bib)) + (modify-syntax-entry ?\] "." reftex-syntax-table-for-bib) + (modify-syntax-entry ?\( "." reftex-syntax-table-for-bib) + (modify-syntax-entry ?\) "." reftex-syntax-table-for-bib)) + +(unless (and reftex-syntax-table reftex-syntax-table-for-bib) + (reftex--prepare-syntax-tables)) ;; The following definitions are out of place, but I need them here ;; to make the compilation of reftex-mode not complain. @@ -180,15 +184,7 @@ on the menu bar. (put 'reftex-auto-recenter-toc 'initialized t)) ;; Prepare the special syntax tables. - (setq reftex-syntax-table (copy-syntax-table (syntax-table))) - (modify-syntax-entry ?\( "." reftex-syntax-table) - (modify-syntax-entry ?\) "." reftex-syntax-table) - - (setq reftex-syntax-table-for-bib (copy-syntax-table)) - (modify-syntax-entry ?\' "." reftex-syntax-table-for-bib) - (modify-syntax-entry ?\" "." reftex-syntax-table-for-bib) - (modify-syntax-entry ?\[ "." reftex-syntax-table-for-bib) - (modify-syntax-entry ?\] "." reftex-syntax-table-for-bib) + (reftex--prepare-syntax-tables) (run-hooks 'reftex-mode-hook)) ;; Mode was turned off -- 2.39.2