/[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.23 by lektu, Wed Aug 31 10:29:27 2005 UTC revision 1.24 by cdominik, Fri Sep 16 10:01:33 2005 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, 2003, 2004, 2005
3  ;; Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004,  ;;  Free Software Foundation, Inc.
 ;;   2005 Free Software Foundation, Inc.  
4    
5  ;; Author: Carsten Dominik <dominik@science.uva.nl>  ;; Author: Carsten Dominik <dominik@science.uva.nl>
6  ;; Version: 4.28  ;; Version: VERSIONTAG
7    
8  ;; This file is part of GNU Emacs.  ;; This file is part of GNU Emacs.
9    
# Line 20  Line 19 
19    
20  ;; You should have received a copy of the GNU General Public License  ;; You should have received a copy of the GNU General Public License
21  ;; along with GNU Emacs; see the file COPYING.  If not, write to the  ;; along with GNU Emacs; see the file COPYING.  If not, write to the
22  ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,  ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23  ;; Boston, MA 02110-1301, USA.  ;; Boston, MA 02111-1307, USA.
24    
25  ;;; Commentary:  ;;; Commentary:
26    
# Line 32  Line 31 
31  (require 'reftex)  (require 'reftex)
32  ;;;  ;;;
33    
 (defvar isearch-next-buffer-function)  
 (defvar TeX-master)  
   
34  (defun reftex-create-tags-file ()  (defun reftex-create-tags-file ()
35    "Create TAGS file by running `etags' on the current document.    "Create TAGS file by running `etags' on the current document.
36  The TAGS file is also immediately visited with `visit-tags-table'."  The TAGS file is also immediately visited with `visit-tags-table'."
# Line 103  No active TAGS table is required." Line 99  No active TAGS table is required."
99      (tags-query-replace from to (or delimited current-prefix-arg)      (tags-query-replace from to (or delimited current-prefix-arg)
100                          (list 'reftex-all-document-files))))                          (list 'reftex-all-document-files))))
101    
102    (eval-when-compile
103      (defvar TeX-master)
104      (defvar isearch-next-buffer-function))
105    
106  (defun reftex-find-duplicate-labels ()  (defun reftex-find-duplicate-labels ()
107    "Produce a list of all duplicate labels in the document."    "Produce a list of all duplicate labels in the document."
108    
# Line 140  No active TAGS table is required." Line 140  No active TAGS table is required."
140      (set (make-local-variable 'TeX-master) master)      (set (make-local-variable 'TeX-master) master)
141      (erase-buffer)      (erase-buffer)
142      (insert "                MULTIPLE LABELS IN CURRENT DOCUMENT:\n")      (insert "                MULTIPLE LABELS IN CURRENT DOCUMENT:\n")
143      (insert      (insert
144       " 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"
145       " and its references.  Type `q' to exit this buffer.\n\n")       " and its references.  Type `q' to exit this buffer.\n\n")
146      (insert " LABEL               FILE\n")      (insert " LABEL               FILE\n")
# Line 198  one with the `xr' package." Line 198  one with the `xr' package."
198             (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? ")))
199        (error "Abort"))        (error "Abort"))
200    ;; Make the translation list    ;; Make the translation list
201    (let* ((re-core (concat "\\("    (let* ((re-core (concat "\\("
202                            (mapconcat 'cdr reftex-typekey-to-prefix-alist "\\|")                            (mapconcat 'cdr reftex-typekey-to-prefix-alist "\\|")
203                            "\\)"))                            "\\)"))
204           (label-re (concat "\\`" re-core "\\([0-9]+\\)\\'"))           (label-re (concat "\\`" re-core "\\([0-9]+\\)\\'"))
205           (search-re (concat "[{,]\\(" re-core "\\([0-9]+\\)\\)[,}]"))           (search-re (concat "[{,]\\(" re-core "\\([0-9]+\\)\\)[,}]"))
# Line 232  one with the `xr' package." Line 232  one with the `xr' package."
232      (reftex-save-all-document-buffers)      (reftex-save-all-document-buffers)
233    
234      ;; First test to check for erros      ;; First test to check for erros
235      (setq n (reftex-translate      (setq n (reftex-translate
236               files search-re translate-alist error-fmt 'test))               files search-re translate-alist error-fmt 'test))
237    
238      ;; Now the real thing.      ;; Now the real thing.
239      (if (yes-or-no-p      (if (yes-or-no-p
240           (format "Replace %d items at %d places in %d files? "           (format "Replace %d items at %d places in %d files? "
241                   (length translate-alist) n (length files)))                   (length translate-alist) n (length files)))
242          (progn          (progn
# Line 254  one with the `xr' package." Line 254  one with the `xr' package."
254    
255  (defun reftex-translate (files search-re translate-alist error-fmt test)  (defun reftex-translate (files search-re translate-alist error-fmt test)
256    ;; 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
257    ;; its association in TRANSLATE-ALSIT.    ;; its association in TRANSLATE-ALSIT.  
258    ;; 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
259    ;; to ignore the problematic string.    ;; to ignore the problematic string.  
260    ;; If TEST is nil, it is ignored without query.    ;; If TEST is nil, it is ignored without query.
261    ;; Return the number of replacements.    ;; Return the number of replacements.
262    (let ((n 0) file label match-data buf macro pos cell)    (let ((n 0) file label match-data buf macro pos cell)
# Line 282  one with the `xr' package." Line 282  one with the `xr' package."
282                           (or (looking-at "\\\\ref")                           (or (looking-at "\\\\ref")
283                               (looking-at "\\\\[a-zA-Z]*ref\\(range\\)?[^a-zA-Z]")                               (looking-at "\\\\[a-zA-Z]*ref\\(range\\)?[^a-zA-Z]")
284                               (looking-at "\\\\ref[a-zA-Z]*[^a-zA-Z]")                               (looking-at "\\\\ref[a-zA-Z]*[^a-zA-Z]")
285                               (looking-at (format                               (looking-at (format
286                                            reftex-find-label-regexp-format                                            reftex-find-label-regexp-format
287                                            (regexp-quote label)))))                                            (regexp-quote label)))))
288                  ;; OK, we should replace it.                  ;; OK, we should replace it.
# Line 345  Also checks if buffers visiting the file Line 345  Also checks if buffers visiting the file
345    
346  (defun reftex-isearch-wrap-function ()  (defun reftex-isearch-wrap-function ()
347    (if (not isearch-word)    (if (not isearch-word)
348        (switch-to-buffer        (switch-to-buffer
349         (funcall isearch-next-buffer-function (current-buffer) t)))         (funcall isearch-next-buffer-function (current-buffer) t)))
350    (goto-char (if isearch-forward (point-min) (point-max))))    (goto-char (if isearch-forward (point-min) (point-max))))
351    
# Line 431  With no argument, this command toggles Line 431  With no argument, this command toggles
431  `reftex-isearch-minor-mode' on iff ARG is positive."  `reftex-isearch-minor-mode' on iff ARG is positive."
432    (interactive "P")    (interactive "P")
433    (let ((old-reftex-isearch-minor-mode reftex-isearch-minor-mode))    (let ((old-reftex-isearch-minor-mode reftex-isearch-minor-mode))
434      (setq reftex-isearch-minor-mode      (setq reftex-isearch-minor-mode
435            (not (or (and (null arg) reftex-isearch-minor-mode)            (not (or (and (null arg) reftex-isearch-minor-mode)
436                     (<= (prefix-numeric-value arg) 0))))                     (<= (prefix-numeric-value arg) 0))))
437      (unless (eq reftex-isearch-minor-mode old-reftex-isearch-minor-mode)      (unless (eq reftex-isearch-minor-mode old-reftex-isearch-minor-mode)
# Line 462  With no argument, this command toggles Line 462  With no argument, this command toggles
462      ;; Force modeline redisplay.      ;; Force modeline redisplay.
463      (set-buffer-modified-p (buffer-modified-p))))      (set-buffer-modified-p (buffer-modified-p))))
464    
465  (add-minor-mode 'reftex-isearch-minor-mode "/I" nil nil  (add-minor-mode 'reftex-isearch-minor-mode "/I" nil nil
466                  'reftex-isearch-minor-mode)                  'reftex-isearch-minor-mode)
467    
468  ;;; arch-tag: 2dbf7633-92c8-4340-8656-7aa019d0f80d  ;;; arch-tag: 2dbf7633-92c8-4340-8656-7aa019d0f80d

Legend:
Removed from v.1.23  
changed lines
  Added in v.1.24

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