GNU bug report logs - #33458
27.0.50; dired loses position when reverted from outside place

Previous Next

Package: emacs;

Reported by: v88m <at> posteo.net

Date: Wed, 21 Nov 2018 20:46:01 UTC

Severity: minor

Found in version 27.0.50

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #47 received at 33458 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: martin rudalics <rudalics <at> gmx.at>
Cc: Stephen Berman <stephen.berman <at> gmx.net>, 33458 <at> debbugs.gnu.org,
 v88m <at> posteo.net
Subject: Re: bug#33458: 27.0.50;
 dired loses position when reverted from outside place
Date: Thu, 29 Nov 2018 01:45:20 +0200
>> See for example how point is preserved in an intelligent way at the end
>> of revert-buffer-insert-file-contents--default-function that uses
>> insert-file-contents to preserve some marker positions.
>
> You mean the 'restore_window_points' mechanism?  Then we would have to
> make its information available in Lisp.  Certainly worthwhile.

I understand better now where is the root of the problem.
The same problem exists for example in vc-annotate.
I wasted too much time waiting while each vc-annotate invocation
finishes its long-running process and sets the window point.
Usually when running a long-running process, I can switch to another
buffer in the window with the buffer where process is not yet finished,
or switch to another window configuration/state to do other work,
but I can't hide the annotation window because then it will fail
to set window point to the line corresponding to the source file.
So I have to do nothing, just wait when it finishes.
Is it possible to fix this annoyance?  In vc-annotate this problem
is explained as:

       ;; Ideally, we'd rather not move point if the user has already
       ;; moved it elsewhere, but really point here is not the position
       ;; of the user's cursor :-(
       (when current-line           ;(and (bobp))
         (goto-char (point-min))
         (forward-line (1- current-line))
         (setq vc-sentinel-movepoint (point)))

and in vc--process-sentinel:

          ;; But sometimes the sentinels really want to move point.
          (when vc-sentinel-movepoint
	    (let ((win (get-buffer-window (current-buffer) 0)))
	      (if (not win)
		  (goto-char vc-sentinel-movepoint)
		(with-selected-window win
		  (goto-char vc-sentinel-movepoint)))))

so when the buffer is not displayed in a window, it calls
`(goto-char vc-sentinel-movepoint)'.

The main question: why the result of setting point with goto-char
is ignored when the buffer's display is restored in a window?

Maybe we should introduce a new buffer-local variable with a name like
window-point, to set it like (setq window-point vc-sentinel-movepoint)
or in dired-revert like (setq window-point dired-point)
Then window functions that display the buffer in a window should
obey this variable and set the window point to the requested value.




This bug report was last modified 4 years and 330 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.