Subject: bug#59842: [PATCH] Make proced-update Preserve Refinements

From: Eli Zaretskii <[email-masked]>
Date: Tue, 06 Dec 2022 19:49:06 +0200

> From: Laurence Warne <[email-masked]>
> Date: Mon, 5 Dec 2022 20:26:26 +0000
> 
> The patch fixes aims to fix this by introducing a new buffer local variable "proced-refinements" which stores
> information about the current refinements, and is used by proced-update to further refine
> proced-process-alist in the case it is non-nil.

Thanks.  Unfortunately, we don't have a test suite for proced.el, so
non-trivial changes to it always ruin the risk of producing regressions.
How to test this, and how did you test it?

> * lisp/proced.el (proced-refinements): New buffer local variable
> which tracks the current refinements.
> (proced-refine): Set proced-refinements variable and defer setting of
> proced-process-alist to proced-update.
> (proced-update): Take into account proced-refinements when setting
> proced-process-alist.
> (proced-revert): Set proced-refinements to nil prior to calling proced-update.

Please quote symbols in log entries 'like this'.  (Do not quote symbols
inside parentheses, only in the descriptive text.)

> +  (pcase-dolist (`(,refiner ,pid ,key ,grammar) proced-refinements)
> +    ;; It's possible the process has exited since the refinement was made
> +    (when (assq pid proced-process-alist)

What happens if that process did exit?  Shouldn't we reset
proced-refinements to nil?

>  (defun proced-revert (&rest _args)
>    "Reevaluate the process listing based on the currently running processes.
> -Preserves point and marks."
> +Preserves point and marks, but not refinements."

Please add a cross-reference to proced-refine here, so that the reader who
doesn't know what a "refinement" is could find out.