diff options
| author | Tassilo Horn | 2013-04-25 14:01:09 +0200 |
|---|---|---|
| committer | Tassilo Horn | 2013-04-25 14:01:09 +0200 |
| commit | d79d37bd136542193dc61ac2e0163245058c4a13 (patch) | |
| tree | cd83c40e5c14e0d47b92aa42a16f521678e78b08 | |
| parent | ced3fc5d2f65236af6595db93b064b77a5cdedfd (diff) | |
| download | emacs-d79d37bd136542193dc61ac2e0163245058c4a13.tar.gz emacs-d79d37bd136542193dc61ac2e0163245058c4a13.zip | |
* textmodes/reftex-vars.el
(reftex-label-ignored-macros-and-environments): New defcustom.
* textmodes/reftex-parse.el (reftex-parse-from-file): Use it.
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/textmodes/reftex-parse.el | 14 | ||||
| -rw-r--r-- | lisp/textmodes/reftex-vars.el | 19 |
3 files changed, 38 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7bce53d7caf..e8933ee7c83 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2013-04-25 Tassilo Horn <tsdh@gnu.org> | ||
| 2 | |||
| 3 | * textmodes/reftex-vars.el | ||
| 4 | (reftex-label-ignored-macros-and-environments): New defcustom. | ||
| 5 | |||
| 6 | * textmodes/reftex-parse.el (reftex-parse-from-file): Use it. | ||
| 7 | |||
| 1 | 2013-04-25 Stefan Monnier <monnier@iro.umontreal.ca> | 8 | 2013-04-25 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 9 | ||
| 3 | * emacs-lisp/smie.el (smie-indent--hanging-p): Don't burp at EOB. | 10 | * emacs-lisp/smie.el (smie-indent--hanging-p): Don't burp at EOB. |
diff --git a/lisp/textmodes/reftex-parse.el b/lisp/textmodes/reftex-parse.el index a86b10e21cc..6bfc70c5d44 100644 --- a/lisp/textmodes/reftex-parse.el +++ b/lisp/textmodes/reftex-parse.el | |||
| @@ -234,8 +234,18 @@ of master file." | |||
| 234 | 234 | ||
| 235 | ((match-end 1) | 235 | ((match-end 1) |
| 236 | ;; It is a label | 236 | ;; It is a label |
| 237 | (push (reftex-label-info (reftex-match-string 1) file bound) | 237 | (when (or (null reftex-label-ignored-macros-and-environments) |
| 238 | docstruct)) | 238 | ;; \label{} defs should always be honored, |
| 239 | ;; just no keyval style [label=foo] defs. | ||
| 240 | (string-equal "\label{" (substring (reftex-match-string 0) 0 7)) | ||
| 241 | (not (fboundp 'TeX-current-macro)) | ||
| 242 | (not (fboundp 'LaTeX-current-environment)) | ||
| 243 | (not (or (member (save-match-data (TeX-current-macro)) | ||
| 244 | reftex-label-ignored-macros-and-environments) | ||
| 245 | (member (save-match-data (LaTeX-current-environment)) | ||
| 246 | reftex-label-ignored-macros-and-environments)))) | ||
| 247 | (push (reftex-label-info (reftex-match-string 1) file bound) | ||
| 248 | docstruct))) | ||
| 239 | 249 | ||
| 240 | ((match-end 3) | 250 | ((match-end 3) |
| 241 | ;; It is a section | 251 | ;; It is a section |
diff --git a/lisp/textmodes/reftex-vars.el b/lisp/textmodes/reftex-vars.el index 7343d86b06f..ab085a3085a 100644 --- a/lisp/textmodes/reftex-vars.el +++ b/lisp/textmodes/reftex-vars.el | |||
| @@ -885,6 +885,25 @@ effective." | |||
| 885 | :group 'reftex-defining-label-environments | 885 | :group 'reftex-defining-label-environments |
| 886 | :type '(repeat (regexp :tag "Regular Expression"))) | 886 | :type '(repeat (regexp :tag "Regular Expression"))) |
| 887 | 887 | ||
| 888 | (defcustom reftex-label-ignored-macros-and-environments nil | ||
| 889 | "List of macros and environments to be ignored when searching for labels. | ||
| 890 | The purpose is to ignore environments and macros that use keyval | ||
| 891 | style label=foo arguments, but the label has a different meaning | ||
| 892 | than a \\label{foo}. Standard \\label{...} definitions are never | ||
| 893 | ignored. | ||
| 894 | |||
| 895 | E.g., TikZ defines several macros/environments where [label=foo] | ||
| 896 | defines the label to be printed at some node or edge, but it's | ||
| 897 | not a label used for referencing. | ||
| 898 | |||
| 899 | Note that this feature is only supported if you are using AUCTeX | ||
| 900 | and the functions `TeX-current-macro' and | ||
| 901 | `LaTeX-current-environment' are bound. Also note that this | ||
| 902 | feature might slow down the reftex parsing process for large TeX | ||
| 903 | files." | ||
| 904 | :group 'reftex-defining-label-environments | ||
| 905 | :type '(repeat string)) | ||
| 906 | |||
| 888 | (defcustom reftex-label-illegal-re "[^-a-zA-Z0-9_+=:;,.]" | 907 | (defcustom reftex-label-illegal-re "[^-a-zA-Z0-9_+=:;,.]" |
| 889 | "Regexp matching characters not valid in labels." | 908 | "Regexp matching characters not valid in labels." |
| 890 | :group 'reftex-making-and-inserting-labels | 909 | :group 'reftex-making-and-inserting-labels |