Function: mc/create-fake-cursor-at-point

mc/create-fake-cursor-at-point is a natively compiled function defined in multiple-cursors-core.el.

Signature

(mc/create-fake-cursor-at-point &optional ID)

Documentation

Add a fake cursor and possibly a fake active region overlay based on point and mark.

Saves the current state in the overlay to be restored later.

Source Code

;; Defined in /nix/store/5q7a78ihkz25lf4xmxaa9m7b2ym63m36-emacs-packages-deps/share/emacs/site-lisp/elpa/multiple-cursors-20260419.931/multiple-cursors-core.el
(defun mc/create-fake-cursor-at-point (&optional id)
  "Add a fake cursor and possibly a fake active region overlay
based on point and mark.

Saves the current state in the overlay
to be restored later."
  (unless mc--max-cursors-original
    (setq mc--max-cursors-original mc/max-cursors))
  (when mc/max-cursors
    (unless (< (mc/num-cursors) mc/max-cursors)
      (if (yes-or-no-p (format "%d active cursors. Continue? " (mc/num-cursors)))
          (setq mc/max-cursors (read-number "Enter a new, temporary maximum: "))
        (mc/remove-fake-cursors)
        (error "Aborted: too many cursors"))))
  (let ((overlay (mc/make-cursor-overlay-at-point)))
    (overlay-put overlay 'mc-id (or id (mc/create-cursor-id)))
    (overlay-put overlay 'type 'fake-cursor)
    (overlay-put overlay 'priority 100)
    (mc/store-current-state-in-overlay overlay)
    (when (use-region-p)
      (overlay-put overlay 'region-overlay
                   (mc/make-region-overlay-between-point-and-mark)))
    overlay))