GNU bug report logs -
#60381
[PATCH] Preserve Window Position with Proced
Previous Next
Full log
Message #26 received at 60381 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi,
Minor update, whilst working on the first case, I've come across some
strange behaviour which causes the window position to be reset to
(point-min) in some circumstances. To reproduce this with a more minimal
setup than proced-update (I've also asked here:
https://emacs.stackexchange.com/questions/75165/window-point-reset-after-update
):
(defun example ()
(interactive)
(let* ((buf (get-buffer-create "*Example*"))
(w-points (mapcar (lambda (win)
`(,win . ,(window-point win)))
(get-buffer-window-list buf))))
(with-current-buffer buf
(let ((buf-point (point)))
(erase-buffer)
(insert "line1\nline2\nline3\nline4\nline5")
(goto-char buf-point)
(mapc (lambda (wp) (set-window-point (car wp) (cdr wp))) w-points)))
(message "Ran update")))
(setq example-timer (run-at-time t 5 #'example))
Now with a configuration of two windows, switch to the example buffer in
one of them, and move down a few lines. Switch to the other window, you
should see the window point stay the same after every update.
If you then invoke M-x, wait for an update to occur, and then cancel the
invocation using C-g, then you should see the point in the window
displaying the example buffer go back to the start of the window. I've
created a video here:
https://user-images.githubusercontent.com/17688577/210167335-f7a4d50f-dbaf-4ffc-b1e0-38c5612ed2e3.mp4.
I'm a bit confused by this, any pointers would be greatly appreciated.
On the upside, I've managed to put together a test which won't pass without
the patch.
In terms of the difference between this patch and the original, the new
patch maintains the window point for all windows which display a proced
buffer. The original just set the window point for one, as a consequence
all windows displaying the proced buffer in question would have their point
set to the most recently visited window displaying the buffer. I've had
to extract out some logic from proced-update to separate functions, and so
this patch is a bit more invasive.
Thanks, Laurence
[Message part 2 (text/html, inline)]
[0001-Preserve-the-window-position-with-proced.patch (text/x-patch, attachment)]
This bug report was last modified 2 years and 187 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.