From: Carsten Dominik Date: Tue, 20 Jun 2000 12:52:00 +0000 (+0000) Subject: * textmodes/reftex.el (reftex-find-citation-regexp-format): X-Git-Tag: emacs-pretest-21.0.90~3211 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d8fb2015454acbb684137fb78f8dea954b601795;p=emacs.git * 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. --- 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 @@ ;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. ;; Author: Carsten Dominik -;; Version: 4.11 +;; Version: 4.14 ;; ;; 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 @@ ;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. ;; Author: Carsten Dominik -;; Version: 4.11 +;; Version: 4.14 ;; ;; 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 @@ ;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. ;; Author: Carsten Dominik -;; Version: 4.11 +;; Version: 4.14 ;; ;; This file is part of GNU Emacs. @@ -56,7 +56,7 @@ to the functions `reftex-view-cr-cite' and `reftex-view-cr-ref'." (setq reftex-call-back-to-this-buffer (current-buffer)) (cond - ((string-match "\\`\\\\cite\\|cite\\*?\\'" macro) + ((string-match "\\`\\\\cite\\|cite\\*?\\'\\|bibentry" macro) ;; A citation macro: search for bibitems or BibTeX entries (setq dw (reftex-view-cr-cite arg key auto-how))) ((string-match "\\`\\\\ref\\|ref\\(range\\)?\\*?\\'" macro) @@ -75,7 +75,7 @@ to the functions `reftex-view-cr-cite' and `reftex-view-cr-ref'." (reftex-access-scan-info arg) (setq dw (reftex-view-regexp-match (format reftex-find-citation-regexp-format (regexp-quote key)) - 3 nil nil))) + 4 nil nil))) ((member macro reftex-macros-with-index) (reftex-access-scan-info arg) (setq dw (reftex-view-regexp-match @@ -238,7 +238,7 @@ With argument, actually select the window showing the cross reference." ;; FIXME: Can fail with backslash in comment (save-excursion (search-backward "\\" nil t) - (looking-at "\\\\[a-zA-Z]*\\(cite\\|ref\\)")) + (looking-at "\\\\[a-zA-Z]*\\(cite\\|ref\\|bibentry\\)")) (condition-case nil (let ((current-prefix-arg nil)) @@ -357,7 +357,7 @@ Calling this function several times find successive citation locations." (interactive "P") (when arg ;; Break connection to reference buffer - (remprop 'reftex-bibtex-view-cite-locations :ref-buffer)) + (put 'reftex-bibtex-view-cite-locations :ref-buffer nil)) (let ((ref-buffer (get 'reftex-bibtex-view-cite-locations :ref-buffer))) ;; Establish connection to reference buffer (unless ref-buffer @@ -382,7 +382,7 @@ Calling this function several times find successive citation locations." (reftex-view-regexp-match (format reftex-find-citation-regexp-format (regexp-quote (match-string 1))) - 3 arg ref-buffer)) + 4 arg ref-buffer)) (error "Cannot find citation key in BibTeX entry")))) (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." (match-end highlight-group)) (add-hook 'pre-command-hook 'reftex-highlight-shall-die) (setq pop-window (selected-window))) - (remprop 'reftex-view-regexp-match :props) + (put 'reftex-view-regexp-match :props nil) (or cont (set-window-configuration window-conf))) (select-window current-window) (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 @@ ;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. ;; Author: Carsten Dominik -;; Version: 4.11 +;; Version: 4.14 ;; ;; This file is part of GNU Emacs. @@ -218,6 +218,8 @@ one with the `xr' package." (unless changed-sequence (error "Simple labels are already in correct sequence")) + (reftex-ensure-write-access (reftex-all-document-files)) + ;; Save all document buffers before this operation (reftex-save-all-document-buffers) @@ -311,5 +313,26 @@ labels." (set-buffer buffer) (save-buffer)))))) +(defun reftex-ensure-write-access (files) + "Make sure we have write access to all files in FILES. +Also checks if buffers visiting the files are in read-only mode." + (let (file buf) + (while (setq file (pop files)) + (unless (file-exists-p file) + (ding) + (or (y-or-n-p (format "No such file %s. Continue? " file)) + (error "Abort"))) + (unless (file-writable-p file) + (ding) + (or (y-or-n-p (format "No write access to %s. Continue? " file)) + (error "Abort"))) + (when (and (setq buf (reftex-get-buffer-visiting file)) + (save-excursion + (set-buffer buf) + buffer-read-only)) + (ding) + (or (y-or-n-p (format "Buffer %s is read-only. Continue? " + (buffer-name buf))) + (error "Abort")))))) ;;; 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 @@ ;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. ;; Author: Carsten Dominik -;; Version: 4.11 +;; Version: 4.14 ;; ;; 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 @@ ;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. ;; Author: Carsten Dominik -;; Version: 4.11 +;; Version: 4.14 ;; ;; This file is part of GNU Emacs. @@ -330,9 +330,9 @@ of master file." (save-excursion (goto-char (point-min)) (if (re-search-forward - "\\(\\`\\|[\n\r]\\)[ \t]*\\\\bibliography{[ \t]*\\([^}]+\\)" nil t) + "\\(\\`\\|[\n\r]\\)[ \t]*\\\\\\(no\\)?bibliography{[ \t]*\\([^}]+\\)" nil t) (setq files - (split-string (reftex-match-string 2) + (split-string (reftex-match-string 3) "[ \t\n\r]*,[ \t\n\r]*"))))) (when files (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 @@ ;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. ;; Author: Carsten Dominik -;; Version: 4.11 +;; Version: 4.14 ;; ;; 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 @@ ;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. ;; Author: Carsten Dominik -;; Version: 4.11 +;; Version: 4.14 ;; ;; 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 @@ ;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. ;; Author: Carsten Dominik -;; Version: 4.11 +;; Version: 4.14 ;; ;; 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 @@ ;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. ;; Author: Carsten Dominik -;; Version: 4.11 +;; Version: 4.14 ;; ;; This file is part of GNU Emacs. @@ -134,6 +134,8 @@ distribution. Mixed-case symbols are convenience aliases.") (?a . "\\citeauthor{%l}") (?A . "\\citeauthor*{%l}") (?y . "\\citeyear{%l}"))) + (bibentry "The Bibentry package" + "\\bibentry{%l}") (harvard "The Harvard package" ((?\C-m . "\\cite{%l}") (?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 @@ ;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. ;; Author: Carsten Dominik -;; Version: 4.11 +;; Version: 4.14 ;; Keywords: tex ;; This file is part of GNU Emacs. @@ -300,7 +300,7 @@ ;;; Define the formal stuff for a minor mode named RefTeX. ;;; -(defconst reftex-version "RefTeX version 4.11" +(defconst reftex-version "RefTeX version 4.14" "Version string for RefTeX.") (defvar reftex-mode nil @@ -689,7 +689,7 @@ the label information is recompiled on next use." (defvar reftex-everything-regexp-no-index nil) (defvar reftex-index-re nil) (defvar reftex-find-citation-regexp-format - "\\\\[a-zA-Z]*cite[*a-zA-Z]*\\*?\\(\\[[^]]*\\]\\|{[^}]*}\\)*{\\([^}]*,\\)?\\(%s\\)[},]") + "\\\\\\([a-zA-Z]*cite[*a-zA-Z]*\\*?\\|bibentry\\)\\(\\[[^]]*\\]\\|{[^}]*}\\)*{\\([^}]*,\\)?\\(%s\\)[},]") (defvar reftex-find-reference-format "\\\\\\(ref[a-zA-Z]*\\|[a-zA-Z]*ref\\(range\\)?\\)\\*?\\(\\[[^]]*\\]\\|{[^}]*}\\)*{\\(%s\\)}") (defvar reftex-macros-with-labels nil) @@ -1097,7 +1097,7 @@ This enforces rescanning the buffer on next use." (concat wbol "\\\\\\(" (mapconcat (lambda (x) (regexp-quote (car x))) reftex-section-levels-all "\\|") - "\\)\\*?\\(\\[[^]]*\\]\\)?{?")) + "\\)\\*?\\(\\[[^]]*\\]\\)?[[{ \t\r\n]")) (appendix-re (concat wbol "\\(\\\\appendix\\)")) (macro-re (if macros-with-labels @@ -1609,6 +1609,8 @@ When DIE is non-nil, throw an error if file not found." ;;; ;;; BibTeX citations. +(autoload 'reftex-citep "reftex-cite") +(autoload 'reftex-citet "reftex-cite") (autoload 'reftex-make-cite-echo-string "reftex-cite") (autoload 'reftex-get-bibfile-list "reftex-cite") (autoload 'reftex-pop-to-bibtex-entry "reftex-cite")