master fcbff4df7a6 2/2: Inline vc-dir-next-line after marking or unmarking

Sean Whitton <[email protected]> Mon, 29 Jun 2026 06:26:45 -0400 (EDT)
Newsgroups gmane.emacs.diffs
Message-ID <[email protected]>
branch: master
commit fcbff4df7a6313fb9ce377ec68377699c5f70ad7
Author: Sean Whitton <[email protected]>
Commit: Sean Whitton <[email protected]>

    Inline vc-dir-next-line after marking or unmarking
    
    This fixes where point goes after using a marking or unmarking
    command with point before the "./" entry.
    
    * lisp/vc/vc-dir.el (vc-dir-mark-unmark, vc-dir-mark-file)
    (vc-dir-unmark-file): Inline the relevant part of
    vc-dir-next-line to skip the 'vc-dir--before-dotname-p'
    conditional.
---
 lisp/vc/vc-dir.el | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el
index 84872914bb5..b019f46d1f8 100644
--- a/lisp/vc/vc-dir.el
+++ b/lisp/vc/vc-dir.el
@@ -804,7 +804,8 @@ With prefix argument ARG, move that many lines."
 	      ;; `vc-dir-mark-file' signals an error if we try marking
 	      ;; a directory containing marked files in its tree, or a
 	      ;; file in a marked directory tree.  Just continue.
-	      (error (vc-dir-next-line 1))))))
+	      (error (ewoc-goto-next vc-ewoc 1)
+                     (vc-dir-move-to-goal-column))))))
     (funcall mark-unmark-function)))
 
 (defun vc-dir--parent (arg &optional if-marked)
@@ -884,7 +885,8 @@ Replace marks on subitems with marking `%s' itself?"
     (setf (vc-dir-fileinfo->marked file) t)
     (apply #'ewoc-invalidate vc-ewoc to-inval)
     (unless (or arg (mouse-event-p last-command-event))
-      (vc-dir-next-line 1))))
+      (ewoc-goto-next vc-ewoc 1)
+      (vc-dir-move-to-goal-column))))
 
 (defun vc-dir-mark ()
   "Mark the current file or all files in the region.
@@ -1053,7 +1055,8 @@ Replace mark on `%s' with marks on all subitems but this one?"
     (when to-inval
       (apply #'ewoc-invalidate vc-ewoc to-inval))
     (unless (mouse-event-p last-command-event)
-      (vc-dir-next-line 1))))
+      (ewoc-goto-next vc-ewoc 1)
+      (vc-dir-move-to-goal-column))))
 
 (defun vc-dir-unmark ()
   "Unmark the current file or all files in the region.