aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Dominik2000-06-20 12:52:00 +0000
committerCarsten Dominik2000-06-20 12:52:00 +0000
commitd8fb2015454acbb684137fb78f8dea954b601795 (patch)
treee0b7b39c04de221c48b09a9779a704b59e403ad7
parent15e425312806d8cf6456ae78f666b2147e4c8660 (diff)
downloademacs-d8fb2015454acbb684137fb78f8dea954b601795.tar.gz
emacs-d8fb2015454acbb684137fb78f8dea954b601795.zip
* textmodes/reftex.el (reftex-find-citation-regexp-format):
Support for bibentry. (reftex-compile-variables): Fixed problem with end of section-re. * texmodes/reftex-dcr.el (reftex-view-crossref, reftex-view-crossref-from-bibtex): Deal with changed `reftex-find-citation-regexp-format'. (reftex-view-regexp-match, reftex-view-crossref-from-bibtex): Replaced `remprop' with `put'. (reftex-view-crossref, reftex-view-crossref-when-idle): Support for bibentry. * textmodes/reftex-vars.el (reftex-cite-format-builtin): New entry for bibentry package. * textmodes/reftex-parse.el (reftex-locate-bibliography-files): Regexp also matches "\nobibliography". * textmodes/reftex-global.el (reftex-renumber-simple-labels): Call `reftex-ensure-write-access' before doing anything. (reftex-ensure-write-access): New function.
-rw-r--r--lisp/textmodes/reftex-auc.el2
-rw-r--r--lisp/textmodes/reftex-cite.el2
-rw-r--r--lisp/textmodes/reftex-dcr.el14
-rw-r--r--lisp/textmodes/reftex-global.el25
-rw-r--r--lisp/textmodes/reftex-index.el2
-rw-r--r--lisp/textmodes/reftex-parse.el6
-rw-r--r--lisp/textmodes/reftex-ref.el2
-rw-r--r--lisp/textmodes/reftex-sel.el2
-rw-r--r--lisp/textmodes/reftex-toc.el2
-rw-r--r--lisp/textmodes/reftex-vars.el4
-rw-r--r--lisp/textmodes/reftex.el10
11 files changed, 49 insertions, 22 deletions
diff --git a/lisp/textmodes/reftex-auc.el b/lisp/textmodes/reftex-auc.el
index 91bc14f4225..2699d482a75 100644
--- a/lisp/textmodes/reftex-auc.el
+++ b/lisp/textmodes/reftex-auc.el
@@ -2,7 +2,7 @@
2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. 2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
3 3
4;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl> 4;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl>
5;; Version: 4.11 5;; Version: 4.14
6;; 6;;
7 7
8;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
diff --git a/lisp/textmodes/reftex-cite.el b/lisp/textmodes/reftex-cite.el
index f0525dbdbe1..f12eae0218d 100644
--- a/lisp/textmodes/reftex-cite.el
+++ b/lisp/textmodes/reftex-cite.el
@@ -2,7 +2,7 @@
2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. 2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
3 3
4;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl> 4;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl>
5;; Version: 4.11 5;; Version: 4.14
6;; 6;;
7 7
8;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
diff --git a/lisp/textmodes/reftex-dcr.el b/lisp/textmodes/reftex-dcr.el
index 60045bafc76..10dd5343c51 100644
--- a/lisp/textmodes/reftex-dcr.el
+++ b/lisp/textmodes/reftex-dcr.el
@@ -2,7 +2,7 @@
2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. 2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
3 3
4;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl> 4;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl>
5;; Version: 4.11 5;; Version: 4.14
6;; 6;;
7 7
8;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
@@ -56,7 +56,7 @@ to the functions `reftex-view-cr-cite' and `reftex-view-cr-ref'."
56 (setq reftex-call-back-to-this-buffer (current-buffer)) 56 (setq reftex-call-back-to-this-buffer (current-buffer))
57 57
58 (cond 58 (cond
59 ((string-match "\\`\\\\cite\\|cite\\*?\\'" macro) 59 ((string-match "\\`\\\\cite\\|cite\\*?\\'\\|bibentry" macro)
60 ;; A citation macro: search for bibitems or BibTeX entries 60 ;; A citation macro: search for bibitems or BibTeX entries
61 (setq dw (reftex-view-cr-cite arg key auto-how))) 61 (setq dw (reftex-view-cr-cite arg key auto-how)))
62 ((string-match "\\`\\\\ref\\|ref\\(range\\)?\\*?\\'" macro) 62 ((string-match "\\`\\\\ref\\|ref\\(range\\)?\\*?\\'" macro)
@@ -75,7 +75,7 @@ to the functions `reftex-view-cr-cite' and `reftex-view-cr-ref'."
75 (reftex-access-scan-info arg) 75 (reftex-access-scan-info arg)
76 (setq dw (reftex-view-regexp-match 76 (setq dw (reftex-view-regexp-match
77 (format reftex-find-citation-regexp-format (regexp-quote key)) 77 (format reftex-find-citation-regexp-format (regexp-quote key))
78 3 nil nil))) 78 4 nil nil)))
79 ((member macro reftex-macros-with-index) 79 ((member macro reftex-macros-with-index)
80 (reftex-access-scan-info arg) 80 (reftex-access-scan-info arg)
81 (setq dw (reftex-view-regexp-match 81 (setq dw (reftex-view-regexp-match
@@ -238,7 +238,7 @@ With argument, actually select the window showing the cross reference."
238 ;; FIXME: Can fail with backslash in comment 238 ;; FIXME: Can fail with backslash in comment
239 (save-excursion 239 (save-excursion
240 (search-backward "\\" nil t) 240 (search-backward "\\" nil t)
241 (looking-at "\\\\[a-zA-Z]*\\(cite\\|ref\\)")) 241 (looking-at "\\\\[a-zA-Z]*\\(cite\\|ref\\|bibentry\\)"))
242 242
243 (condition-case nil 243 (condition-case nil
244 (let ((current-prefix-arg nil)) 244 (let ((current-prefix-arg nil))
@@ -357,7 +357,7 @@ Calling this function several times find successive citation locations."
357 (interactive "P") 357 (interactive "P")
358 (when arg 358 (when arg
359 ;; Break connection to reference buffer 359 ;; Break connection to reference buffer
360 (remprop 'reftex-bibtex-view-cite-locations :ref-buffer)) 360 (put 'reftex-bibtex-view-cite-locations :ref-buffer nil))
361 (let ((ref-buffer (get 'reftex-bibtex-view-cite-locations :ref-buffer))) 361 (let ((ref-buffer (get 'reftex-bibtex-view-cite-locations :ref-buffer)))
362 ;; Establish connection to reference buffer 362 ;; Establish connection to reference buffer
363 (unless ref-buffer 363 (unless ref-buffer
@@ -382,7 +382,7 @@ Calling this function several times find successive citation locations."
382 (reftex-view-regexp-match 382 (reftex-view-regexp-match
383 (format reftex-find-citation-regexp-format 383 (format reftex-find-citation-regexp-format
384 (regexp-quote (match-string 1))) 384 (regexp-quote (match-string 1)))
385 3 arg ref-buffer)) 385 4 arg ref-buffer))
386 (error "Cannot find citation key in BibTeX entry")))) 386 (error "Cannot find citation key in BibTeX entry"))))
387 387
388(defun reftex-view-regexp-match (re &optional highlight-group new ref-buffer) 388(defun reftex-view-regexp-match (re &optional highlight-group new ref-buffer)
@@ -418,7 +418,7 @@ Calling this function several times find successive citation locations."
418 (match-end highlight-group)) 418 (match-end highlight-group))
419 (add-hook 'pre-command-hook 'reftex-highlight-shall-die) 419 (add-hook 'pre-command-hook 'reftex-highlight-shall-die)
420 (setq pop-window (selected-window))) 420 (setq pop-window (selected-window)))
421 (remprop 'reftex-view-regexp-match :props) 421 (put 'reftex-view-regexp-match :props nil)
422 (or cont (set-window-configuration window-conf))) 422 (or cont (set-window-configuration window-conf)))
423 (select-window current-window) 423 (select-window current-window)
424 (if match 424 (if match
diff --git a/lisp/textmodes/reftex-global.el b/lisp/textmodes/reftex-global.el
index 06c3be4e951..8cd2d4da3e2 100644
--- a/lisp/textmodes/reftex-global.el
+++ b/lisp/textmodes/reftex-global.el
@@ -2,7 +2,7 @@
2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. 2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
3 3
4;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl> 4;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl>
5;; Version: 4.11 5;; Version: 4.14
6;; 6;;
7 7
8;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
@@ -218,6 +218,8 @@ one with the `xr' package."
218 (unless changed-sequence 218 (unless changed-sequence
219 (error "Simple labels are already in correct sequence")) 219 (error "Simple labels are already in correct sequence"))
220 220
221 (reftex-ensure-write-access (reftex-all-document-files))
222
221 ;; Save all document buffers before this operation 223 ;; Save all document buffers before this operation
222 (reftex-save-all-document-buffers) 224 (reftex-save-all-document-buffers)
223 225
@@ -311,5 +313,26 @@ labels."
311 (set-buffer buffer) 313 (set-buffer buffer)
312 (save-buffer)))))) 314 (save-buffer))))))
313 315
316(defun reftex-ensure-write-access (files)
317 "Make sure we have write access to all files in FILES.
318Also checks if buffers visiting the files are in read-only mode."
319 (let (file buf)
320 (while (setq file (pop files))
321 (unless (file-exists-p file)
322 (ding)
323 (or (y-or-n-p (format "No such file %s. Continue? " file))
324 (error "Abort")))
325 (unless (file-writable-p file)
326 (ding)
327 (or (y-or-n-p (format "No write access to %s. Continue? " file))
328 (error "Abort")))
329 (when (and (setq buf (reftex-get-buffer-visiting file))
330 (save-excursion
331 (set-buffer buf)
332 buffer-read-only))
333 (ding)
334 (or (y-or-n-p (format "Buffer %s is read-only. Continue? "
335 (buffer-name buf)))
336 (error "Abort"))))))
314 337
315;;; reftex-global.el ends here 338;;; reftex-global.el ends here
diff --git a/lisp/textmodes/reftex-index.el b/lisp/textmodes/reftex-index.el
index fa49c9d1296..900e6000eb4 100644
--- a/lisp/textmodes/reftex-index.el
+++ b/lisp/textmodes/reftex-index.el
@@ -2,7 +2,7 @@
2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. 2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
3 3
4;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl> 4;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl>
5;; Version: 4.11 5;; Version: 4.14
6;; 6;;
7 7
8;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
diff --git a/lisp/textmodes/reftex-parse.el b/lisp/textmodes/reftex-parse.el
index 5d5ce76e419..59e078aad3b 100644
--- a/lisp/textmodes/reftex-parse.el
+++ b/lisp/textmodes/reftex-parse.el
@@ -2,7 +2,7 @@
2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. 2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
3 3
4;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl> 4;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl>
5;; Version: 4.11 5;; Version: 4.14
6;; 6;;
7 7
8;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
@@ -330,9 +330,9 @@ of master file."
330 (save-excursion 330 (save-excursion
331 (goto-char (point-min)) 331 (goto-char (point-min))
332 (if (re-search-forward 332 (if (re-search-forward
333 "\\(\\`\\|[\n\r]\\)[ \t]*\\\\bibliography{[ \t]*\\([^}]+\\)" nil t) 333 "\\(\\`\\|[\n\r]\\)[ \t]*\\\\\\(no\\)?bibliography{[ \t]*\\([^}]+\\)" nil t)
334 (setq files 334 (setq files
335 (split-string (reftex-match-string 2) 335 (split-string (reftex-match-string 3)
336 "[ \t\n\r]*,[ \t\n\r]*"))))) 336 "[ \t\n\r]*,[ \t\n\r]*")))))
337 (when files 337 (when files
338 (setq files 338 (setq files
diff --git a/lisp/textmodes/reftex-ref.el b/lisp/textmodes/reftex-ref.el
index 591b9cfe993..44609914ec3 100644
--- a/lisp/textmodes/reftex-ref.el
+++ b/lisp/textmodes/reftex-ref.el
@@ -2,7 +2,7 @@
2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. 2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
3 3
4;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl> 4;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl>
5;; Version: 4.11 5;; Version: 4.14
6;; 6;;
7 7
8;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
diff --git a/lisp/textmodes/reftex-sel.el b/lisp/textmodes/reftex-sel.el
index d79ffadf253..044c384fc26 100644
--- a/lisp/textmodes/reftex-sel.el
+++ b/lisp/textmodes/reftex-sel.el
@@ -2,7 +2,7 @@
2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. 2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
3 3
4;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl> 4;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl>
5;; Version: 4.11 5;; Version: 4.14
6;; 6;;
7 7
8;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
diff --git a/lisp/textmodes/reftex-toc.el b/lisp/textmodes/reftex-toc.el
index 9f5cb0ce9ac..cb7e52b75c5 100644
--- a/lisp/textmodes/reftex-toc.el
+++ b/lisp/textmodes/reftex-toc.el
@@ -2,7 +2,7 @@
2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. 2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
3 3
4;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl> 4;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl>
5;; Version: 4.11 5;; Version: 4.14
6;; 6;;
7 7
8;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
diff --git a/lisp/textmodes/reftex-vars.el b/lisp/textmodes/reftex-vars.el
index de2d583dcd1..f651d0b8de0 100644
--- a/lisp/textmodes/reftex-vars.el
+++ b/lisp/textmodes/reftex-vars.el
@@ -2,7 +2,7 @@
2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. 2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
3 3
4;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl> 4;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl>
5;; Version: 4.11 5;; Version: 4.14
6;; 6;;
7 7
8;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
@@ -134,6 +134,8 @@ distribution. Mixed-case symbols are convenience aliases.")
134 (?a . "\\citeauthor{%l}") 134 (?a . "\\citeauthor{%l}")
135 (?A . "\\citeauthor*{%l}") 135 (?A . "\\citeauthor*{%l}")
136 (?y . "\\citeyear{%l}"))) 136 (?y . "\\citeyear{%l}")))
137 (bibentry "The Bibentry package"
138 "\\bibentry{%l}")
137 (harvard "The Harvard package" 139 (harvard "The Harvard package"
138 ((?\C-m . "\\cite{%l}") 140 ((?\C-m . "\\cite{%l}")
139 (?p . "\\cite{%l}") 141 (?p . "\\cite{%l}")
diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el
index 679dc62bba8..9468235a9df 100644
--- a/lisp/textmodes/reftex.el
+++ b/lisp/textmodes/reftex.el
@@ -2,7 +2,7 @@
2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. 2;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
3 3
4;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl> 4;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl>
5;; Version: 4.11 5;; Version: 4.14
6;; Keywords: tex 6;; Keywords: tex
7 7
8;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
@@ -300,7 +300,7 @@
300;;; Define the formal stuff for a minor mode named RefTeX. 300;;; Define the formal stuff for a minor mode named RefTeX.
301;;; 301;;;
302 302
303(defconst reftex-version "RefTeX version 4.11" 303(defconst reftex-version "RefTeX version 4.14"
304 "Version string for RefTeX.") 304 "Version string for RefTeX.")
305 305
306(defvar reftex-mode nil 306(defvar reftex-mode nil
@@ -689,7 +689,7 @@ the label information is recompiled on next use."
689(defvar reftex-everything-regexp-no-index nil) 689(defvar reftex-everything-regexp-no-index nil)
690(defvar reftex-index-re nil) 690(defvar reftex-index-re nil)
691(defvar reftex-find-citation-regexp-format 691(defvar reftex-find-citation-regexp-format
692 "\\\\[a-zA-Z]*cite[*a-zA-Z]*\\*?\\(\\[[^]]*\\]\\|{[^}]*}\\)*{\\([^}]*,\\)?\\(%s\\)[},]") 692 "\\\\\\([a-zA-Z]*cite[*a-zA-Z]*\\*?\\|bibentry\\)\\(\\[[^]]*\\]\\|{[^}]*}\\)*{\\([^}]*,\\)?\\(%s\\)[},]")
693(defvar reftex-find-reference-format 693(defvar reftex-find-reference-format
694 "\\\\\\(ref[a-zA-Z]*\\|[a-zA-Z]*ref\\(range\\)?\\)\\*?\\(\\[[^]]*\\]\\|{[^}]*}\\)*{\\(%s\\)}") 694 "\\\\\\(ref[a-zA-Z]*\\|[a-zA-Z]*ref\\(range\\)?\\)\\*?\\(\\[[^]]*\\]\\|{[^}]*}\\)*{\\(%s\\)}")
695(defvar reftex-macros-with-labels nil) 695(defvar reftex-macros-with-labels nil)
@@ -1097,7 +1097,7 @@ This enforces rescanning the buffer on next use."
1097 (concat wbol "\\\\\\(" 1097 (concat wbol "\\\\\\("
1098 (mapconcat (lambda (x) (regexp-quote (car x))) 1098 (mapconcat (lambda (x) (regexp-quote (car x)))
1099 reftex-section-levels-all "\\|") 1099 reftex-section-levels-all "\\|")
1100 "\\)\\*?\\(\\[[^]]*\\]\\)?{?")) 1100 "\\)\\*?\\(\\[[^]]*\\]\\)?[[{ \t\r\n]"))
1101 (appendix-re (concat wbol "\\(\\\\appendix\\)")) 1101 (appendix-re (concat wbol "\\(\\\\appendix\\)"))
1102 (macro-re 1102 (macro-re
1103 (if macros-with-labels 1103 (if macros-with-labels
@@ -1609,6 +1609,8 @@ When DIE is non-nil, throw an error if file not found."
1609;;; 1609;;;
1610;;; BibTeX citations. 1610;;; BibTeX citations.
1611 1611
1612(autoload 'reftex-citep "reftex-cite")
1613(autoload 'reftex-citet "reftex-cite")
1612(autoload 'reftex-make-cite-echo-string "reftex-cite") 1614(autoload 'reftex-make-cite-echo-string "reftex-cite")
1613(autoload 'reftex-get-bibfile-list "reftex-cite") 1615(autoload 'reftex-get-bibfile-list "reftex-cite")
1614(autoload 'reftex-pop-to-bibtex-entry "reftex-cite") 1616(autoload 'reftex-pop-to-bibtex-entry "reftex-cite")