diff lisp/textmodes/reftex-global.el @ 29775:31536c6cf2e3

* 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.
author Carsten Dominik <dominik@science.uva.nl>
date Tue, 20 Jun 2000 12:52:00 +0000
parents 37b7d4f540f1
children 5eec8d1d09f0
line wrap: on
line diff
--- 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 <dominik@strw.LeidenUniv.nl>
-;; 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