]> git.eshelyaron.com Git - emacs.git/commitdiff
vc-start-logentry: Use current buffer as parent buffer more often
authorSean Whitton <spwhitton@spwhitton.name>
Thu, 17 Oct 2024 12:57:07 +0000 (20:57 +0800)
committerEshel Yaron <me@eshelyaron.com>
Thu, 17 Oct 2024 18:51:39 +0000 (20:51 +0200)
* 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

index 998cef649ff2ac800b2b7b67b1dcd70b73c8be9c..892e4df9a6ca415b5625d8c43d5be94189fbb7f4 100644 (file)
@@ -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)))