comment region/line
No notes
Syntax:
Lisp
(defmacro allow-line-as-region-for-function (orig-function) `(defun ,(intern (concat (symbol-name orig-function) "-or-line")) () ,(format "Like `%s', but acts on the current line if mark is not active." orig-function) (interactive) (if mark-active (call-interactively (function ,orig-function)) (save-excursion ;; define a region (temporarily) -- so any C-u prefixes etc. are preserved. (beginning-of-line) (set-mark (point)) (end-of-line) (call-interactively (function ,orig-function)))))) (allow-line-as-region-for-function comment-region) (allow-line-as-region-for-function uncomment-region) (allow-line-as-region-for-function comment-or-uncomment-region)