Function: proced-refine

proced-refine is an interactive and byte-compiled function defined in proced.el.gz.

Signature

(proced-refine &optional EVENT)

Documentation

Refine Proced listing by comparing with the attribute value at point.

Optional EVENT is the location of the Proced field.

Refinement is controlled by the REFINER defined for each attribute ATTR in proced-grammar-alist.

If REFINER is a list of flags and point is on a process's value of ATTR, this command compares the value of ATTR of every process with the value of ATTR of the process at the position of point.

The predicate for the comparison of two ATTR values is defined in proced-grammar-alist. For each return value of the predicate a refine flag is defined in proced-grammar-alist. One can select processes for which the value of ATTR is "less than", "equal", and / or "larger" than ATTR of the process point is on. A process is included in the new listing if the refine flag for the corresponding return value of the predicate is non-nil. The help-echo string for proced-refine uses "+" or "-" to indicate the current values of these refine flags.

If REFINER is a cons pair (FUNCTION . HELP-ECHO), FUNCTION is called with one argument, the PID of the process at the position of point. The function must return a list of PIDs that is used for the refined listing. HELP-ECHO is a string that is shown when mouse is over this field.

This command refines an already existing process listing generated initially based on the value of the variable proced-filter(var)/proced-filter(fun). It does not change this variable. It does not revert the listing. If you frequently need a certain refinement, consider defining a new filter in proced-filter-alist.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/proced.el.gz
;; Refining

;; Filters are used to select the processes in a new listing.
;; Refiners are used to narrow down further (interactively) the processes
;; in an existing listing.

(defun proced-refine (&optional event)
  "Refine Proced listing by comparing with the attribute value at point.
Optional EVENT is the location of the Proced field.

Refinement is controlled by the REFINER defined for each attribute ATTR
in `proced-grammar-alist'.

If REFINER is a list of flags and point is on a process's value of ATTR,
this command compares the value of ATTR of every process with the value
of ATTR of the process at the position of point.

The predicate for the comparison of two ATTR values is defined
in `proced-grammar-alist'.  For each return value of the predicate
a refine flag is defined in `proced-grammar-alist'.  One can select
processes for which the value of ATTR is \"less than\", \"equal\",
and / or \"larger\" than ATTR of the process point is on.  A process
is included in the new listing if the refine flag for the corresponding
return value of the predicate is non-nil.
The help-echo string for `proced-refine' uses \"+\" or \"-\" to indicate
the current values of these refine flags.

If REFINER is a cons pair (FUNCTION . HELP-ECHO), FUNCTION is called
with one argument, the PID of the process at the position of point.
The function must return a list of PIDs that is used for the refined
listing.  HELP-ECHO is a string that is shown when mouse is over this field.

This command refines an already existing process listing generated initially
based on the value of the variable `proced-filter'.  It does not change
this variable.  It does not revert the listing.  If you frequently need
a certain refinement, consider defining a new filter in `proced-filter-alist'."
  (interactive (list last-input-event) proced-mode)
  (if event (posn-set-point (event-end event)))
  (let ((key (get-text-property (point) 'proced-key))
        (pid (get-text-property (point) 'proced-pid)))
    (if (and key pid)
        (let* ((grammar (assq key proced-grammar-alist))
               (refiner (nth 7 grammar)))
          (when refiner
            (add-to-list 'proced-refinements (list refiner pid key grammar) t)
            (proced-update)))
      (message "No refiner defined here."))))