aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 @@
12008-02-09 Thien-Thi Nguyen <ttn@gnuvola.org>
2
3 * vc.el (vc-exec-after): Append CODE to previous fragments.
4 (vc-diff-finish): Take BUFFER directly, not BUFFER-NAME;
5 take MESSAGES instead of VERBOSE; use it when non-nil.
6 (vc-diff-internal): Compute messages once; use them;
7 update call to vc-diff-finish.
8
12008-02-09 Michael Olson <mwolson@gnu.org> 92008-02-09 Michael Olson <mwolson@gnu.org>
2 10
3 * net/tramp.el (tramp-process-sentinel): Avoid error when process 11 * 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."
1051 (process-put proc 'vc-previous-sentinel previous)) 1051 (process-put proc 'vc-previous-sentinel previous))
1052 (set-process-sentinel proc 'vc-process-sentinel)) 1052 (set-process-sentinel proc 'vc-process-sentinel))
1053 (process-put proc 'vc-sentinel-commands 1053 (process-put proc 'vc-sentinel-commands
1054 (cons code (process-get proc 'vc-sentinel-commands)))) 1054 ;; We keep the code fragments in the order given
1055 ;; so that vc-diff-finish's message shows up in
1056 ;; the presence of non-nil vc-command-messages.
1057 (append (process-get proc 'vc-sentinel-commands)
1058 (list code))))
1055 (t (error "Unexpected process state")))) 1059 (t (error "Unexpected process state"))))
1056 nil) 1060 nil)
1057 1061
@@ -1991,19 +1995,22 @@ the buffer contents as a comment."
1991(defmacro vc-diff-switches-list (backend) `(vc-switches ',backend 'diff)) 1995(defmacro vc-diff-switches-list (backend) `(vc-switches ',backend 'diff))
1992(make-obsolete 'vc-diff-switches-list 'vc-switches "22.1") 1996(make-obsolete 'vc-diff-switches-list 'vc-switches "22.1")
1993 1997
1994(defun vc-diff-finish (buffer-name verbose) 1998(defun vc-diff-finish (buffer messages)
1995 ;; The empty sync output case has already been handled, so the only 1999 ;; The empty sync output case has already been handled, so the only
1996 ;; possibility of an empty output is for an async process. 2000 ;; possibility of an empty output is for an async process.
1997 (when (buffer-live-p buffer-name) 2001 (when (buffer-live-p buffer)
1998 (with-current-buffer (get-buffer buffer-name) 2002 (let ((window (get-buffer-window buffer t))
1999 (and verbose 2003 (emptyp (zerop (buffer-size buffer))))
2000 (zerop (buffer-size)) 2004 (with-current-buffer buffer
2001 (let ((inhibit-read-only t)) 2005 (and messages emptyp
2002 (insert "No differences found.\n"))) 2006 (let ((inhibit-read-only t))
2003 (goto-char (point-min)) 2007 (insert (cdr messages) ".\n")
2004 (let ((window (get-buffer-window (current-buffer) t))) 2008 (message "%s" (cdr messages))))
2009 (goto-char (point-min))
2005 (when window 2010 (when window
2006 (shrink-window-if-larger-than-buffer window)))))) 2011 (shrink-window-if-larger-than-buffer window)))
2012 (when (and messages (not emptyp))
2013 (message "%sdone" (car messages))))))
2007 2014
2008(defvar vc-diff-added-files nil 2015(defvar vc-diff-added-files nil
2009 "If non-nil, diff added files by comparing them to /dev/null.") 2016 "If non-nil, diff added files by comparing them to /dev/null.")
@@ -2012,16 +2019,18 @@ the buffer contents as a comment."
2012 "Report diffs between two revisions of a fileset. 2019 "Report diffs between two revisions of a fileset.
2013Diff output goes to the *vc-diff* buffer. The function 2020Diff output goes to the *vc-diff* buffer. The function
2014returns t if the buffer had changes, nil otherwise." 2021returns t if the buffer had changes, nil otherwise."
2015 (let* ((filenames (vc-delistify files)) 2022 (let* ((messages (cons (format "Finding changes in %s..."
2016 (rev1-name (or rev1 "working revision")) 2023 (vc-delistify files))
2017 (rev2-name (or rev2 "workfile")) 2024 (format "No changes between %s and %s"
2025 (or rev1 "working revision")
2026 (or rev2 "workfile"))))
2018 ;; Set coding system based on the first file. It's a kluge, 2027 ;; Set coding system based on the first file. It's a kluge,
2019 ;; but the only way to set it for each file included would 2028 ;; but the only way to set it for each file included would
2020 ;; be to call the back end separately for each file. 2029 ;; be to call the back end separately for each file.
2021 (coding-system-for-read 2030 (coding-system-for-read
2022 (if files (vc-coding-system-for-diff (car files)) 'undecided))) 2031 (if files (vc-coding-system-for-diff (car files)) 'undecided)))
2023 (vc-setup-buffer "*vc-diff*") 2032 (vc-setup-buffer "*vc-diff*")
2024 (message "Finding changes in %s..." filenames) 2033 (message "%s" (car messages))
2025 ;; Many backends don't handle well the case of a file that has been 2034 ;; Many backends don't handle well the case of a file that has been
2026 ;; added but not yet committed to the repo (notably CVS and Subversion). 2035 ;; added but not yet committed to the repo (notably CVS and Subversion).
2027 ;; Do that work here so the backends don't have to futz with it. --ESR 2036 ;; 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."
2055 (not (get-buffer-process (current-buffer)))) 2064 (not (get-buffer-process (current-buffer))))
2056 ;; Treat this case specially so as not to pop the buffer. 2065 ;; Treat this case specially so as not to pop the buffer.
2057 (progn 2066 (progn
2058 (message "No changes between %s and %s" rev1-name rev2-name) 2067 (message "%s" (cdr messages))
2059 nil) 2068 nil)
2060 (diff-mode) 2069 (diff-mode)
2061 ;; Make the *vc-diff* buffer read only, the diff-mode key 2070 ;; Make the *vc-diff* buffer read only, the diff-mode key
2062 ;; bindings are nicer for read only buffers. pcl-cvs does the 2071 ;; bindings are nicer for read only buffers. pcl-cvs does the
2063 ;; same thing. 2072 ;; same thing.
2064 (setq buffer-read-only t) 2073 (setq buffer-read-only t)
2065 (vc-exec-after `(vc-diff-finish ,(buffer-name) ,verbose)) 2074 (vc-exec-after `(vc-diff-finish ,(current-buffer) ',(when verbose
2075 messages)))
2066 ;; Display the buffer, but at the end because it can change point. 2076 ;; Display the buffer, but at the end because it can change point.
2067 (pop-to-buffer (current-buffer)) 2077 (pop-to-buffer (current-buffer))
2068 ;; In the async case, we return t even if there are no differences 2078 ;; In the async case, we return t even if there are no differences