Function: mc/mark-all-in-region

mc/mark-all-in-region is an interactive and natively compiled function defined in mc-mark-more.el.

Signature

(mc/mark-all-in-region BEG END &optional SEARCH)

Documentation

Find and mark all the parts in the region matching the given search

Key Bindings

This command is not in any keymaps.

Source Code

;; Defined in /nix/store/5q7a78ihkz25lf4xmxaa9m7b2ym63m36-emacs-packages-deps/share/emacs/site-lisp/elpa/multiple-cursors-20260419.931/mc-mark-more.el
;;;###autoload
(defun mc/mark-all-in-region (beg end &optional search)
  "Find and mark all the parts in the region matching the given search"
  (interactive "r")
  (let ((search (or search (read-from-minibuffer "Mark all in region: ")))
        (case-fold-search nil))
    (if (string= search "")
        (message "Mark aborted")
      (progn
        (mc/remove-fake-cursors)
        (goto-char beg)
	(let ((lastmatch))
          (while (search-forward search end t)
            (push-mark (match-beginning 0))
            (mc/create-fake-cursor-at-point)
	    (setq lastmatch t))
          (unless lastmatch
	    (error "Search failed for %S" search)))
	(goto-char (match-end 0))
	(if (< (mc/num-cursors) 3)
            (mc/disable-multiple-cursors-mode)
          (mc/pop-state-from-overlay (mc/furthest-cursor-before-point))
          (multiple-cursors-mode 1))))))