Function: mc/mark-sgml-tag-pair

mc/mark-sgml-tag-pair is an interactive and natively compiled function defined in mc-mark-more.el.

Signature

(mc/mark-sgml-tag-pair)

Documentation

Mark the tag we're in and its pair for renaming.

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-sgml-tag-pair ()
  "Mark the tag we're in and its pair for renaming."
  (interactive)
  (when (not (mc--inside-tag-p))
    (error "Place point inside tag to rename."))
  (let ((context (mc--get-nice-sgml-context)))
    (if (looking-at "</")
        (setq context (car (last (sgml-get-context)))))
    (goto-char (aref context 2))
    (let* ((tag-name (aref context 4))
           (num-chars (length tag-name))
           (master-start (1+ (point)))
           (mirror-end (save-excursion
                         (sgml-skip-tag-forward 1)
                         (1- (point)))))
      (goto-char (- mirror-end num-chars))
      (set-mark mirror-end)
      (mc/create-fake-cursor-at-point)
      (goto-char master-start)
      (set-mark (+ (point) num-chars))))
  (mc/maybe-multiple-cursors-mode))