unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#15322: VC log buffer scrolls itself
@ 2013-09-10 13:24 Paul Pogonyshev
  2013-09-10 15:57 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 25+ messages in thread
From: Paul Pogonyshev @ 2013-09-10 13:24 UTC (permalink / raw)
  To: 15322

[-- Attachment #1: Type: text/plain, Size: 632 bytes --]

To reproduce (this assumes a large project for which log is generated for
5+ seconds):

- 'C-x v d' a project directory;
- hit 'l' to view log of changes;
- visible (top) part of the buffer is filled with the most recent entries,
which you are most likely interested in;
- wait till log buffer is filled;
- observe the log buffer point jump to some arbitrary (or at least I have
no idea what it is) revision's entry.

This behavior is certainly not wanted for me. Even assuming the entry it
jumps to has some special meaning and not chosen randomly, 99% of time I'm
interested in the recent changes, not a change 2 years ago.

Paul

[-- Attachment #2: Type: text/html, Size: 795 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15322: VC log buffer scrolls itself
  2013-09-10 13:24 bug#15322: VC log buffer scrolls itself Paul Pogonyshev
@ 2013-09-10 15:57 ` Eli Zaretskii
  2013-09-10 16:04 ` Glenn Morris
  2014-11-19 21:19 ` Richard Copley
  2 siblings, 0 replies; 25+ messages in thread
From: Eli Zaretskii @ 2013-09-10 15:57 UTC (permalink / raw)
  To: Paul Pogonyshev; +Cc: 15322

> Date: Tue, 10 Sep 2013 15:24:52 +0200
> From: Paul Pogonyshev <pogonyshev@gmail.com>
> 
> To reproduce (this assumes a large project for which log is generated for
> 5+ seconds):
> 
> - 'C-x v d' a project directory;
> - hit 'l' to view log of changes;
> - visible (top) part of the buffer is filled with the most recent entries,
> which you are most likely interested in;
> - wait till log buffer is filled;
> - observe the log buffer point jump to some arbitrary (or at least I have
> no idea what it is) revision's entry.

With what back-ends, and which Emacs version?

FWIW, with either the current trunk or v24.3 I don't see this when the
VCS is bzr or git.





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15322: VC log buffer scrolls itself
  2013-09-10 13:24 bug#15322: VC log buffer scrolls itself Paul Pogonyshev
  2013-09-10 15:57 ` Eli Zaretskii
@ 2013-09-10 16:04 ` Glenn Morris
  2013-09-10 18:05   ` Glenn Morris
  2014-11-19 21:19 ` Richard Copley
  2 siblings, 1 reply; 25+ messages in thread
From: Glenn Morris @ 2013-09-10 16:04 UTC (permalink / raw)
  To: Paul Pogonyshev; +Cc: 15322

Paul Pogonyshev wrote:

> To reproduce (this assumes a large project for which log is generated for
> 5+ seconds):
>
> - 'C-x v d' a project directory;
> - hit 'l' to view log of changes;
> - visible (top) part of the buffer is filled with the most recent entries,
> which you are most likely interested in;
> - wait till log buffer is filled;
> - observe the log buffer point jump to some arbitrary (or at least I have
> no idea what it is) revision's entry.

No, I don't observe that. So please say: what version of Emacs this is,
what VCS this is, what file is under point when you hit l, what Emacs
thinks the working revision of that file is.





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15322: VC log buffer scrolls itself
  2013-09-10 16:04 ` Glenn Morris
@ 2013-09-10 18:05   ` Glenn Morris
  2013-09-10 18:30     ` Eli Zaretskii
  2013-09-12  6:26     ` Glenn Morris
  0 siblings, 2 replies; 25+ messages in thread
From: Glenn Morris @ 2013-09-10 18:05 UTC (permalink / raw)
  To: Paul Pogonyshev; +Cc: 15322


I'm going to guess that this happens with svn, and that the revision you
end up on is the working revision of whatever file happens to be listed
last in the output of: svn status -v /path/to/svn/directory

Looks like a bug in vc-svn-parse-status when called with filename ==
directory, caused by the "don't trust the output's filename unless we
have to" part.





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15322: VC log buffer scrolls itself
  2013-09-10 18:05   ` Glenn Morris
@ 2013-09-10 18:30     ` Eli Zaretskii
  2013-09-11  6:58       ` Paul Pogonyshev
  2013-09-12  6:26     ` Glenn Morris
  1 sibling, 1 reply; 25+ messages in thread
From: Eli Zaretskii @ 2013-09-10 18:30 UTC (permalink / raw)
  To: Glenn Morris; +Cc: pogonyshev, 15322

> From: Glenn Morris <rgm@gnu.org>
> Date: Tue, 10 Sep 2013 14:05:39 -0400
> Cc: 15322@debbugs.gnu.org
> 
> I'm going to guess that this happens with svn, and that the revision you
> end up on is the working revision of whatever file happens to be listed
> last in the output of: svn status -v /path/to/svn/directory

Yep, with svn that's what I see, too.





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15322: VC log buffer scrolls itself
  2013-09-10 18:30     ` Eli Zaretskii
@ 2013-09-11  6:58       ` Paul Pogonyshev
  2013-09-11 13:28         ` Eli Zaretskii
  0 siblings, 1 reply; 25+ messages in thread
From: Paul Pogonyshev @ 2013-09-11  6:58 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 15322

[-- Attachment #1: Type: text/plain, Size: 700 bytes --]

Emacs 24.3.1 (built on 2013-08-07), and yes this happens with svn. However,
even if I open log buffer right from the top of 'C-x v d' buffer (i.e.
nothing is be selected or even "under the point"), the buffer still jumps
to some revision from Dec 2011.

Paul


On 10 September 2013 20:30, Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Glenn Morris <rgm@gnu.org>
> > Date: Tue, 10 Sep 2013 14:05:39 -0400
> > Cc: 15322@debbugs.gnu.org
> >
> > I'm going to guess that this happens with svn, and that the revision you
> > end up on is the working revision of whatever file happens to be listed
> > last in the output of: svn status -v /path/to/svn/directory
>
> Yep, with svn that's what I see, too.
>

[-- Attachment #2: Type: text/html, Size: 1192 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15322: VC log buffer scrolls itself
  2013-09-11  6:58       ` Paul Pogonyshev
@ 2013-09-11 13:28         ` Eli Zaretskii
  0 siblings, 0 replies; 25+ messages in thread
From: Eli Zaretskii @ 2013-09-11 13:28 UTC (permalink / raw)
  To: Paul Pogonyshev; +Cc: 15322

> Date: Wed, 11 Sep 2013 08:58:19 +0200
> From: Paul Pogonyshev <pogonyshev@gmail.com>
> Cc: Glenn Morris <rgm@gnu.org>, 15322@debbugs.gnu.org
> 
> Emacs 24.3.1 (built on 2013-08-07), and yes this happens with svn. However,
> even if I open log buffer right from the top of 'C-x v d' buffer (i.e.
> nothing is be selected or even "under the point"), the buffer still jumps
> to some revision from Dec 2011.

What happens to be under point is not relevant.  What is relevant is
the last revision you actually have in the sandbox.

Anyway, it's a bug, so what exactly does it do (wrongly) is not
interesting.





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15322: VC log buffer scrolls itself
  2013-09-10 18:05   ` Glenn Morris
  2013-09-10 18:30     ` Eli Zaretskii
@ 2013-09-12  6:26     ` Glenn Morris
  2013-09-12  7:25       ` Paul Pogonyshev
  1 sibling, 1 reply; 25+ messages in thread
From: Glenn Morris @ 2013-09-12  6:26 UTC (permalink / raw)
  To: Paul Pogonyshev; +Cc: 15322


I believe I've fixed it so that it goes to the correct revision
according to the logic of vc. In terms of svn status -v output,

              4271     4264 rgm      .

this would be revision 4264.





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15322: VC log buffer scrolls itself
  2013-09-12  6:26     ` Glenn Morris
@ 2013-09-12  7:25       ` Paul Pogonyshev
  2013-09-12 15:57         ` Glenn Morris
  0 siblings, 1 reply; 25+ messages in thread
From: Paul Pogonyshev @ 2013-09-12  7:25 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 15322

[-- Attachment #1: Type: text/plain, Size: 597 bytes --]

Frankly, I'd prefer it to not go anywhere and just leave the buffer alone,
i.e. never scroll it. At least for subversion, which is known for having
"mixed revision" in working directory all the time. Also, this is much like
stealing focus in UI, only in this case it doesn't steal focus but buffer
point position.

Paul


On 12 September 2013 08:26, Glenn Morris <rgm@gnu.org> wrote:

>
> I believe I've fixed it so that it goes to the correct revision
> according to the logic of vc. In terms of svn status -v output,
>
>               4271     4264 rgm      .
>
> this would be revision 4264.
>

[-- Attachment #2: Type: text/html, Size: 967 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15322: VC log buffer scrolls itself
  2013-09-12  7:25       ` Paul Pogonyshev
@ 2013-09-12 15:57         ` Glenn Morris
  2013-09-12 19:09           ` Stefan Monnier
  0 siblings, 1 reply; 25+ messages in thread
From: Glenn Morris @ 2013-09-12 15:57 UTC (permalink / raw)
  To: Paul Pogonyshev; +Cc: 15322

Paul Pogonyshev wrote:

> Frankly, I'd prefer it to not go anywhere and just leave the buffer alone,
> i.e. never scroll it.

I had a feeling you might say that...

> At least for subversion, which is known for having "mixed revision" in
> working directory all the time. Also, this is much like stealing focus
> in UI, only in this case it doesn't steal focus but buffer point
> position.





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15322: VC log buffer scrolls itself
  2013-09-12 15:57         ` Glenn Morris
@ 2013-09-12 19:09           ` Stefan Monnier
  2013-09-12 19:30             ` Glenn Morris
  0 siblings, 1 reply; 25+ messages in thread
From: Stefan Monnier @ 2013-09-12 19:09 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Paul Pogonyshev, 15322

>> Frankly, I'd prefer it to not go anywhere and just leave the buffer alone,
>> i.e. never scroll it.
> I had a feeling you might say that...

And I think that makes sense.  It's natural to select a particular
revision when running vc-print-log from (say) vc-annotate, but for
a plain `C-x v l', the user just wants to see "the log" and presumably
doesn't care about which revision happens to be current.

IOW, I think we're trying too hard here.


        Stefan





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15322: VC log buffer scrolls itself
  2013-09-12 19:09           ` Stefan Monnier
@ 2013-09-12 19:30             ` Glenn Morris
  2013-09-26  7:17               ` Paul Pogonyshev
  0 siblings, 1 reply; 25+ messages in thread
From: Glenn Morris @ 2013-09-12 19:30 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Paul Pogonyshev, 15322

Stefan Monnier wrote:

> And I think that makes sense.  It's natural to select a particular
> revision when running vc-print-log from (say) vc-annotate, but for
> a plain `C-x v l', the user just wants to see "the log" and presumably
> doesn't care about which revision happens to be current.
>
> IOW, I think we're trying too hard here.

*** lisp/vc/vc.el	2013-09-12 06:10:12 +0000
--- lisp/vc/vc.el	2013-09-12 19:28:04 +0000
***************
*** 2299,2305 ****
    (let* ((vc-fileset (vc-deduce-fileset t)) ;FIXME: Why t? --Stef
  	 (backend (car vc-fileset))
  	 (files (cadr vc-fileset))
! 	 (working-revision (or working-revision (vc-working-revision (car files)))))
      (vc-print-log-internal backend files working-revision nil limit)))
  
  ;;;###autoload
--- 2299,2306 ----
    (let* ((vc-fileset (vc-deduce-fileset t)) ;FIXME: Why t? --Stef
  	 (backend (car vc-fileset))
  	 (files (cadr vc-fileset))
! ;;	 (working-revision (or working-revision (vc-working-revision (car files))))
!          )
      (vc-print-log-internal backend files working-revision nil limit)))
  
  ;;;###autoload





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15322: VC log buffer scrolls itself
  2013-09-12 19:30             ` Glenn Morris
@ 2013-09-26  7:17               ` Paul Pogonyshev
  2013-10-24  8:39                 ` Paul Pogonyshev
  0 siblings, 1 reply; 25+ messages in thread
From: Paul Pogonyshev @ 2013-09-26  7:17 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 15322

[-- Attachment #1: Type: text/plain, Size: 1679 bytes --]

In Emacs built from trunk yesterday it still jumps, though to the "correct"
version (the one reported by 'svn info'). However, given that committing
changes from the buffer does not advance the working directory revision
(e.g. what I have now is 26 revisions in the past), I'm not sure how useful
this is, at least for subversion. Probably it's better for saner VCS's, but
for subversion if feels like annoyance.

Paul


On 12 September 2013 21:30, Glenn Morris <rgm@gnu.org> wrote:

> Stefan Monnier wrote:
>
> > And I think that makes sense.  It's natural to select a particular
> > revision when running vc-print-log from (say) vc-annotate, but for
> > a plain `C-x v l', the user just wants to see "the log" and presumably
> > doesn't care about which revision happens to be current.
> >
> > IOW, I think we're trying too hard here.
>
> *** lisp/vc/vc.el       2013-09-12 06:10:12 +0000
> --- lisp/vc/vc.el       2013-09-12 19:28:04 +0000
> ***************
> *** 2299,2305 ****
>     (let* ((vc-fileset (vc-deduce-fileset t)) ;FIXME: Why t? --Stef
>          (backend (car vc-fileset))
>          (files (cadr vc-fileset))
> !        (working-revision (or working-revision (vc-working-revision (car
> files)))))
>       (vc-print-log-internal backend files working-revision nil limit)))
>
>   ;;;###autoload
> --- 2299,2306 ----
>     (let* ((vc-fileset (vc-deduce-fileset t)) ;FIXME: Why t? --Stef
>          (backend (car vc-fileset))
>          (files (cadr vc-fileset))
> ! ;;     (working-revision (or working-revision (vc-working-revision (car
> files))))
> !          )
>       (vc-print-log-internal backend files working-revision nil limit)))
>
>   ;;;###autoload
>

[-- Attachment #2: Type: text/html, Size: 2224 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15322: VC log buffer scrolls itself
  2013-09-26  7:17               ` Paul Pogonyshev
@ 2013-10-24  8:39                 ` Paul Pogonyshev
  2013-10-24  8:49                   ` Andreas Schwab
  0 siblings, 1 reply; 25+ messages in thread
From: Paul Pogonyshev @ 2013-10-24  8:39 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 15322

[-- Attachment #1: Type: text/plain, Size: 2632 bytes --]

Let me explain why I think scrolling is *bad*, even if it scrolls to
correct revision. Log buffer here is generated for 5-10 seconds. In the
meantime, I can start reading it, scrolling manually or C-s contents. And
then (when loading is finished) it scrolls to a different position by
itself. This is no better than focus stealing, because it disrupts my
activities.

I tried adding the following advice, nulling 'working-revision':

    (defadvice vc-print-log-internal (before
disable-scrolling-to-working-revision activate)
      (ad-set-arg 2 nil))

but it helped only so much, because now it always scrolls to the buffer
beginning (for SVN it's still an improvement), even if I already C-s to
some older revision.

Is it possible to disable scrolling completely, even if in a hackish way
through my '.emacs'?

Paul


On 26 September 2013 09:17, Paul Pogonyshev <pogonyshev@gmail.com> wrote:

> In Emacs built from trunk yesterday it still jumps, though to the
> "correct" version (the one reported by 'svn info'). However, given that
> committing changes from the buffer does not advance the working directory
> revision (e.g. what I have now is 26 revisions in the past), I'm not sure
> how useful this is, at least for subversion. Probably it's better for saner
> VCS's, but for subversion if feels like annoyance.
>
> Paul
>
>
> On 12 September 2013 21:30, Glenn Morris <rgm@gnu.org> wrote:
>
>> Stefan Monnier wrote:
>>
>> > And I think that makes sense.  It's natural to select a particular
>> > revision when running vc-print-log from (say) vc-annotate, but for
>> > a plain `C-x v l', the user just wants to see "the log" and presumably
>> > doesn't care about which revision happens to be current.
>> >
>> > IOW, I think we're trying too hard here.
>>
>> *** lisp/vc/vc.el       2013-09-12 06:10:12 +0000
>> --- lisp/vc/vc.el       2013-09-12 19:28:04 +0000
>> ***************
>> *** 2299,2305 ****
>>     (let* ((vc-fileset (vc-deduce-fileset t)) ;FIXME: Why t? --Stef
>>          (backend (car vc-fileset))
>>          (files (cadr vc-fileset))
>> !        (working-revision (or working-revision (vc-working-revision (car
>> files)))))
>>       (vc-print-log-internal backend files working-revision nil limit)))
>>
>>   ;;;###autoload
>> --- 2299,2306 ----
>>     (let* ((vc-fileset (vc-deduce-fileset t)) ;FIXME: Why t? --Stef
>>          (backend (car vc-fileset))
>>          (files (cadr vc-fileset))
>> ! ;;     (working-revision (or working-revision (vc-working-revision (car
>> files))))
>> !          )
>>       (vc-print-log-internal backend files working-revision nil limit)))
>>
>>   ;;;###autoload
>>
>
>

[-- Attachment #2: Type: text/html, Size: 3711 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15322: VC log buffer scrolls itself
  2013-10-24  8:39                 ` Paul Pogonyshev
@ 2013-10-24  8:49                   ` Andreas Schwab
  2013-10-24 14:24                     ` Stefan Monnier
  2015-05-03  3:38                     ` Dmitry Gutov
  0 siblings, 2 replies; 25+ messages in thread
From: Andreas Schwab @ 2013-10-24  8:49 UTC (permalink / raw)
  To: Paul Pogonyshev; +Cc: 15322

IMHO scrolling should only happen if point is still at BOB.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15322: VC log buffer scrolls itself
  2013-10-24  8:49                   ` Andreas Schwab
@ 2013-10-24 14:24                     ` Stefan Monnier
  2014-08-02 16:04                       ` Paul Pogonyshev
  2015-05-03  3:38                     ` Dmitry Gutov
  1 sibling, 1 reply; 25+ messages in thread
From: Stefan Monnier @ 2013-10-24 14:24 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Paul Pogonyshev, 15322

> IMHO scrolling should only happen if point is still at BOB.

FWIW, I agree with Paul that scrolling is just a bad idea here.
It's good to do it when we specifically requested to see the log comment
of a particular revision (e.g. we already have a log displayed and from
vc-annotate we ask for the comment of some revision), but otherwise it's
just a waste of effort that ends up annoying more often than not.


        Stefan





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15322: VC log buffer scrolls itself
  2013-10-24 14:24                     ` Stefan Monnier
@ 2014-08-02 16:04                       ` Paul Pogonyshev
  0 siblings, 0 replies; 25+ messages in thread
From: Paul Pogonyshev @ 2014-08-02 16:04 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Andreas Schwab, 15322

[-- Attachment #1: Type: text/plain, Size: 860 bytes --]

Bumping this bug.

It is very annoying, because our repository grew quite large, so almost all
logs take at least 5-10 seconds to be generated fully and Emacs snatches
point from me when the log generation is complete. Even if it scrolls back
to the top it is still disruptive as I may be reading second page of
history already.

Paul


On 24 October 2013 16:24, Stefan Monnier <monnier@iro.umontreal.ca> wrote:

> > IMHO scrolling should only happen if point is still at BOB.
>
> FWIW, I agree with Paul that scrolling is just a bad idea here.
> It's good to do it when we specifically requested to see the log comment
> of a particular revision (e.g. we already have a log displayed and from
> vc-annotate we ask for the comment of some revision), but otherwise it's
> just a waste of effort that ends up annoying more often than not.
>
>
>         Stefan
>

[-- Attachment #2: Type: text/html, Size: 1316 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15322: VC log buffer scrolls itself
  2013-09-10 13:24 bug#15322: VC log buffer scrolls itself Paul Pogonyshev
  2013-09-10 15:57 ` Eli Zaretskii
  2013-09-10 16:04 ` Glenn Morris
@ 2014-11-19 21:19 ` Richard Copley
  2014-11-19 21:57   ` Richard Copley
  2 siblings, 1 reply; 25+ messages in thread
From: Richard Copley @ 2014-11-19 21:19 UTC (permalink / raw)
  To: 15322

Glenn's change doesn't completely solve the problem, because
`log-view-goto-rev' goes to the beginning of the buffer when REV is
null, and because all the other callers of `vc-log-internal' are also
affected. It would be better to comment out the `goto-location-func'
call in `vc-log-internal'. Having done that, you will find that you
need to comment out the following line as well, or point will move to
the end of the buffer instead.

Note this is a duplicate of bug 6351.





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15322: VC log buffer scrolls itself
  2014-11-19 21:19 ` Richard Copley
@ 2014-11-19 21:57   ` Richard Copley
  2015-05-03  3:32     ` Dmitry Gutov
  0 siblings, 1 reply; 25+ messages in thread
From: Richard Copley @ 2014-11-19 21:57 UTC (permalink / raw)
  To: 15322

Having re-read Stefan's comment:

> > It's natural to select a particular
> > revision when running vc-print-log from (say) vc-annotate, but for
> > a plain `C-x v l', the user just wants to see "the log" and presumably
> > doesn't care about which revision happens to be current.

... perhaps I was going too far, but a fix is still needed to stop
point jumping to the beginning of the buffer when working-revision is
null (at least in Subversion). I suggest not calling
`goto-location-func' or setting vc-sentinel-movepoint when
working-revision is null, in `vc-print-log-internal'.

I also suggest a null working-revision be passed by
`vc-print-root-log', by the same argument Stefan used for
`vc-print-log'.

On 19 November 2014 21:19, Richard Copley <rcopley@gmail.com> wrote:
> Glenn's change doesn't completely solve the problem, because
> `log-view-goto-rev' goes to the beginning of the buffer when REV is
> null, and because all the other callers of `vc-log-internal' are also
> affected. It would be better to comment out the `goto-location-func'
> call in `vc-log-internal'. Having done that, you will find that you
> need to comment out the following line as well, or point will move to
> the end of the buffer instead.
>
> Note this is a duplicate of bug 6351.





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15322: VC log buffer scrolls itself
  2014-11-19 21:57   ` Richard Copley
@ 2015-05-03  3:32     ` Dmitry Gutov
  2015-05-03 14:34       ` Eli Zaretskii
  0 siblings, 1 reply; 25+ messages in thread
From: Dmitry Gutov @ 2015-05-03  3:32 UTC (permalink / raw)
  To: Richard Copley; +Cc: 15322

Richard Copley <rcopley@gmail.com> writes:

> ... perhaps I was going too far, but a fix is still needed to stop
> point jumping to the beginning of the buffer when working-revision is
> null (at least in Subversion). I suggest not calling
> `goto-location-func' or setting vc-sentinel-movepoint when
> working-revision is null, in `vc-print-log-internal'.
>
> I also suggest a null working-revision be passed by
> `vc-print-root-log', by the same argument Stefan used for
> `vc-print-log'.

Makes sense to me.

Unless someone objects, I'm going to install the following patch:

diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index bb4dd60..f64f42e 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -2224,8 +2224,9 @@ earlier revisions.  Show up to LIMIT entries (non-nil means unlimited)."
        (lambda (_bk _files-arg ret)
 	 (vc-print-log-setup-buttons working-revision
 				     is-start-revision limit ret))
-       (lambda (bk)
-	 (vc-call-backend bk 'show-log-entry working-revision))
+       (when working-revision
+         (lambda (bk)
+           (vc-call-backend bk 'show-log-entry working-revision)))
        (lambda (_ignore-auto _noconfirm)
 	 (vc-print-log-internal backend files working-revision
                               is-start-revision limit)))))
@@ -2263,8 +2264,10 @@ earlier revisions.  Show up to LIMIT entries (non-nil means unlimited)."
      (let ((inhibit-read-only t))
        (funcall setup-buttons-func backend files retval)
        (shrink-window-if-larger-than-buffer)
-       (funcall goto-location-func backend)
-       (setq vc-sentinel-movepoint (point))
+       ;; Bug#15322
+       (when goto-location-func
+         (funcall goto-location-func backend)
+         (setq vc-sentinel-movepoint (point)))
        (set-buffer-modified-p nil)))))
 
 (defun vc-incoming-outgoing-internal (backend remote-location buffer-name type)
@@ -2273,7 +2276,7 @@ earlier revisions.  Show up to LIMIT entries (non-nil means unlimited)."
    (lambda (bk buf type-arg _files)
      (vc-call-backend bk type-arg buf remote-location))
    (lambda (_bk _files-arg _ret) nil)
-   (lambda (_bk) (goto-char (point-min)))
+   nil
    (lambda (_ignore-auto _noconfirm)
      (vc-incoming-outgoing-internal backend remote-location buffer-name type))))
 
@@ -2328,16 +2331,15 @@ When called interactively with a prefix argument, prompt for LIMIT."
      (list (when (> vc-log-show-limit 0) vc-log-show-limit)))))
   (let ((backend (vc-deduce-backend))
 	(default-directory default-directory)
-	rootdir working-revision)
+	rootdir)
     (if backend
 	(setq rootdir (vc-call-backend backend 'root default-directory))
       (setq rootdir (read-directory-name "Directory for VC root-log: "))
       (setq backend (vc-responsible-backend rootdir))
       (unless backend
         (error "Directory is not version controlled")))
-    (setq working-revision (vc-working-revision rootdir)
-          default-directory rootdir)
-    (vc-print-log-internal backend (list rootdir) working-revision nil limit)))
+    (setq default-directory rootdir)
+    (vc-print-log-internal backend (list rootdir) nil nil limit)))
 
 ;;;###autoload
 (defun vc-log-incoming (&optional remote-location)





^ permalink raw reply related	[flat|nested] 25+ messages in thread

* bug#15322: VC log buffer scrolls itself
  2013-10-24  8:49                   ` Andreas Schwab
  2013-10-24 14:24                     ` Stefan Monnier
@ 2015-05-03  3:38                     ` Dmitry Gutov
  1 sibling, 0 replies; 25+ messages in thread
From: Dmitry Gutov @ 2015-05-03  3:38 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Paul Pogonyshev, 15322

Andreas Schwab <schwab@suse.de> writes:

> IMHO scrolling should only happen if point is still at BOB.

While this makes sense, and would help with fixing bug#20470 without
re-introducing the main pain point of this one, we don't have any easy
access to the "current" value of point, neither from
`vc-print-log-internal' (which is called before any output is shown),
nor from within the goto-location-func lambda it passes
`vc-log-internal-common', because the latter is called from
`vc--process-sentinel', after point is temporarily moved to
(process-mark p).





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15322: VC log buffer scrolls itself
  2015-05-03  3:32     ` Dmitry Gutov
@ 2015-05-03 14:34       ` Eli Zaretskii
  2015-05-03 15:58         ` Dmitry Gutov
  0 siblings, 1 reply; 25+ messages in thread
From: Eli Zaretskii @ 2015-05-03 14:34 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: rcopley, 15322

> From: Dmitry Gutov <dgutov@yandex.ru>
> Date: Sun, 03 May 2015 06:32:37 +0300
> Cc: 15322@debbugs.gnu.org
> 
> @@ -2263,8 +2264,10 @@ earlier revisions.  Show up to LIMIT entries (non-nil means unlimited)."
>       (let ((inhibit-read-only t))
>         (funcall setup-buttons-func backend files retval)
>         (shrink-window-if-larger-than-buffer)
> -       (funcall goto-location-func backend)
> -       (setq vc-sentinel-movepoint (point))
> +       ;; Bug#15322
> +       (when goto-location-func
> +         (funcall goto-location-func backend)
> +         (setq vc-sentinel-movepoint (point)))

I don't think it's a good idea to have in the code comments that only
mention the bug number, without also trying to explain the reason(s)
for what the code does.  If it's possible to write a clear and concise
explanation, you don't even need to mention the bug number.  If the
reasons are so complex that they cannot be explained without repeating
too much of the bug discussion, then there should be a summary and a
pointer to the bug.

Thanks.





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15322: VC log buffer scrolls itself
  2015-05-03 14:34       ` Eli Zaretskii
@ 2015-05-03 15:58         ` Dmitry Gutov
  2015-05-03 16:32           ` Eli Zaretskii
  0 siblings, 1 reply; 25+ messages in thread
From: Dmitry Gutov @ 2015-05-03 15:58 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: rcopley, 15322

On 05/03/2015 05:34 PM, Eli Zaretskii wrote:

> I don't think it's a good idea to have in the code comments that only
> mention the bug number, without also trying to explain the reason(s)
> for what the code does.

Okay. That exact piece of code should be self-evident, but I've added 
some words else where, as well as the bug reference anyway.

 > If it's possible to write a clear and concise> explanation, you don't 
even need to mention the bug number.

The surrounding code is pretty hairy, so might be possible to regress by 
accident. This way, someone changing it would look at the bug first.

diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index bb4dd60..1a997a4 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -2224,8 +2224,10 @@ earlier revisions.  Show up to LIMIT entries 
(non-nil means unlimited)."
         (lambda (_bk _files-arg ret)
  	 (vc-print-log-setup-buttons working-revision
  				     is-start-revision limit ret))
-       (lambda (bk)
-	 (vc-call-backend bk 'show-log-entry working-revision))
+       ;; 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)))
         (lambda (_ignore-auto _noconfirm)
  	 (vc-print-log-internal backend files working-revision
                                is-start-revision limit)))))
@@ -2263,8 +2265,9 @@ earlier revisions.  Show up to LIMIT entries 
(non-nil means unlimited)."
       (let ((inhibit-read-only t))
         (funcall setup-buttons-func backend files retval)
         (shrink-window-if-larger-than-buffer)
-       (funcall goto-location-func backend)
-       (setq vc-sentinel-movepoint (point))
+       (when goto-location-func
+         (funcall goto-location-func backend)
+         (setq vc-sentinel-movepoint (point)))
         (set-buffer-modified-p nil)))))

  (defun vc-incoming-outgoing-internal (backend remote-location 
buffer-name type)
@@ -2273,7 +2276,7 @@ earlier revisions.  Show up to LIMIT entries 
(non-nil means unlimited)."
     (lambda (bk buf type-arg _files)
       (vc-call-backend bk type-arg buf remote-location))
     (lambda (_bk _files-arg _ret) nil)
-   (lambda (_bk) (goto-char (point-min)))
+   nil ;; Don't move point.
     (lambda (_ignore-auto _noconfirm)
       (vc-incoming-outgoing-internal backend remote-location 
buffer-name type))))

@@ -2328,16 +2331,15 @@ When called interactively with a prefix 
argument, prompt for LIMIT."
       (list (when (> vc-log-show-limit 0) vc-log-show-limit)))))
    (let ((backend (vc-deduce-backend))
  	(default-directory default-directory)
-	rootdir working-revision)
+	rootdir)
      (if backend
  	(setq rootdir (vc-call-backend backend 'root default-directory))
        (setq rootdir (read-directory-name "Directory for VC root-log: "))
        (setq backend (vc-responsible-backend rootdir))
        (unless backend
          (error "Directory is not version controlled")))
-    (setq working-revision (vc-working-revision rootdir)
-          default-directory rootdir)
-    (vc-print-log-internal backend (list rootdir) working-revision nil 
limit)))
+    (setq default-directory rootdir)
+    (vc-print-log-internal backend (list rootdir) nil nil limit)))

  ;;;###autoload
  (defun vc-log-incoming (&optional remote-location)






^ permalink raw reply related	[flat|nested] 25+ messages in thread

* bug#15322: VC log buffer scrolls itself
  2015-05-03 15:58         ` Dmitry Gutov
@ 2015-05-03 16:32           ` Eli Zaretskii
  2015-05-03 18:33             ` Dmitry Gutov
  0 siblings, 1 reply; 25+ messages in thread
From: Eli Zaretskii @ 2015-05-03 16:32 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: rcopley, 15322

> Cc: rcopley@gmail.com, 15322@debbugs.gnu.org
> From: Dmitry Gutov <dgutov@yandex.ru>
> Date: Sun, 3 May 2015 18:58:35 +0300
> 
> On 05/03/2015 05:34 PM, Eli Zaretskii wrote:
> 
> > I don't think it's a good idea to have in the code comments that only
> > mention the bug number, without also trying to explain the reason(s)
> > for what the code does.
> 
> Okay. That exact piece of code should be self-evident, but I've added 
> some words else where, as well as the bug reference anyway.

Thanks.

>  > If it's possible to write a clear and concise> explanation, you don't 
> even need to mention the bug number.
> 
> The surrounding code is pretty hairy, so might be possible to regress by 
> accident. This way, someone changing it would look at the bug first.

Quite.





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#15322: VC log buffer scrolls itself
  2015-05-03 16:32           ` Eli Zaretskii
@ 2015-05-03 18:33             ` Dmitry Gutov
  0 siblings, 0 replies; 25+ messages in thread
From: Dmitry Gutov @ 2015-05-03 18:33 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: rcopley, 15322-done

Version: 25.1

Thanks for the review, applied.





^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2015-05-03 18:33 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-10 13:24 bug#15322: VC log buffer scrolls itself Paul Pogonyshev
2013-09-10 15:57 ` Eli Zaretskii
2013-09-10 16:04 ` Glenn Morris
2013-09-10 18:05   ` Glenn Morris
2013-09-10 18:30     ` Eli Zaretskii
2013-09-11  6:58       ` Paul Pogonyshev
2013-09-11 13:28         ` Eli Zaretskii
2013-09-12  6:26     ` Glenn Morris
2013-09-12  7:25       ` Paul Pogonyshev
2013-09-12 15:57         ` Glenn Morris
2013-09-12 19:09           ` Stefan Monnier
2013-09-12 19:30             ` Glenn Morris
2013-09-26  7:17               ` Paul Pogonyshev
2013-10-24  8:39                 ` Paul Pogonyshev
2013-10-24  8:49                   ` Andreas Schwab
2013-10-24 14:24                     ` Stefan Monnier
2014-08-02 16:04                       ` Paul Pogonyshev
2015-05-03  3:38                     ` Dmitry Gutov
2014-11-19 21:19 ` Richard Copley
2014-11-19 21:57   ` Richard Copley
2015-05-03  3:32     ` Dmitry Gutov
2015-05-03 14:34       ` Eli Zaretskii
2015-05-03 15:58         ` Dmitry Gutov
2015-05-03 16:32           ` Eli Zaretskii
2015-05-03 18:33             ` 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).