# HG changeset patch # User Carsten Dominik # Date 961505520 0 # Node ID 31536c6cf2e328ddb28c3222ba9b51c794de3316 # Parent 8eff9cc9cbae365547845cc63eae953278b02ef0 * 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 -r 8eff9cc9cbae -r 31536c6cf2e3 lisp/textmodes/reftex-auc.el --- a/lisp/textmodes/reftex-auc.el Tue Jun 20 12:49:47 2000 +0000 +++ b/lisp/textmodes/reftex-auc.el Tue Jun 20 12:52:00 2000 +0000 @@ -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 -r 8eff9cc9cbae -r 31536c6cf2e3 lisp/textmodes/reftex-cite.el --- a/lisp/textmodes/reftex-cite.el Tue Jun 20 12:49:47 2000 +0000 +++ b/lisp/textmodes/reftex-cite.el Tue Jun 20 12:52:00 2000 +0000 @@ -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 -r 8eff9cc9cbae -r 31536c6cf2e3 lisp/textmodes/reftex-dcr.el --- a/lisp/textmodes/reftex-dcr.el Tue Jun 20 12:49:47 2000 +0000 +++ b/lisp/textmodes/reftex-dcr.el Tue Jun 20 12:52:00 2000 +0000 @@ -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 @@ (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 @@ (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 @@ ;; 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 @@ (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 @@ (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 @@ (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 -r 8eff9cc9cbae -r 31536c6cf2e3 lisp/textmodes/reftex-global.el --- a/lisp/textmodes/reftex-global.el Tue Jun 20 12:49:47 2000 +0000 +++ b/lisp/textmodes/reftex-global.el Tue Jun 20 12:52:00 2000 +0000 @@ -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 @@ (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 @@ (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 -r 8eff9cc9cbae -r 31536c6cf2e3 lisp/textmodes/reftex-index.el --- a/lisp/textmodes/reftex-index.el Tue Jun 20 12:49:47 2000 +0000 +++ b/lisp/textmodes/reftex-index.el Tue Jun 20 12:52:00 2000 +0000 @@ -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 -r 8eff9cc9cbae -r 31536c6cf2e3 lisp/textmodes/reftex-parse.el --- a/lisp/textmodes/reftex-parse.el Tue Jun 20 12:49:47 2000 +0000 +++ b/lisp/textmodes/reftex-parse.el Tue Jun 20 12:52:00 2000 +0000 @@ -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 @@ (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 -r 8eff9cc9cbae -r 31536c6cf2e3 lisp/textmodes/reftex-ref.el --- a/lisp/textmodes/reftex-ref.el Tue Jun 20 12:49:47 2000 +0000 +++ b/lisp/textmodes/reftex-ref.el Tue Jun 20 12:52:00 2000 +0000 @@ -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 -r 8eff9cc9cbae -r 31536c6cf2e3 lisp/textmodes/reftex-sel.el --- a/lisp/textmodes/reftex-sel.el Tue Jun 20 12:49:47 2000 +0000 +++ b/lisp/textmodes/reftex-sel.el Tue Jun 20 12:52:00 2000 +0000 @@ -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 -r 8eff9cc9cbae -r 31536c6cf2e3 lisp/textmodes/reftex-toc.el --- a/lisp/textmodes/reftex-toc.el Tue Jun 20 12:49:47 2000 +0000 +++ b/lisp/textmodes/reftex-toc.el Tue Jun 20 12:52:00 2000 +0000 @@ -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 -r 8eff9cc9cbae -r 31536c6cf2e3 lisp/textmodes/reftex-vars.el --- a/lisp/textmodes/reftex-vars.el Tue Jun 20 12:49:47 2000 +0000 +++ b/lisp/textmodes/reftex-vars.el Tue Jun 20 12:52:00 2000 +0000 @@ -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 @@ (?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 -r 8eff9cc9cbae -r 31536c6cf2e3 lisp/textmodes/reftex.el --- a/lisp/textmodes/reftex.el Tue Jun 20 12:49:47 2000 +0000 +++ b/lisp/textmodes/reftex.el Tue Jun 20 12:52:00 2000 +0000 @@ -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 @@ (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 @@ (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 @@ ;;; ;;; 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")