From faa530c100f05ca526106dd1a1cad7b4f38d5630 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Thu, 17 Oct 2024 20:57:07 +0800 Subject: [PATCH] vc-start-logentry: Use current buffer as parent buffer more often * lisp/vc/vc-dispatcher.el (vc-start-logentry): When determining the parent buffer, if get-file-buffer returns nil, use the current buffer. Also, if the first file is a directory, don't try to call get-file-buffer, just use the current buffer. (cherry picked from commit 475a33adb9134990fa05be8a6308216f12ed4ef7) --- lisp/vc/vc-dispatcher.el | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el index 998cef649ff..892e4df9a6c 100644 --- a/lisp/vc/vc-dispatcher.el +++ b/lisp/vc/vc-dispatcher.el @@ -741,14 +741,11 @@ MODE, defaulting to `log-edit-mode' if MODE is nil. AFTER-HOOK specifies the local value for `vc-log-after-operation-hook'. BACKEND, if non-nil, specifies a VC backend for the Log Edit buffer. PATCH-STRING is a patch to check in." - (let ((parent - (if (vc-dispatcher-browsing) - ;; If we are called from a directory browser, the parent buffer is - ;; the current buffer. - (current-buffer) - (if (and files (equal (length files) 1)) - (get-file-buffer (car files)) - (current-buffer))))) + (let ((parent (or (and (not (vc-dispatcher-browsing)) + (length= files 1) + (not (file-directory-p (car files))) + (get-file-buffer (car files))) + (current-buffer)))) (if (and comment (not initial-contents)) (set-buffer (get-buffer-create logbuf)) (pop-to-buffer (get-buffer-create logbuf))) -- 2.39.5