aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1993-05-11 21:15:54 +0000
committerRichard M. Stallman1993-05-11 21:15:54 +0000
commit7ef84cf98fa48baa6cc03206d487fee1605d2dca (patch)
tree1a84669e65c456c76030dec2963743a6d028fd65
parentbdda375433804a072ef362167656aaa502162c83 (diff)
downloademacs-7ef84cf98fa48baa6cc03206d487fee1605d2dca.tar.gz
emacs-7ef84cf98fa48baa6cc03206d487fee1605d2dca.zip
(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.
-rw-r--r--lisp/vc.el28
1 files changed, 21 insertions, 7 deletions
diff --git a/lisp/vc.el b/lisp/vc.el
index 67c10a2713e..60789073cc0 100644
--- a/lisp/vc.el
+++ b/lisp/vc.el
@@ -45,6 +45,7 @@
45;; This code depends on call-process passing back the subprocess exit 45;; This code depends on call-process passing back the subprocess exit
46;; status. Thus, you need Emacs 18.58 or later to run it. For the 46;; status. Thus, you need Emacs 18.58 or later to run it. For the
47;; vc-directory command to work properly as documented, you need 19. 47;; vc-directory command to work properly as documented, you need 19.
48;; You also need Emacs 19's ring.el.
48;; 49;;
49;; The vc code maintains some internal state in order to reduce expensive 50;; The vc code maintains some internal state in order to reduce expensive
50;; version-control operations to a minimum. Some names are only computed 51;; version-control operations to a minimum. Some names are only computed
@@ -159,6 +160,11 @@ is sensitive to blank lines.")
159 (let ((name-and-type (vc-registered file))) 160 (let ((name-and-type (vc-registered file)))
160 (and name-and-type (car name-and-type)))))) 161 (and name-and-type (car name-and-type))))))
161 162
163(defun vc-registration-error (file)
164 (if file
165 (error "File %s is not under version control." file)
166 (error "Buffer %s is not associated with a file." (buffer-name))))
167
162(defvar vc-binary-assoc nil) 168(defvar vc-binary-assoc nil)
163 169
164(defun vc-find-binary (name) 170(defun vc-find-binary (name)
@@ -276,7 +282,8 @@ the master name of FILE; this is appended to an optional list of FLAGS."
276 ;; iff that buffer is a compilation output buffer 282 ;; iff that buffer is a compilation output buffer
277 ;; that contains markers into the current buffer. 283 ;; that contains markers into the current buffer.
278 (save-excursion 284 (save-excursion
279 (mapcar (lambda (buffer) 285 (mapcar (function
286 (lambda (buffer)
280 (set-buffer buffer) 287 (set-buffer buffer)
281 (let ((errors (or 288 (let ((errors (or
282 compilation-old-error-list 289 compilation-old-error-list
@@ -290,7 +297,7 @@ the master name of FILE; this is appended to an optional list of FLAGS."
290 (cdr (car errors)))) 297 (cdr (car errors))))
291 (setq buffer-error-marked-p t)) 298 (setq buffer-error-marked-p t))
292 (setq errors (cdr errors))) 299 (setq errors (cdr errors)))
293 (if buffer-error-marked-p buffer))) 300 (if buffer-error-marked-p buffer))))
294 (buffer-list))))))) 301 (buffer-list)))))))
295 302
296 ;; the actual revisit 303 ;; the actual revisit
@@ -454,7 +461,7 @@ lock steals will raise an error."
454 (pop-to-buffer vc-parent-buffer)) 461 (pop-to-buffer vc-parent-buffer))
455 (if buffer-file-name 462 (if buffer-file-name
456 (vc-next-action-on-file buffer-file-name verbose) 463 (vc-next-action-on-file buffer-file-name verbose)
457 (error "There is no file associated with buffer %s" (buffer-name))))) 464 (vc-registration-error nil))))
458 465
459;;; These functions help the vc-next-action entry point 466;;; These functions help the vc-next-action entry point
460 467
@@ -710,6 +717,8 @@ and two version designators specifying which versions to compare."
710 (error "There is no version-control master associated with this buffer.")) 717 (error "There is no version-control master associated with this buffer."))
711 (let ((file buffer-file-name) 718 (let ((file buffer-file-name)
712 unchanged) 719 unchanged)
720 (or (and file (vc-name file))
721 (vc-registration-error file))
713 (vc-buffer-sync) 722 (vc-buffer-sync)
714 (setq unchanged (vc-workfile-unchanged-p buffer-file-name)) 723 (setq unchanged (vc-workfile-unchanged-p buffer-file-name))
715 (if unchanged 724 (if unchanged
@@ -885,10 +894,11 @@ on a buffer attached to the file named in the current Dired buffer line."
885 (setq buffer-read-only nil) 894 (setq buffer-read-only nil)
886 (forward-line 1) ;; Skip header line 895 (forward-line 1) ;; Skip header line
887 (mapcar 896 (mapcar
888 (lambda (x) 897 (function
898 (lambda (x)
889 (forward-char 2) ;; skip dired's mark area 899 (forward-char 2) ;; skip dired's mark area
890 (vc-dired-reformat-line x) 900 (vc-dired-reformat-line x)
891 (forward-line 1)) ;; go to next line 901 (forward-line 1))) ;; go to next line
892 (nreverse userlist)) 902 (nreverse userlist))
893 (setq buffer-read-only t) 903 (setq buffer-read-only t)
894 (goto-char (point-min)) 904 (goto-char (point-min))
@@ -927,6 +937,10 @@ on a buffer attached to the file named in the current Dired buffer line."
927(or (boundp 'minor-mode-map-alist) 937(or (boundp 'minor-mode-map-alist)
928 (fset 'vc-directory 'vc-directory-18)) 938 (fset 'vc-directory 'vc-directory-18))
929 939
940; Emacs 18 also lacks these.
941(or (boundp 'compilation-old-error-list)
942 (setq compilation-old-error-list nil))
943
930;; Named-configuration support for SCCS 944;; Named-configuration support for SCCS
931 945
932(defun vc-add-triple (name file rev) 946(defun vc-add-triple (name file rev)
@@ -1018,7 +1032,7 @@ levels in the snapshot."
1018 (vc-shrink-to-fit) 1032 (vc-shrink-to-fit)
1019 (goto-char (point-min)) 1033 (goto-char (point-min))
1020 ) 1034 )
1021 (error "There is no version-control master associated with this buffer") 1035 (vc-registration-error buffer-file-name)
1022 ) 1036 )
1023 ) 1037 )
1024 1038
@@ -1483,7 +1497,7 @@ Return nil if there is no such person."
1483 (setq newvers (vc-lookup-triple file newvers))) 1497 (setq newvers (vc-lookup-triple file newvers)))
1484 (apply 'vc-do-command 1 1498 (apply 'vc-do-command 1
1485 (or (vc-backend-dispatch file "vcdiff" "rcsdiff") 1499 (or (vc-backend-dispatch file "vcdiff" "rcsdiff")
1486 (error "File %s is not under version control." file)) 1500 (vc-registration-error file))
1487 file 1501 file
1488 (and oldvers (concat "-r" oldvers)) 1502 (and oldvers (concat "-r" oldvers))
1489 (and newvers (concat "-r" newvers)) 1503 (and newvers (concat "-r" newvers))