Skip to content

Instantly share code, notes, and snippets.

@Jegeva
Created March 19, 2020 13:53
Show Gist options
  • Save Jegeva/d77519db0d94d369a14ec938eae2f494 to your computer and use it in GitHub Desktop.
Save Jegeva/d77519db0d94d369a14ec938eae2f494 to your computer and use it in GitHub Desktop.
emacs nxml comment atag
;;
(defun nxml-comment-next-tag (&optional arg)
(interactive "^p")
(or arg (setq arg 1))
(nxml-forward-element)
(nxml-backward-element)
(let (p1 p2)
(setq p1 (point))
(nxml-forward-element)
(setq p2 (point))
(goto-char p1)
(push-mark p2)
(setq mark-active t)
(kill-region p1 p2)
(kill-append " -->" nil)
(kill-append "<!-- " t)
(yank)
)
)
(define-key nxml-mode-map (kbd "C-c C-c") 'nxml-comment-next-tag)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment