changeset 2745:adf91f018312

(vc-diff): Report an error if the buffer isn't registered. (vc-registration-error): New function. (vc-next-action, vc-diff, vc-print-log, vc-backend-diff): Use it to make VC's error messages more uniform. (vc-directory, vc-revert-buffer1): Quote lambdas with (function ...) for Emacs 18. (compilation-old-error-list): Set if undefined, for Emacs 18.
author Richard M. Stallman <rms@gnu.org>
date Tue, 11 May 1993 21:15:54 +0000
parents f4fc0c4c76f9
children e4595f258ddd
files lisp/vc.el
diffstat 1 files changed, 21 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/vc.el	Tue May 11 19:14:34 1993 +0000
+++ b/lisp/vc.el	Tue May 11 21:15:54 1993 +0000
@@ -45,6 +45,7 @@
 ;; This code depends on call-process passing back the subprocess exit
 ;; status.  Thus, you need Emacs 18.58 or later to run it.  For the
 ;; vc-directory command to work properly as documented, you need 19.
+;; You also need Emacs 19's ring.el.
 ;;
 ;; The vc code maintains some internal state in order to reduce expensive
 ;; version-control operations to a minimum.  Some names are only computed
@@ -159,6 +160,11 @@
 		       (let ((name-and-type (vc-registered file)))
 			 (and name-and-type (car name-and-type))))))
 
+(defun vc-registration-error (file)
+  (if file
+      (error "File %s is not under version control." file)
+    (error "Buffer %s is not associated with a file." (buffer-name))))
+
 (defvar vc-binary-assoc nil)
 
 (defun vc-find-binary (name)
@@ -276,7 +282,8 @@
 			;; iff that buffer is a compilation output buffer
 			;; that contains markers into the current buffer.
 			(save-excursion
-			  (mapcar (lambda (buffer)
+			  (mapcar (function
+				   (lambda (buffer)
 				    (set-buffer buffer)
 				    (let ((errors (or
 						   compilation-old-error-list
@@ -290,7 +297,7 @@
 						  (cdr (car errors))))
 					     (setq buffer-error-marked-p t))
 					(setq errors (cdr errors)))
-				      (if buffer-error-marked-p buffer)))
+				      (if buffer-error-marked-p buffer))))
 				  (buffer-list)))))))
 
     ;; the actual revisit
@@ -454,7 +461,7 @@
       (pop-to-buffer vc-parent-buffer))
     (if buffer-file-name
 	(vc-next-action-on-file buffer-file-name verbose)
-      (error "There is no file associated with buffer %s" (buffer-name)))))
+      (vc-registration-error nil))))
 
 ;;; These functions help the vc-next-action entry point
 
@@ -710,6 +717,8 @@
 	(error "There is no version-control master associated with this buffer."))
     (let ((file buffer-file-name)
 	  unchanged)
+      (or (and file (vc-name file))
+	  (vc-registration-error file))
       (vc-buffer-sync)
       (setq unchanged (vc-workfile-unchanged-p buffer-file-name))
       (if unchanged
@@ -885,10 +894,11 @@
 	  (setq buffer-read-only nil)
 	  (forward-line 1)	;; Skip header line
 	  (mapcar
-	   (lambda (x)
+	   (function
+	    (lambda (x)
 	     (forward-char 2)	;; skip dired's mark area
 	     (vc-dired-reformat-line x)
-	     (forward-line 1))	;; go to next line
+	     (forward-line 1)))	;; go to next line
 	   (nreverse userlist))
 	  (setq buffer-read-only t)
 	  (goto-char (point-min))
@@ -927,6 +937,10 @@
 (or (boundp 'minor-mode-map-alist)
     (fset 'vc-directory 'vc-directory-18))
 
+; Emacs 18 also lacks these.
+(or (boundp 'compilation-old-error-list)
+    (setq compilation-old-error-list nil))
+
 ;; Named-configuration support for SCCS
 
 (defun vc-add-triple (name file rev)
@@ -1018,7 +1032,7 @@
 	(vc-shrink-to-fit)
 	(goto-char (point-min))
 	)
-    (error "There is no version-control master associated with this buffer")
+    (vc-registration-error buffer-file-name)
     )
   )
 
@@ -1483,7 +1497,7 @@
       (setq newvers (vc-lookup-triple file newvers)))
   (apply 'vc-do-command 1
 	 (or (vc-backend-dispatch file "vcdiff" "rcsdiff")
-	     (error "File %s is not under version control." file))
+	     (vc-registration-error file))
 	 file
 	 (and oldvers (concat "-r" oldvers))
 	 (and newvers (concat "-r" newvers))