Function: proced-do-mark-all

proced-do-mark-all is a byte-compiled function defined in proced.el.gz.

Signature

(proced-do-mark-all MARK)

Documentation

Mark all processes using MARK.

If transient-mark-mode(var)/transient-mark-mode(fun) is turned on and the region is active, mark the region.

Source Code

;; Defined in /usr/src/emacs/lisp/proced.el.gz
(defun proced-do-mark-all (mark)
  "Mark all processes using MARK.
If `transient-mark-mode' is turned on and the region is active,
mark the region."
  (let* ((count 0)
         (proced-marker-char (if mark proced-marker-char ?\s))
         (marker-re (proced-marker-regexp))
         end buffer-read-only)
    (save-excursion
      (if (use-region-p)
          ;; Operate even on those lines that are only partially a part
          ;; of region.  This appears most consistent with
          ;; `proced-move-to-goal-column'.
          (progn (setq end (save-excursion
                             (goto-char (region-end))
                             (unless (looking-at "^") (forward-line))
                             (point)))
                 (goto-char (region-beginning))
                 (unless (looking-at "^") (beginning-of-line)))
        (goto-char (point-min))
        (setq end (point-max)))
      (while (< (point) end)
        (unless (looking-at marker-re)
          (setq count (1+ count))
          (insert proced-marker-char)
          (delete-char 1))
        (forward-line))
      (proced-success-message (if mark "Marked" "Unmarked") count))))