# HG changeset patch # User Richard M. Stallman # Date 1198348747 0 # Node ID 682c0e86fe6b7fe399b197c3c8f6b38a58e650e3 # Parent 7744259cbbc09f68e5a9b6d918e78fb4ce21c99e (comment-region-default): Don't triple the comment starter if the first region line isn't indented enough. diff -r 7744259cbbc0 -r 682c0e86fe6b lisp/newcomment.el --- a/lisp/newcomment.el Sat Dec 22 14:59:24 2007 +0000 +++ b/lisp/newcomment.el Sat Dec 22 18:39:07 2007 +0000 @@ -1095,16 +1095,22 @@ ((< numarg 0) (uncomment-region beg end (- numarg))) (t (let ((multi-char (/= (string-match "[ \t]*\\'" comment-start) 1)) - indent) + indent triple) (if (eq (nth 3 style) 'multi-char) - (setq indent multi-char) + (save-excursion + (goto-char beg) + (setq indent multi-char + ;; Triple if we will put the comment starter at the margin + ;; and the first line of the region isn't indented + ;; at least two spaces. + triple (and (not multi-char) (looking-at "\t\\| ")))) (setq indent (nth 3 style))) ;; In Lisp and similar modes with one-character comment starters, ;; double it by default if `comment-add' says so. ;; If it isn't indented, triple it. (if (and (null arg) (not multi-char)) - (setq numarg (* comment-add (if indent 1 2))) + (setq numarg (* comment-add (if triple 2 1))) (setq numarg (1- (prefix-numeric-value arg)))) (comment-region-internal