bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#60381: [PATCH] Preserve Window Position with Proced


From: Laurence Warne
Subject: bug#60381: [PATCH] Preserve Window Position with Proced
Date: Wed, 28 Dec 2022 15:55:20 +0000

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

Attachment: 0001-Preserve-the-window-position-with-proced.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]