summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorThien-Thi Nguyen <ttn@gnuvola.org>2008-02-09 12:32:57 +0000
committerThien-Thi Nguyen <ttn@gnuvola.org>2008-02-09 12:32:57 +0000
commit1d5b2149021585fb5d44cd2b587f95c723ea25a0 (patch)
tree60d4a1fd18651f3c6048517c01ea47513c3ed4f6 /lisp
parent274ec34ba75f27858c1fe0f125493b3bb40bf42a (diff)
downloademacs-1d5b2149021585fb5d44cd2b587f95c723ea25a0.tar.gz
emacs-1d5b2149021585fb5d44cd2b587f95c723ea25a0.tar.bz2
emacs-1d5b2149021585fb5d44cd2b587f95c723ea25a0.zip
Make vc-diff-internal messages consistent across many cases.
(vc-exec-after): Append CODE to previous fragments. (vc-diff-finish): Take BUFFER directly, not BUFFER-NAME; take MESSAGES instead of VERBOSE; use it when non-nil. (vc-diff-internal): Compute messages once; use them; update call to vc-diff-finish.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/vc.el44
2 files changed, 35 insertions, 17 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 245ea7b3f07..ff0dea0aa38 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
+2008-02-09 Thien-Thi Nguyen <ttn@gnuvola.org>
+
+ * vc.el (vc-exec-after): Append CODE to previous fragments.
+ (vc-diff-finish): Take BUFFER directly, not BUFFER-NAME;
+ take MESSAGES instead of VERBOSE; use it when non-nil.
+ (vc-diff-internal): Compute messages once; use them;
+ update call to vc-diff-finish.
+
2008-02-09 Michael Olson <mwolson@gnu.org>
* net/tramp.el (tramp-process-sentinel): Avoid error when process
diff --git a/lisp/vc.el b/lisp/vc.el
index f2a044f8ce6..e1e61171108 100644
--- a/lisp/vc.el
+++ b/lisp/vc.el
@@ -1051,7 +1051,11 @@ Else, add CODE to the process' sentinel."
(process-put proc 'vc-previous-sentinel previous))
(set-process-sentinel proc 'vc-process-sentinel))
(process-put proc 'vc-sentinel-commands
- (cons code (process-get proc 'vc-sentinel-commands))))
+ ;; We keep the code fragments in the order given
+ ;; so that vc-diff-finish's message shows up in
+ ;; the presence of non-nil vc-command-messages.
+ (append (process-get proc 'vc-sentinel-commands)
+ (list code))))
(t (error "Unexpected process state"))))
nil)
@@ -1991,19 +1995,22 @@ the buffer contents as a comment."
(defmacro vc-diff-switches-list (backend) `(vc-switches ',backend 'diff))
(make-obsolete 'vc-diff-switches-list 'vc-switches "22.1")
-(defun vc-diff-finish (buffer-name verbose)
+(defun vc-diff-finish (buffer messages)
;; The empty sync output case has already been handled, so the only
;; possibility of an empty output is for an async process.
- (when (buffer-live-p buffer-name)
- (with-current-buffer (get-buffer buffer-name)
- (and verbose
- (zerop (buffer-size))
- (let ((inhibit-read-only t))
- (insert "No differences found.\n")))
- (goto-char (point-min))
- (let ((window (get-buffer-window (current-buffer) t)))
+ (when (buffer-live-p buffer)
+ (let ((window (get-buffer-window buffer t))
+ (emptyp (zerop (buffer-size buffer))))
+ (with-current-buffer buffer
+ (and messages emptyp
+ (let ((inhibit-read-only t))
+ (insert (cdr messages) ".\n")
+ (message "%s" (cdr messages))))
+ (goto-char (point-min))
(when window
- (shrink-window-if-larger-than-buffer window))))))
+ (shrink-window-if-larger-than-buffer window)))
+ (when (and messages (not emptyp))
+ (message "%sdone" (car messages))))))
(defvar vc-diff-added-files nil
"If non-nil, diff added files by comparing them to /dev/null.")
@@ -2012,16 +2019,18 @@ the buffer contents as a comment."
"Report diffs between two revisions of a fileset.
Diff output goes to the *vc-diff* buffer. The function
returns t if the buffer had changes, nil otherwise."
- (let* ((filenames (vc-delistify files))
- (rev1-name (or rev1 "working revision"))
- (rev2-name (or rev2 "workfile"))
+ (let* ((messages (cons (format "Finding changes in %s..."
+ (vc-delistify files))
+ (format "No changes between %s and %s"
+ (or rev1 "working revision")
+ (or rev2 "workfile"))))
;; Set coding system based on the first file. It's a kluge,
;; but the only way to set it for each file included would
;; be to call the back end separately for each file.
(coding-system-for-read
(if files (vc-coding-system-for-diff (car files)) 'undecided)))
(vc-setup-buffer "*vc-diff*")
- (message "Finding changes in %s..." filenames)
+ (message "%s" (car messages))
;; Many backends don't handle well the case of a file that has been
;; added but not yet committed to the repo (notably CVS and Subversion).
;; Do that work here so the backends don't have to futz with it. --ESR
@@ -2055,14 +2064,15 @@ returns t if the buffer had changes, nil otherwise."
(not (get-buffer-process (current-buffer))))
;; Treat this case specially so as not to pop the buffer.
(progn
- (message "No changes between %s and %s" rev1-name rev2-name)
+ (message "%s" (cdr messages))
nil)
(diff-mode)
;; Make the *vc-diff* buffer read only, the diff-mode key
;; bindings are nicer for read only buffers. pcl-cvs does the
;; same thing.
(setq buffer-read-only t)
- (vc-exec-after `(vc-diff-finish ,(buffer-name) ,verbose))
+ (vc-exec-after `(vc-diff-finish ,(current-buffer) ',(when verbose
+ messages)))
;; Display the buffer, but at the end because it can change point.
(pop-to-buffer (current-buffer))
;; In the async case, we return t even if there are no differences