Function: mc/mark-more-like-this

mc/mark-more-like-this is a natively compiled function defined in mc-mark-more.el.

Signature

(mc/mark-more-like-this SKIP-LAST DIRECTION)

Source Code

;; Defined in /nix/store/5q7a78ihkz25lf4xmxaa9m7b2ym63m36-emacs-packages-deps/share/emacs/site-lisp/elpa/multiple-cursors-20260419.931/mc-mark-more.el
(defun mc/mark-more-like-this (skip-last direction)
  (let ((case-fold-search nil)
        (re (regexp-opt (mc/region-strings) mc/enclose-search-term))
        (point-out-of-order (cl-ecase direction
                              (forwards       (< (point) (mark)))
                              (backwards (not (< (point) (mark))))))
        (furthest-cursor (cl-ecase direction
                           (forwards  (mc/furthest-cursor-after-point))
                           (backwards (mc/furthest-cursor-before-point))))
        (start-char (cl-ecase direction
                      (forwards  (mc/furthest-region-end))
                      (backwards (mc/first-region-start))))
        (search-function (cl-ecase direction
                           (forwards  'search-forward-regexp)
                           (backwards 'search-backward-regexp)))
        (match-point-getter (cl-ecase direction
                              (forwards 'match-beginning)
                              (backwards 'match-end))))
    (if (and skip-last (not furthest-cursor))
        (error "No cursors to be skipped")
      (mc/save-excursion
       (goto-char start-char)
       (when skip-last
         (mc/remove-fake-cursor furthest-cursor))
       (if (funcall search-function re nil t)
           (progn
             (push-mark (funcall match-point-getter 0))
             (when point-out-of-order
               (exchange-point-and-mark))
             (mc/create-fake-cursor-at-point))
         (user-error "no more matches found."))))))