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