summaryrefslogtreecommitdiff
path: root/lisp/newcomment.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2003-05-30 20:06:40 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2003-05-30 20:06:40 +0000
commit6976bf99f0e9ab077844900de1cf34eda5e2c10b (patch)
tree43703daa3370f6b83f55bea188407ea5a10ff6b0 /lisp/newcomment.el
parent8084f5d87c5235ee3619daabba474e4246bb7a62 (diff)
downloademacs-6976bf99f0e9ab077844900de1cf34eda5e2c10b.tar.gz
emacs-6976bf99f0e9ab077844900de1cf34eda5e2c10b.tar.bz2
emacs-6976bf99f0e9ab077844900de1cf34eda5e2c10b.zip
(comment-empty-lines): New var.
(comment-region-internal): Use it.
Diffstat (limited to 'lisp/newcomment.el')
-rw-r--r--lisp/newcomment.el12
1 files changed, 11 insertions, 1 deletions
diff --git a/lisp/newcomment.el b/lisp/newcomment.el
index d7067184539..c73f4ef644f 100644
--- a/lisp/newcomment.el
+++ b/lisp/newcomment.el
@@ -194,6 +194,15 @@ makes the comment easier to read. Default is 1. nil means 0."
This is obsolete because you might as well use \\[newline-and-indent]."
:type 'boolean)
+(defcustom comment-empty-lines nil
+ "If nil, `comment-region' does not comment out empty lines.
+If t, it always comments out empty lines.
+if `eol' it only comments out empty lines if comments are
+terminated by the end of line (i.e. `comment-end' is empty)."
+ :type '(choice (const :tag "Never" nil)
+ (const :tag "Always" t)
+ (const :tag "EOl-terminated" 'eol)))
+
;;;;
;;;; Helpers
;;;;
@@ -821,7 +830,8 @@ of the region for CE and CS.
INDENT indicates to put CS and CCS at the current indentation of the region
rather than at left margin."
;;(assert (< beg end))
- (let ((no-empty t))
+ (let ((no-empty (not (or (eq comment-empty-lines t)
+ (and comment-empty-lines (zerop (length ce)))))))
;; Sanitize CE and CCE.
(if (and (stringp ce) (string= "" ce)) (setq ce nil))
(if (and (stringp cce) (string= "" cce)) (setq cce nil))