From 400aec1ab339358c557ad754ad15249bb3221ea4 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 15 May 2008 15:01:29 +0000 Subject: [PATCH] More elimination of buffer name dependencies. --- lisp/vc-dispatcher.el | 28 ++++++++++++++-------------- lisp/vc.el | 3 +++ 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/lisp/vc-dispatcher.el b/lisp/vc-dispatcher.el index e117622b7af..dc7c675cf54 100644 --- a/lisp/vc-dispatcher.el +++ b/lisp/vc-dispatcher.el @@ -135,7 +135,7 @@ dispatcher client mode imposes itself." :group 'vc) (defcustom vc-delete-logbuf-window t - "If non-nil, delete the *VC-log* buffer and window after each logical action. + "If non-nil, delete the log buffer and window after each logical action. If nil, bury that buffer instead. This is most useful if you have multiple windows on a frame and would like to preserve the setting." @@ -533,9 +533,9 @@ NOT-URGENT means it is ok to continue if the user says not to save." (set-buffer-modified-p nil) (setq buffer-file-name nil)) -(defun vc-start-logentry (files extra comment initial-contents msg action &optional after-hook) +(defun vc-start-logentry (files extra comment initial-contents msg logbuf action &optional after-hook) "Accept a comment for an operation on FILES with extra data EXTRA. -If COMMENT is nil, pop up a VC-log buffer, emit MSG, and set the +If COMMENT is nil, pop up a LOGBUF buffer, emit MSG, and set the action on close to ACTION. If COMMENT is a string and INITIAL-CONTENTS is non-nil, then COMMENT is used as the initial contents of the log entry buffer. If COMMENT is a string and @@ -553,8 +553,8 @@ for `vc-log-after-operation-hook'." (get-file-buffer (car files)) (current-buffer))))) (if (and comment (not initial-contents)) - (set-buffer (get-buffer-create "*VC-log*")) - (pop-to-buffer (get-buffer-create "*VC-log*"))) + (set-buffer (get-buffer-create logbuf)) + (pop-to-buffer (get-buffer-create logbuf))) (set (make-local-variable 'vc-parent-buffer) parent) (set (make-local-variable 'vc-parent-buffer-name) (concat " from " (buffer-name vc-parent-buffer))) @@ -587,7 +587,8 @@ the buffer contents as a comment." (unless vc-log-operation (error "No log operation is pending")) ;; save the parameters held in buffer-local variables - (let ((log-operation vc-log-operation) + (let ((logbuf (current-buffer)) + (log-operation vc-log-operation) (log-fileset vc-log-fileset) (log-extra vc-log-extra) (log-entry (buffer-string)) @@ -603,14 +604,13 @@ the buffer contents as a comment." ;; Remove checkin window (after the checkin so that if that fails ;; we don't zap the *VC-log* buffer and the typing therein). ;; -- IMO this should be replaced with quit-window - (let ((logbuf (get-buffer "*VC-log*"))) - (cond ((and logbuf vc-delete-logbuf-window) - (delete-windows-on logbuf (selected-frame)) - ;; Kill buffer and delete any other dedicated windows/frames. - (kill-buffer logbuf)) - (logbuf (pop-to-buffer "*VC-log*") - (bury-buffer) - (pop-to-buffer tmp-vc-parent-buffer)))) + (cond ((and logbuf vc-delete-logbuf-window) + (delete-windows-on logbuf (selected-frame)) + ;; Kill buffer and delete any other dedicated windows/frames. + (kill-buffer logbuf)) + (logbuf (pop-to-buffer logbuf) + (bury-buffer) + (pop-to-buffer tmp-vc-parent-buffer))) ;; Now make sure we see the expanded headers (when log-fileset (mapc diff --git a/lisp/vc.el b/lisp/vc.el index 90d2bde0df2..7f355a6c38a 100644 --- a/lisp/vc.el +++ b/lisp/vc.el @@ -1286,6 +1286,7 @@ first backend that could register the file is used." (or comment (not vc-initial-comment)) nil "Enter initial comment." + "*VC-log*" (lambda (files rev comment) (dolist (file files) (message "Registering %s... " file) @@ -1388,6 +1389,7 @@ Runs the normal hooks `vc-before-checkin-hook' and `vc-checkin-hook'." (vc-start-logentry files rev comment initial-contents "Enter a change comment." + "*VC-log*" (lambda (files rev comment) (message "Checking in %s..." (vc-delistify files)) ;; "This log message intentionally left almost blank". @@ -1728,6 +1730,7 @@ The headers are reset to their non-expanded form." (vc-start-logentry files rev oldcomment t "Enter a replacement change comment." + "*VC-log*" (lambda (files rev comment) (vc-call-backend ;; Less of a kluge than it looks like; log-view mode only passes -- 2.39.2