emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/newcomment.el,v


From: Richard M. Stallman
Subject: [Emacs-diffs] Changes to emacs/lisp/newcomment.el,v
Date: Sat, 22 Dec 2007 18:39:07 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Richard M. Stallman <rms>       07/12/22 18:39:07

Index: newcomment.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/newcomment.el,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -b -r1.109 -r1.110
--- newcomment.el       28 Nov 2007 05:20:21 -0000      1.109
+++ newcomment.el       22 Dec 2007 18:39:07 -0000      1.110
@@ -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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]