GNU bug report logs -
#31764
26.1; Point in VC change log is not centered as documented
Previous Next
Reported by: Carlos Pita <carlosjosepita <at> gmail.com>
Date: Fri, 8 Jun 2018 19:25:01 UTC
Severity: normal
Tags: fixed, patch
Merged with 44001
Found in version 26.1
Fixed in version 26.2
Done: Noam Postavsky <npostavs <at> gmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 31764 in the body.
You can then email your comments to 31764 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#31764
; Package
emacs
.
(Fri, 08 Jun 2018 19:25:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Carlos Pita <carlosjosepita <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 08 Jun 2018 19:25:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
The documentation states [1]:
Point is centered at the revision of the file currently being
visited. With a prefix argument, the command prompts for the revision to
center on, and the maximum number of revisions to display.
But I get a log which is sorted from most recent to oldest revision with
the point positioned at the end. This is not only different from the
documented behavior but also very inconvenient since the initial
revision is probably the least interesting one.
I'm testing this in a simple git repository with a few revisions of
one file.
[1] https://www.gnu.org/software/emacs/draft/manual/html_node/emacs/VC-Change-Log.html#VC-Change-Log
---
In GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
of 2018-05-29 built on juergen
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
System Description: Manjaro Linux
Recent messages:
previous-line: Beginning of buffer [19 times]
Checking out /tmp/repo/x.txt.~c952114056dcaf2a9f3819efca2bcb6d7a9e216f~...done
C-c C-c is undefined
Mark set
Press C-c C-c when you are done editing.
Enter a change comment. Type C-c C-c when done
Checking in /tmp/repo/x.txt...done
Mark set
Quit [3 times]
funcall-interactively: End of buffer
Configured using:
'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
--localstatedir=/var --with-x-toolkit=gtk3 --with-xft --with-modules
'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong
-fno-plt' CPPFLAGS=-D_FORTIFY_SOURCE=2
LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'
Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS
GTK3 X11 MODULES THREADS LIBSYSTEMD LCMS2
Important settings:
value of $LC_MONETARY: en_US.UTF-8
value of $LC_NUMERIC: en_US.UTF-8
value of $LC_TIME: en_US.UTF-8
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix
Major mode: Git-Log-View
Minor modes in effect:
diff-auto-refine-mode: t
pyvenv-mode: t
shell-dirtrack-mode: t
winner-mode: t
show-paren-mode: t
ido-ubiquitous-mode: t
ido-everywhere: t
global-company-mode: t
company-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
buffer-read-only: t
column-number-mode: t
line-number-mode: t
transient-mark-mode: t
Load-path shadows:
None found.
Features:
(misearch multi-isearch vc-svn vc-src vc-sccs vc-rcs vc-mtn vc-hg vc-cvs
vc-bzr log-edit network-stream nsm starttls tls gnutls mailalias
smtpmail pp shadow sort mail-extr emacsbug message rmc puny dired
dired-loaddefs rfc822 mml mml-sec epa derived epg gnus-util rmail
rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils vc-annotate vc-dir ewoc vc-filewise
add-log log-view pcvs-util vc vc-dispatcher vc-git display-line-numbers
server doom-themes-org cl-extra yasnippet elec-pair
highlight-indentation help-fns radix-tree help-mode elpy
find-file-in-project ivy delsel ivy-overlay ffap thingatpt windmove
diff-mode easy-mmode elpy-shell pyvenv esh-var esh-io esh-cmd esh-opt
esh-ext esh-proc esh-arg esh-groups eshell esh-module esh-mode esh-util
elpy-profile elpy-django elpy-refactor subr-x python tramp-sh tramp
tramp-compat tramp-loaddefs trampver ucs-normalize shell pcomplete
parse-time format-spec advice json map grep compile comint ansi-color
files-x company-oddmuse company-keywords company-etags etags xref
project company-gtags company-dabbrev-code company-dabbrev company-files
company-capf company-cmake company-xcode company-clang company-semantic
company-eclim company-template company-css company-nxml company-bbdb
doom-tomorrow-night-theme doom-themes doom-themes-common winner ring
paren ido-completing-read+ memoize s cus-edit wid-edit minibuf-eldef ido
company edmacro kmacro pcase cus-start cus-load finder-inf info package
easymenu epg-config url-handlers url-parse auth-source cl-seq eieio
eieio-core cl-macs eieio-loaddefs password-cache url-vars seq byte-opt
gv bytecomp byte-compile cconv cl-loaddefs cl-lib time-date mule-util
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode
lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)
Memory information:
((conses 16 674816 46739)
(symbols 48 35134 1)
(miscs 40 1465 1041)
(strings 32 86018 1216)
(string-bytes 1 2355400)
(vectors 16 58357)
(vector-slots 8 985368 4204)
(floats 8 236 304)
(intervals 56 1181 137)
(buffers 992 26))
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#31764
; Package
emacs
.
(Fri, 08 Jun 2018 19:39:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 31764 <at> debbugs.gnu.org (full text, mbox):
> From: Carlos Pita <carlosjosepita <at> gmail.com>
> Date: Fri, 08 Jun 2018 16:23:40 -0300
>
> The documentation states [1]:
>
> Point is centered at the revision of the file currently being
> visited. With a prefix argument, the command prompts for the revision to
> center on, and the maximum number of revisions to display.
>
> But I get a log which is sorted from most recent to oldest revision with
> the point positioned at the end. This is not only different from the
> documented behavior but also very inconvenient since the initial
> revision is probably the least interesting one.
I cannot reproduce this. I get the documented behavior.
Do you see that in "emacs -Q"?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#31764
; Package
emacs
.
(Fri, 08 Jun 2018 19:59:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 31764 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Sure. Consider this example:
/tmp:: mkdir test-repo
/tmp:: cd test-repo/
/tmp/test-repo:: git init
Initialized empty Git repository in /tmp/test-repo/.git/
/tmp/test-repo:: echo 1 > test-file
/tmp/test-repo:: git add test-file
/tmp/test-repo:: git commit -am rev1
/tmp/test-repo:master: echo 2 > test-file
/tmp/test-repo:master: git commit -am rev2
/tmp/test-repo:master: echo 3 > test-file
/tmp/test-repo:master: git commit -am rev3
/tmp/test-repo:master: echo 4 > test-file
/tmp/test-repo:master: git commit -am rev4
Now I run `emacs -Q test-file` and type C-x v l and get the window
shown in the attached screenshot.
[Screenshot from 2018-06-08 16-56-37.png (image/png, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#31764
; Package
emacs
.
(Fri, 08 Jun 2018 20:13:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 31764 <at> debbugs.gnu.org (full text, mbox):
> From: Carlos Pita <carlosjosepita <at> gmail.com>
> Date: Fri, 8 Jun 2018 16:57:33 -0300
> Cc: 31764 <at> debbugs.gnu.org
>
> Sure. Consider this example:
>
> /tmp:: mkdir test-repo
> /tmp:: cd test-repo/
> /tmp/test-repo:: git init
> Initialized empty Git repository in /tmp/test-repo/.git/
> /tmp/test-repo:: echo 1 > test-file
> /tmp/test-repo:: git add test-file
> /tmp/test-repo:: git commit -am rev1
> /tmp/test-repo:master: echo 2 > test-file
> /tmp/test-repo:master: git commit -am rev2
> /tmp/test-repo:master: echo 3 > test-file
> /tmp/test-repo:master: git commit -am rev3
> /tmp/test-repo:master: echo 4 > test-file
> /tmp/test-repo:master: git commit -am rev4
>
> Now I run `emacs -Q test-file` and type C-x v l and get the window
> shown in the attached screenshot.
Strange. I just did all of these steps, and I still get the
documented behavior.
What version of Git do you have? (Not that I can explain how that
could matter.)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#31764
; Package
emacs
.
(Fri, 08 Jun 2018 20:16:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 31764 <at> debbugs.gnu.org (full text, mbox):
/tmp/test-repo:master: git --version
git version 2.17.1
/tmp/test-repo:master: cat ~/.gitconfig
[user]
name = memeplex
email = carlosjosepita <at> gmail.com
[credential]
helper = cache --timeout=3600
[pager]
status = true
I'm going to debug this later and see what I find out.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#31764
; Package
emacs
.
(Fri, 08 Jun 2018 21:30:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 31764 <at> debbugs.gnu.org (full text, mbox):
AFAICS what I'm observing is consistent with the docstrings of
vc-print-log and vc-print-log-internal:
vc-print-log
It is bound to C-x v l
...
If WORKING-REVISION is non-nil, leave point at that revision.
...
When called interactively with a prefix argument, prompt for
WORKING-REVISION and LIMIT.
vc-print-log-internal
...
Leave point at WORKING-REVISION, if it is non-nil.
So without a prefix I'm indeed passing a nil working-revision argument
(I checked this with edebug).
Now, when I pass a prefix argument it asks me for a revision (default
is the last one) but it's again unable to set the point at that
revision. The default revision is shown as "last revision" and its
value is nil (so despite the ambiguity in the docstrings, no prefix
arg invocation should go to "last revision" too).
In the call to vc-log-internal-common goto-location-func is nil. This
is the next to last argument which is passed by vc-print-log-internal
with value:
;; When it's nil, point really shouldn't move (bug#15322).
(when working-revision
(lambda (bk)
(vc-call-backend bk 'show-log-entry working-revision)))
So it's no surprise the point is not being moved around at all. But
the comment is not right: nil is "last revision". Now, #15322 is a
very old bug so maybe the representation of the "last revision"
changed since then?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#31764
; Package
emacs
.
(Fri, 08 Jun 2018 21:49:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 31764 <at> debbugs.gnu.org (full text, mbox):
One could say that the right fix there is to bind C-x v l to a call
that explicitly pass the revision for the current file. But then it's
also necessary to modify the default value for the prefix case, since
it's reading the default as nil.
I'm curious about how is this working for you. Maybe it was fixed
since 26.1 release.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#31764
; Package
emacs
.
(Fri, 08 Jun 2018 22:12:02 GMT)
Full text and
rfc822 format available.
Message #26 received at 31764 <at> debbugs.gnu.org (full text, mbox):
As a workaround I installed this advice:
(advice-add 'vc-print-log
:filter-args (lambda (args)
(cons (or (car args)
(vc-working-revision (buffer-file-name)))
(cdr args))))
The default that it sets feels like the right fix (so that nil could
mean "don't move") to me but I'm not sure.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#31764
; Package
emacs
.
(Sat, 09 Jun 2018 00:30:02 GMT)
Full text and
rfc822 format available.
Message #29 received at 31764 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
>> From: Carlos Pita <carlosjosepita <at> gmail.com>
>> Date: Fri, 8 Jun 2018 16:57:33 -0300
>> Cc: 31764 <at> debbugs.gnu.org
>> Now I run `emacs -Q test-file` and type C-x v l and get the window
>> shown in the attached screenshot.
>
> Strange. I just did all of these steps, and I still get the
> documented behavior.
>
> What version of Git do you have? (Not that I can explain how that
> could matter.)
I can reproduce this on GNU/Linux, but not on Windows (both tested with
latest emacs-26).
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#31764
; Package
emacs
.
(Sat, 09 Jun 2018 00:59:01 GMT)
Full text and
rfc822 format available.
Message #32 received at 31764 <at> debbugs.gnu.org (full text, mbox):
I can confirm that the same happens with the latest from master.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#31764
; Package
emacs
.
(Sat, 09 Jun 2018 06:47:01 GMT)
Full text and
rfc822 format available.
Message #35 received at 31764 <at> debbugs.gnu.org (full text, mbox):
> From: Noam Postavsky <npostavs <at> gmail.com>
> Cc: Carlos Pita <carlosjosepita <at> gmail.com>, 31764 <at> debbugs.gnu.org
> Date: Fri, 08 Jun 2018 20:29:42 -0400
>
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
> >> From: Carlos Pita <carlosjosepita <at> gmail.com>
> >> Date: Fri, 8 Jun 2018 16:57:33 -0300
> >> Cc: 31764 <at> debbugs.gnu.org
>
> >> Now I run `emacs -Q test-file` and type C-x v l and get the window
> >> shown in the attached screenshot.
> >
> > Strange. I just did all of these steps, and I still get the
> > documented behavior.
> >
> > What version of Git do you have? (Not that I can explain how that
> > could matter.)
>
> I can reproduce this on GNU/Linux, but not on Windows (both tested with
> latest emacs-26).
Isn't that strange? The code involved isn't platform specific.
On a hunch, I suggest to set switch-to-buffer-preserve-window-point to
nil, and see if that makes the problem disappear. If it does, then
the difference between platforms is that one of them changes buffers
in a different sequence.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#31764
; Package
emacs
.
(Sat, 09 Jun 2018 14:19:02 GMT)
Full text and
rfc822 format available.
Message #38 received at 31764 <at> debbugs.gnu.org (full text, mbox):
Sadly it doesn't improve matters, Eli.
Below I'm repeating the conclusions of my debugging session in a more
orderly fashion:
1) `C-x v l` is bound to vc-print-log
2) vc-print-log takes an optional working-revision argument. When
called with a prefix argument, working-revision is prompted for.
3) In both cases (prompted or not) the default value for this argument is nil.
4) vc-print-log calls (vc-print-log-internal backend files
working-revision nil limit)
5) Then vc-print-log-internal calls vc-log-internal-common.
6) This last function takes a goto-location-func argument that the
caller is passing as the result of:
;; When it's nil, point really shouldn't move (bug#15322).
(when working-revision
(lambda (bk)
(vc-call-backend bk 'show-log-entry working-revision)))
that is, nil by default.
7) vc-log-internal-common only moves the point when goto-location-func
is not nil:
(when goto-location-func
(funcall goto-location-func backend)
(setq vc-sentinel-movepoint (point)))
So I'm really failing to see how this could work at all.
Besides, there is the point that this advice, that changes the nil
default for the working version of the current buffer, makes it work
as documented:
(advice-add 'vc-print-log
:filter-args (lambda (args)
(cons (or (car args)
(and (buffer-file-name)
(vc-working-revision (buffer-file-name))))
(cdr args))))
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#31764
; Package
emacs
.
(Tue, 12 Jun 2018 00:11:01 GMT)
Full text and
rfc822 format available.
Message #41 received at 31764 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
tags 31764 + patch
quit
Eli Zaretskii <eliz <at> gnu.org> writes:
>> I can reproduce this on GNU/Linux, but not on Windows (both tested with
>> latest emacs-26).
>
> Isn't that strange? The code involved isn't platform specific.
Looks like a matter of timing, if I add a (sit-for 1) to beginning of
vc-exec-after (or use edebug), then I can reproduce on Windows too.
Adding a save-excursion seems to fix it.
[v1-0001-Keep-vc-print-log-from-putting-point-at-buffer-en.patch (text/x-diff, inline)]
From 895d29eb6b010093245a67d7f05808d765195b7a Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> gmail.com>
Date: Mon, 11 Jun 2018 20:00:54 -0400
Subject: [PATCH v1] Keep vc-print-log from putting point at buffer end
(Bug#31764)
* lisp/vc/vc.el (vc-print-log-internal): Use `save-excursion' around
`vc-print-log-setup-buttons'.
---
lisp/vc/vc.el | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 93e9c25cbf..41a76e0007 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -2256,8 +2256,9 @@ vc-print-log-internal
(vc-call-backend bk 'print-log files-arg buf shortlog
(when is-start-revision working-revision) limit))
(lambda (_bk _files-arg ret)
- (vc-print-log-setup-buttons working-revision
- is-start-revision limit ret))
+ (save-excursion
+ (vc-print-log-setup-buttons working-revision
+ is-start-revision limit ret)))
;; When it's nil, point really shouldn't move (bug#15322).
(when working-revision
(lambda (bk)
--
2.11.0
Added tag(s) patch.
Request was from
Noam Postavsky <npostavs <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Tue, 12 Jun 2018 00:11:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#31764
; Package
emacs
.
(Tue, 12 Jun 2018 02:33:03 GMT)
Full text and
rfc822 format available.
Message #46 received at 31764 <at> debbugs.gnu.org (full text, mbox):
> From: Noam Postavsky <npostavs <at> gmail.com>
> Cc: carlosjosepita <at> gmail.com, 31764 <at> debbugs.gnu.org
> Date: Mon, 11 Jun 2018 20:10:17 -0400
>
> Looks like a matter of timing, if I add a (sit-for 1) to beginning of
> vc-exec-after (or use edebug), then I can reproduce on Windows too.
> Adding a save-excursion seems to fix it.
Then please push to the emacs-26 branch, and thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#31764
; Package
emacs
.
(Thu, 14 Jun 2018 23:21:01 GMT)
Full text and
rfc822 format available.
Message #49 received at 31764 <at> debbugs.gnu.org (full text, mbox):
tags 31764 fixed
close 31764 26.2
quit
Eli Zaretskii <eliz <at> gnu.org> writes:
>> Adding a save-excursion seems to fix it.
> Then please push to the emacs-26 branch, and thanks.
Done.
[1: fcd66d059c]: 2018-06-14 19:17:20 -0400
Keep vc-print-log from putting point at buffer end (Bug#31764)
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=fcd66d059cffbcfff8325304c2c100b64d28ae29
Added tag(s) fixed.
Request was from
Noam Postavsky <npostavs <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Thu, 14 Jun 2018 23:21:02 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 26.2, send any further explanations to
31764 <at> debbugs.gnu.org and Carlos Pita <carlosjosepita <at> gmail.com>
Request was from
Noam Postavsky <npostavs <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Thu, 14 Jun 2018 23:21:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 13 Jul 2018 11:24:05 GMT)
Full text and
rfc822 format available.
bug unarchived.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Wed, 21 Oct 2020 18:49:02 GMT)
Full text and
rfc822 format available.
Forcibly Merged 31764 44001.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Wed, 21 Oct 2020 18:49:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 19 Nov 2020 12:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 3 years and 158 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.