Function: log-view--mark-unmark

log-view--mark-unmark is a byte-compiled function defined in log-view.el.gz.

Signature

(log-view--mark-unmark MARK-UNMARK-FUNCTION ARG BEG END)

Documentation

Call MARK-UNMARK-FUNCTION on each line of an active region or ARG times.

MARK-UNMARK-FUNCTION should end by advancing point to the next line to be processed. The last line of an active region is excluded in the case that the region ends right at the beginning of the line, or after only non-word characters.

Source Code

;; Defined in /usr/src/emacs/lisp/vc/log-view.el.gz
(defun log-view--mark-unmark (mark-unmark-function arg beg end)
  "Call MARK-UNMARK-FUNCTION on each line of an active region or ARG times.
MARK-UNMARK-FUNCTION should end by advancing point to the next line to
be processed.
The last line of an active region is excluded in the case that the
region ends right at the beginning of the line, or after only non-word
characters."
  (when (xor beg end)
    (error "log-view--mark-unmark called with invalid arguments"))
  (if (and beg end)
      (let ((processed-line nil)
            ;; Exclude the region's last line if the region ends right
            ;; at the beginning of that line or almost at the beginning.
            ;; This is like the `file' value of `dired-mark-region'.
            ;; We don't want to include the last line unless the region
            ;; visually includes that revision.
            (lastl (save-excursion
                     (goto-char end)
                     (skip-syntax-backward "^w")
                     (if (bolp)
                         (1- (line-number-at-pos))
                       (line-number-at-pos)))))
        (save-excursion
          (goto-char beg)
          (while-let ((n (line-number-at-pos))
                      ;; Make sure we don't get stuck processing the
                      ;; same line infinitely.
                      ((<= (line-number-at-pos) lastl))
                      ((not (eq processed-line n))))
            (setq processed-line n)
            (funcall mark-unmark-function)))
        (setq deactivate-mark t))
    (dotimes (_ arg)
      (funcall mark-unmark-function))))