/[emacs]/emacs/lisp/textmodes/reftex-global.el
ViewVC logotype

Diff of /emacs/lisp/textmodes/reftex-global.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.11 by rms, Sun Dec 30 00:54:46 2001 UTC revision 1.11.4.1 by miles, Fri Apr 4 06:20:39 2003 UTC
# Line 1  Line 1 
1  ;;; reftex-global.el --- operations on entire documents with RefTeX  ;;; reftex-global.el --- operations on entire documents with RefTeX
2  ;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.  ;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
3    
4  ;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl>  ;; Author: Carsten Dominik <dominik@science.uva.nl>
5  ;; Version: 4.16  ;; Version: 4.18
6    
7  ;; This file is part of GNU Emacs.  ;; This file is part of GNU Emacs.
8    
# Line 135  No active TAGS table is required." Line 135  No active TAGS table is required."
135      (set (make-local-variable 'TeX-master) master)      (set (make-local-variable 'TeX-master) master)
136      (erase-buffer)      (erase-buffer)
137      (insert "                MULTIPLE LABELS IN CURRENT DOCUMENT:\n")      (insert "                MULTIPLE LABELS IN CURRENT DOCUMENT:\n")
138      (insert      (insert
139       " Move point to label and type `r' to run a query-replace on the label\n"       " Move point to label and type `r' to run a query-replace on the label\n"
140       " and its references.  Type `q' to exit this buffer.\n\n")       " and its references.  Type `q' to exit this buffer.\n\n")
141      (insert " LABEL               FILE\n")      (insert " LABEL               FILE\n")
# Line 193  one with the `xr' package." Line 193  one with the `xr' package."
193             (not (yes-or-no-p "Replacing all simple labels in multiple files is risky.  Continue? ")))             (not (yes-or-no-p "Replacing all simple labels in multiple files is risky.  Continue? ")))
194        (error "Abort"))        (error "Abort"))
195    ;; Make the translation list    ;; Make the translation list
196    (let* ((re-core (concat "\\("    (let* ((re-core (concat "\\("
197                            (mapconcat 'cdr reftex-typekey-to-prefix-alist "\\|")                            (mapconcat 'cdr reftex-typekey-to-prefix-alist "\\|")
198                            "\\)"))                            "\\)"))
199           (label-re (concat "\\`" re-core "\\([0-9]+\\)\\'"))           (label-re (concat "\\`" re-core "\\([0-9]+\\)\\'"))
200           (search-re (concat "[{,]\\(" re-core "\\([0-9]+\\)\\)[,}]"))           (search-re (concat "[{,]\\(" re-core "\\([0-9]+\\)\\)[,}]"))
# Line 227  one with the `xr' package." Line 227  one with the `xr' package."
227      (reftex-save-all-document-buffers)      (reftex-save-all-document-buffers)
228    
229      ;; First test to check for erros      ;; First test to check for erros
230      (setq n (reftex-translate      (setq n (reftex-translate
231               files search-re translate-alist error-fmt 'test))               files search-re translate-alist error-fmt 'test))
232    
233      ;; Now the real thing.      ;; Now the real thing.
234      (if (yes-or-no-p      (if (yes-or-no-p
235           (format "Replace %d items at %d places in %d files? "           (format "Replace %d items at %d places in %d files? "
236                   (length translate-alist) n (length files)))                   (length translate-alist) n (length files)))
237          (progn          (progn
# Line 249  one with the `xr' package." Line 249  one with the `xr' package."
249    
250  (defun reftex-translate (files search-re translate-alist error-fmt test)  (defun reftex-translate (files search-re translate-alist error-fmt test)
251    ;; In FILES, look for SEARCH-RE and replace match 1 of it with    ;; In FILES, look for SEARCH-RE and replace match 1 of it with
252    ;; its association in TRANSLATE-ALSIT.      ;; its association in TRANSLATE-ALSIT.
253    ;; If we do not find an association and TEST is non-nil, query    ;; If we do not find an association and TEST is non-nil, query
254    ;; to ignore the problematic string.      ;; to ignore the problematic string.
255    ;; If TEST is nil, it is ignored without query.    ;; If TEST is nil, it is ignored without query.
256    ;; Return the number of replacements.    ;; Return the number of replacements.
257    (let ((n 0) file label match-data buf macro pos cell)    (let ((n 0) file label match-data buf macro pos cell)
# Line 277  one with the `xr' package." Line 277  one with the `xr' package."
277                           (or (looking-at "\\\\ref")                           (or (looking-at "\\\\ref")
278                               (looking-at "\\\\[a-zA-Z]*ref\\(range\\)?[^a-zA-Z]")                               (looking-at "\\\\[a-zA-Z]*ref\\(range\\)?[^a-zA-Z]")
279                               (looking-at "\\\\ref[a-zA-Z]*[^a-zA-Z]")                               (looking-at "\\\\ref[a-zA-Z]*[^a-zA-Z]")
280                               (looking-at (format                               (looking-at (format
281                                            reftex-find-label-regexp-format                                            reftex-find-label-regexp-format
282                                            (regexp-quote label)))))                                            (regexp-quote label)))))
283                  ;; OK, we should replace it.                  ;; OK, we should replace it.

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.11.4.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26