emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r112380: * textmodes/reftex-vars.el


From: Tassilo Horn
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r112380: * textmodes/reftex-vars.el
Date: Thu, 25 Apr 2013 14:01:09 +0200
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 112380
committer: Tassilo Horn <address@hidden>
branch nick: trunk
timestamp: Thu 2013-04-25 14:01:09 +0200
message:
  * textmodes/reftex-vars.el
  (reftex-label-ignored-macros-and-environments): New defcustom.
  
  * textmodes/reftex-parse.el (reftex-parse-from-file): Use it.
modified:
  lisp/ChangeLog
  lisp/textmodes/reftex-parse.el
  lisp/textmodes/reftex-vars.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-04-25 03:25:34 +0000
+++ b/lisp/ChangeLog    2013-04-25 12:01:09 +0000
@@ -1,3 +1,10 @@
+2013-04-25  Tassilo Horn  <address@hidden>
+
+       * textmodes/reftex-vars.el
+       (reftex-label-ignored-macros-and-environments): New defcustom.
+
+       * textmodes/reftex-parse.el (reftex-parse-from-file): Use it.
+
 2013-04-25  Stefan Monnier  <address@hidden>
 
        * emacs-lisp/smie.el (smie-indent--hanging-p): Don't burp at EOB.

=== modified file 'lisp/textmodes/reftex-parse.el'
--- a/lisp/textmodes/reftex-parse.el    2013-01-02 16:13:04 +0000
+++ b/lisp/textmodes/reftex-parse.el    2013-04-25 12:01:09 +0000
@@ -234,8 +234,18 @@
 
                 ((match-end 1)
                  ;; It is a label
-                 (push (reftex-label-info (reftex-match-string 1) file bound)
-                       docstruct))
+                (when (or (null reftex-label-ignored-macros-and-environments)
+                          ;; \label{} defs should always be honored,
+                          ;; just no keyval style [label=foo] defs.
+                          (string-equal "\label{" (substring 
(reftex-match-string 0) 0 7))
+                          (not (fboundp 'TeX-current-macro))
+                          (not (fboundp 'LaTeX-current-environment))
+                          (not (or (member (save-match-data 
(TeX-current-macro))
+                                           
reftex-label-ignored-macros-and-environments)
+                                   (member (save-match-data 
(LaTeX-current-environment))
+                                           
reftex-label-ignored-macros-and-environments))))
+                  (push (reftex-label-info (reftex-match-string 1) file bound)
+                        docstruct)))
 
                 ((match-end 3)
                  ;; It is a section

=== modified file 'lisp/textmodes/reftex-vars.el'
--- a/lisp/textmodes/reftex-vars.el     2013-04-23 17:07:49 +0000
+++ b/lisp/textmodes/reftex-vars.el     2013-04-25 12:01:09 +0000
@@ -885,6 +885,25 @@
   :group 'reftex-defining-label-environments
   :type '(repeat (regexp :tag "Regular Expression")))
 
+(defcustom reftex-label-ignored-macros-and-environments nil
+  "List of macros and environments to be ignored when searching for labels.
+The purpose is to ignore environments and macros that use keyval
+style label=foo arguments, but the label has a different meaning
+than a \\label{foo}.  Standard \\label{...} definitions are never
+ignored.
+
+E.g., TikZ defines several macros/environments where [label=foo]
+defines the label to be printed at some node or edge, but it's
+not a label used for referencing.
+
+Note that this feature is only supported if you are using AUCTeX
+and the functions `TeX-current-macro' and
+`LaTeX-current-environment' are bound.  Also note that this
+feature might slow down the reftex parsing process for large TeX
+files."
+  :group 'reftex-defining-label-environments
+  :type '(repeat string))
+
 (defcustom reftex-label-illegal-re "[^-a-zA-Z0-9_+=:;,.]"
   "Regexp matching characters not valid in labels."
   :group 'reftex-making-and-inserting-labels


reply via email to

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