From ba10f4b56081d0f5069720c9ce0871e819b904f5 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. [backport from trunk] --- lisp/ChangeLog | 8 ++++++++ lisp/textmodes/reftex.el | 22 +++++++++------------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b3bedaaffa9..2c852f9a40a 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 97dd36ae9e8..2930b7cb811 100644 --- a/lisp/textmodes/reftex.el +++ b/lisp/textmodes/reftex.el @@ -221,17 +221,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. @@ -295,15 +299,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