Gist for more intuitive commenting in Emacs

This commit is contained in:
Bram Schoenmakers 2022-11-27 18:49:06 +01:00
parent 6a5340a789
commit c8849e217a
2 changed files with 37 additions and 0 deletions

View file

@ -146,6 +146,27 @@ My vertico-repeat setup.
:END:
#+end_src
* Emacs commenting: do what I actually mean :emacs:
#+begin_src elisp :tangle gists/emacs-comments-do-what-i-actually-mean.el
;; Replace comment-dwim (M-;) with a modified version of
;; comment-or-uncomment-region. The modification is done by the crux
;; 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.
(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))
#+end_src
* Meta
** License

View file

@ -0,0 +1,16 @@
;; Replace comment-dwim (M-;) with a modified version of
;; comment-or-uncomment-region. The modification is done by the crux
;; 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.
(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))