GNU bug report logs - #60381
[PATCH] Preserve Window Position with Proced

Previous Next

Package: emacs;

Reported by: Laurence Warne <laurencewarne <at> gmail.com>

Date: Wed, 28 Dec 2022 15:56:02 UTC

Severity: normal

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#60381: closed ([PATCH] Preserve Window Position with Proced)
Date: Sat, 14 Jan 2023 08:42:01 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sat, 14 Jan 2023 10:40:58 +0200
with message-id <83bkn18q5h.fsf <at> gnu.org>
and subject line Re: bug#60381: [PATCH] Preserve Window Position with Proced
has caused the debbugs.gnu.org bug report #60381,
regarding [PATCH] Preserve Window Position with Proced
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
60381: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=60381
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Laurence Warne <laurencewarne <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Preserve Window Position with Proced
Date: Wed, 28 Dec 2022 15:55:20 +0000
[Message part 3 (text/plain, inline)]
Hi,

This patch fixes a minor issue with proced buffers.  Previously, the window
position would be set to the start of the buffer when a proced buffer was
updated and it was not displayed in the selected window.  To reproduce:

(require 'proced)
(setq-default proceed-auto-update-flag t)
(M-x proced)

Move down to the next process, then change to a different window, and wait
a bit.  You should see the point in the proced buffer move back to the
beginning of the buffer. A similar issue occurs when the proced buffer is
not displayed in any window.

This patch addresses this by setting the window point (if applicable)
whenever a proced buffer is updated, and the second issue by not updating a
proced buffer if it is not displayed in any window.

I tried to add a test for this, but for example this:

(ert-deftest proced-update-preserves-point-test ()
  (proced--within-buffer
   'medium
   'user
   (proced--move-to-column "PID")
   (let ((point (window-point))
         (window (split-window)))
     (select-window window)
     (bury-buffer)
     (with-current-buffer "*Proced*"
       (proced-update t t))
     (switch-to-buffer "*Proced*")
     (should (= point (window-point))))))

passes even without this patch (though if I step through it with
edebug-defun it fails as expected).

Thanks, Laurence
[Message part 4 (text/html, inline)]
[0001-Preserve-the-window-position-with-proced.patch (text/x-patch, attachment)]
[Message part 6 (message/rfc822, inline)]
From: Eli Zaretskii <eliz <at> gnu.org>
To: Laurence Warne <laurencewarne <at> gmail.com>
Cc: 60381-done <at> debbugs.gnu.org
Subject: Re: bug#60381: [PATCH] Preserve Window Position with Proced
Date: Sat, 14 Jan 2023 10:40:58 +0200
> From: Laurence Warne <laurencewarne <at> gmail.com>
> Date: Sat, 7 Jan 2023 17:23:36 +0000
> Cc: 60381 <at> debbugs.gnu.org
> 
> Cool, I think I've now fixed the second issue (preserving the position in proced buffers which are not
> displayed in any window) using your suggestion of setting switch-to-buffer-preserve-window-point locally to
> nil in proced buffers.  I've attached a new patch, the same as the previous one but with one line change for
> the above.

Thanks, installed, and closing the bug.


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.