gists/gists/emacs-comments-do-what-i-ac...

19 lines
570 B
EmacsLisp

;; Replace comment-dwim (M-;) with a modified version of
;; comment-or-uncomment-region. The modification is done by the crux
;; [1] package, which acts on a region if active otherwise on the
;; current line.
;;
;; My personal preference goes to using straight.el-powered
;; use-package forms, even for built-in modules.
;;
;; [1] https://github.com/bbatsov/crux
(use-package newcomment
:straight (:type built-in)
:bind
([remap comment-dwim] . #'comment-or-uncomment-region))
(use-package crux
:config
(crux-with-region-or-line comment-or-uncomment-region))