Commit d8fb2015 authored by Carsten Dominik's avatar Carsten Dominik
Browse files

* 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.
parent 15e42531
......@@ -2,7 +2,7 @@
;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl>
;; Version: 4.11
;; Version: 4.14
;;
;; This file is part of GNU Emacs.
......
......@@ -2,7 +2,7 @@
;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl>
;; Version: 4.11
;; Version: 4.14
;;
;; This file is part of GNU Emacs.
......
......@@ -2,7 +2,7 @@
;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl>
;; 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
......
......@@ -2,7 +2,7 @@
;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl>
;; 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
......@@ -2,7 +2,7 @@
;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl>
;; Version: 4.11
;; Version: 4.14
;;
;; This file is part of GNU Emacs.
......
......@@ -2,7 +2,7 @@
;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl>
;; 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
......
......@@ -2,7 +2,7 @@
;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl>
;; Version: 4.11
;; Version: 4.14
;;
;; This file is part of GNU Emacs.
......
......@@ -2,7 +2,7 @@
;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl>
;; Version: 4.11
;; Version: 4.14
;;
;; This file is part of GNU Emacs.
......
......@@ -2,7 +2,7 @@
;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl>
;; Version: 4.11
;; Version: 4.14
;;
;; This file is part of GNU Emacs.
......
......@@ -2,7 +2,7 @@
;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl>
;; 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}")
......
......@@ -2,7 +2,7 @@
;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl>
;; 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")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment