Function: web-mode-element-rename
web-mode-element-rename is an interactive and natively compiled
function defined in web-mode.el.
Signature
(web-mode-element-rename &optional TAG-NAME)
Documentation
Rename the current html element.
Key Bindings
web-mode-map C-c C-e r
Source Code
;; Defined in /nix/store/2qgnz1rp30nzfz6w0apx4kdm14if1bbs-emacs-packages-deps/share/emacs/site-lisp/elpa/web-mode-20260831.219/web-mode.el
(defun web-mode-element-rename (&optional tag-name)
"Rename the current html element."
(interactive)
(save-excursion
(let (pos)
(unless tag-name (setq tag-name (web-mode-element-complete "New tag name: ")))
(when (and (> (length tag-name) 0)
(web-mode-element-beginning)
(looking-at "<\\([[:alnum:]]+\\(:?[[:alpha:]_-]+\\)?\\)"))
(setq pos (point))
(unless (web-mode-element-is-void)
(save-match-data
(web-mode-tag-match)
(if (looking-at "</[ ]*\\([[:alnum:]]+\\(:?[[:alpha:]_-]+\\)?\\)")
(replace-match (concat "</" tag-name))
)))
(goto-char pos)
(replace-match (concat "<" tag-name))
))))