CVSROOT: /sources/auctex Module name: reftex Changes by: Ralf Angeli <angeli> 08/04/13 13:24:27
Index: reftex-base.el =================================================================== RCS file: /sources/auctex/reftex/lisp/reftex-base.el,v retrieving revision 1.10 retrieving revision 1.11 diff -u -b -r1.10 -r1.11 --- reftex-base.el 16 Mar 2008 16:50:05 -0000 1.10 +++ reftex-base.el 13 Apr 2008 13:24:26 -0000 1.11 @@ -1045,7 +1045,7 @@ (let* ( ; (wbol "\\(\\`\\|[\n\r]\\)[ \t]*") (wbol "\\(^\\)[ \t]*") ; Need to keep the empty group because - ;;; because match number are hard coded + ; because match numbers are hard coded (label-re "\\\\label{\\([^}]*\\)}") (include-re (concat wbol "\\\\\\(" @@ -1053,10 +1053,27 @@ reftex-include-file-commands "\\|") "\\)[{ \t]+\\([^} \t\n\r]+\\)")) (section-re +;; (concat wbol "\\\\\\(" +;; (mapconcat (lambda (x) (regexp-quote (car x))) +;; reftex-section-levels-all "\\|") +;; "\\)\\*?\\(\\[[^]]*\\]\\)?[[{ \t\r\n]")) + ;; The old regexp above could not deal with stuff like + ;; "\begin{foo}\label{x}", so we now try to treat + ;; environments and macros differently without changing + ;; the regexp groups too much. (concat wbol "\\\\\\(" - (mapconcat (lambda (x) (regexp-quote (car x))) - reftex-section-levels-all "\\|") - "\\)\\*?\\(\\[[^]]*\\]\\)?[[{ \t\r\n]")) + ;; Environments ("begin{foo}") + (reftex-mapconcat-with-predicate + (lambda (x) (regexp-quote (car x))) + reftex-section-levels-all "\\|" + (lambda (x) (string-match "begin{[^}]*}" (car x)))) + "\\|\\(?:" + ;; Macros ("foo") + (reftex-mapconcat-with-predicate + (lambda (x) (regexp-quote (car x))) + reftex-section-levels-all "\\|" + (lambda (x) (not (string-match "begin{[^}]*}" (car x))))) + "\\)\\*?\\(\\[[^]]*\\]\\)?[[{ \t\r\n]\\)")) (appendix-re (concat wbol "\\(\\\\appendix\\)")) (macro-re (if macros-with-labels @@ -2061,6 +2078,19 @@ ((= (length text) 0) (make-string 1 ?\ )) (t text))) +(defun reftex-mapconcat-with-predicate (function sequence separator predicate) + "Apply FUNCTION to each element of SEQUENCE and concatenate the results. +Put SEPARATOR between each pair of results. Use only those +elements of SEQUENCE where PREDICATE returns non-nil. PREDICATE +is a function accepting one parameter, an element of SEQUENCE." + (let (list) + (dolist (elt sequence) + (when (funcall predicate elt) + (add-to-list 'list elt t))) + (delq nil list) + (mapconcat function list separator))) + + ;;; ========================================================================= ;;; ;;; Fontification and Highlighting @@ -2310,7 +2340,7 @@ `(if (member ,elt reftex-ref-style-active-list) (setq reftex-ref-style-active-list (delete ,elt reftex-ref-style-active-list)) - (add-to-list 'reftex-ref-style-active-list ,elt)) + (add-to-list 'reftex-ref-style-active-list ,elt t)) :style 'toggle :selected `(member ,elt reftex-ref-style-active-list))) (unless (member item list) _______________________________________________ auctex-diffs mailing list [EMAIL PROTECTED] http://lists.gnu.org/mailman/listinfo/auctex-diffs