Commenting Un-commenting

James Dyer : Feb 15, 2023 : 87 words
emacs linux elisp 2023

After watching an interesting video by EmacsElements regarding commenting and un-commenting I have to say that I wholeheartedly agree. I really don’t like the way comment-dwim works and made me think back to one of the first elisp functions I commandeered from the interwebs :

(defun my/comment-or-uncomment ()
  "Comments or uncomments the current line or region."
  (if (region-active-p)

and it is a command that I constantly use and had forgotten that it isn’t part of the emacs default functionality from a M-;