* bug#43188: 28.0.50; [PATCH] Don't move point in vc-dir on vc-register/vc-checkin
@ 2020-09-03 19:22 Andrii Kolomoiets
2020-09-04 21:18 ` Dmitry Gutov
0 siblings, 1 reply; 2+ messages in thread
From: Andrii Kolomoiets @ 2020-09-03 19:22 UTC (permalink / raw)
To: 43188
[-- Attachment #1: Type: text/plain, Size: 638 bytes --]
Severity: minor
Proposed patch aimed to fix following point movements in vc-dir:
1. Create git repo: mkdir gittest && cd gittest && git init && touch foo.txt
2. Open vc-dir for that repo in Emacs (C-x v d). Point is 1.
3. Run vc-next-action (v).
Point is moved to 26.
4. revert-buffer (g) to move point to 1.
5. Run vc-next-action (v). Enter commit message and C-c C-c.
Point is moved to 26 again.
6. Create another file in the repo: touch bar.txt
7. In vc-dir move to the last file: g n n
8. revert-buffer (g)
Point is moved to the beginning of the line.
9. revert-buffer (g)
Point is moved to the previous line.
Thanks!
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Don-t-move-point-in-vc-dir-on-vc-register-vc-checkin.patch --]
[-- Type: text/x-patch, Size: 2915 bytes --]
From f162b1f6629bf1faafe0b28c6ea9df458fee1af8 Mon Sep 17 00:00:00 2001
From: Andrii Kolomoiets <andreyk.mad@gmail.com>
Date: Thu, 3 Sep 2020 22:13:36 +0300
Subject: [PATCH] Don't move point in vc-dir on vc-register/vc-checkin
* lisp/vc/vc-dir.el (vc-dir-update): Save and restore point on
'ewoc-invalidate'.
* lisp/vc/vc-dispatcher.el (vc-finish-logentry): Don't call
'vc-dir-move-to-goal-column'.
* lisp/vc/vc.el (vc-register): Don't call 'vc-dir-move-to-goal-column'.
---
lisp/vc/vc-dir.el | 6 +++++-
lisp/vc/vc-dispatcher.el | 3 ---
lisp/vc/vc.el | 4 ----
3 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el
index cdf8ab984e..6c219005ce 100644
--- a/lisp/vc/vc-dir.el
+++ b/lisp/vc/vc-dir.el
@@ -451,7 +451,11 @@ vc-dir-update
(setf (vc-dir-fileinfo->state (ewoc-data node)) (nth 1 entry))
(setf (vc-dir-fileinfo->extra (ewoc-data node)) (nth 2 entry))
(setf (vc-dir-fileinfo->needs-update (ewoc-data node)) nil)
- (ewoc-invalidate vc-ewoc node))
+ ;; `ewoc-invalidate' will kill line and insert new text,
+ ;; let's keep point column.
+ (let ((p (point)))
+ (ewoc-invalidate vc-ewoc node)
+ (goto-char p)))
;; If the state is nil, the file does not exist
;; anymore, so remember the entry so we can remove
;; it after we are done inserting all ENTRIES.
diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el
index 4a04c9365a..99bf5bf9b6 100644
--- a/lisp/vc/vc-dispatcher.el
+++ b/lisp/vc/vc-dispatcher.el
@@ -691,7 +691,6 @@ vc-start-logentry
(message "%s Type C-c C-c when done" msg)
(vc-finish-logentry (eq comment t)))))
-(declare-function vc-dir-move-to-goal-column "vc-dir" ())
;; vc-finish-logentry is typically called from a log-edit buffer (see
;; vc-start-logentry).
(defun vc-finish-logentry (&optional nocomment)
@@ -740,8 +739,6 @@ vc-finish-logentry
(mapc
(lambda (file) (vc-resynch-buffer file t t))
log-fileset))
- (when (vc-dispatcher-browsing)
- (vc-dir-move-to-goal-column))
(run-hooks after-hook 'vc-finish-logentry-hook)))
(defun vc-dispatcher-browsing ()
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 5561292d8c..f0a08044e2 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -1346,8 +1346,6 @@ vc-create-repo
nil t)))))
(vc-call-backend backend 'create-repo))
-(declare-function vc-dir-move-to-goal-column "vc-dir" ())
-
;;;###autoload
(defun vc-register (&optional vc-fileset comment)
"Register into a version control system.
@@ -1398,8 +1396,6 @@ vc-register
(vc-resynch-buffer file t t))
files)
- (when (derived-mode-p 'vc-dir-mode)
- (vc-dir-move-to-goal-column))
(message "Registering %s... done" files)))
(defun vc-register-with (backend)
--
2.15.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* bug#43188: 28.0.50; [PATCH] Don't move point in vc-dir on vc-register/vc-checkin
2020-09-03 19:22 bug#43188: 28.0.50; [PATCH] Don't move point in vc-dir on vc-register/vc-checkin Andrii Kolomoiets
@ 2020-09-04 21:18 ` Dmitry Gutov
0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Gutov @ 2020-09-04 21:18 UTC (permalink / raw)
To: Andrii Kolomoiets, 43188-done
Version 28.1
On 03.09.2020 22:22, Andrii Kolomoiets wrote:
> Severity: minor
>
> Proposed patch aimed to fix following point movements in vc-dir:
>
> 1. Create git repo: mkdir gittest && cd gittest && git init && touch foo.txt
> 2. Open vc-dir for that repo in Emacs (C-x v d). Point is 1.
> 3. Run vc-next-action (v).
> Point is moved to 26.
> 4. revert-buffer (g) to move point to 1.
> 5. Run vc-next-action (v). Enter commit message and C-c C-c.
> Point is moved to 26 again.
> 6. Create another file in the repo: touch bar.txt
> 7. In vc-dir move to the last file: g n n
> 8. revert-buffer (g)
> Point is moved to the beginning of the line.
> 9. revert-buffer (g)
> Point is moved to the previous line.
Looks like am improvement.
Installed, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-04 21:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-03 19:22 bug#43188: 28.0.50; [PATCH] Don't move point in vc-dir on vc-register/vc-checkin Andrii Kolomoiets
2020-09-04 21:18 ` Dmitry Gutov
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).