Function: proced-renice

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

Signature

(proced-renice PRIORITY PROCESS-ALIST)

Documentation

Renice the processes in PROCESS-ALIST to PRIORITY.

PROCESS-ALIST is an alist as returned by proced-marked-processes. Interactively, PROCESS-ALIST contains the marked processes. If no process is marked, it contains the process point is on, After renicing all processes in PROCESS-ALIST, this command runs the normal hook proced-after-send-signal-hook.

Probably introduced at or before Emacs version 24.3.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/proced.el.gz
(defun proced-renice (priority process-alist)
  "Renice the processes in PROCESS-ALIST to PRIORITY.
PROCESS-ALIST is an alist as returned by `proced-marked-processes'.
Interactively, PROCESS-ALIST contains the marked processes.
If no process is marked, it contains the process point is on,
After renicing all processes in PROCESS-ALIST, this command runs
the normal hook `proced-after-send-signal-hook'."
  (interactive
   (let ((process-alist (proced-marked-processes)))
     (proced-with-processes-buffer process-alist
       (list (read-number "New priority: ")
             process-alist))))
  (if (numberp priority)
      (setq priority (number-to-string priority)))
  (let (failures)
    (dolist (process process-alist)
      (with-temp-buffer
        (condition-case nil
            (unless (zerop (call-process
                            proced-renice-command nil t nil
                            priority (number-to-string (car process))))
              (proced-log (current-buffer))
              (proced-log "%s\n" (cdr process))
              (push (cdr process) failures))
          (error ; catch errors from failed renice
           (proced-log (current-buffer))
           (proced-log "%s\n" (cdr process))
           (push (cdr process) failures)))))
    (if failures
        (proced-log-summary
         (format "Renice %s" priority)
         (format "%d of %d renice%s failed"
                 (length failures) (length process-alist)
                 (if (= 1 (length process-alist)) "" "s")))
      (proced-success-message "Reniced" (length process-alist))))
  ;; final clean-up
  (run-hooks 'proced-after-send-signal-hook))