summaryrefslogtreecommitdiff
path: root/lisp/newcomment.el
diff options
context:
space:
mode:
authorKaroly Lorentey <lorentey@elte.hu>2006-04-19 16:23:46 +0000
committerKaroly Lorentey <lorentey@elte.hu>2006-04-19 16:23:46 +0000
commit447b0165acd09060977e05c843f81c0bee4aa4df (patch)
tree70cf2d254760a2cf68a10b67f8a3570c05fff9a5 /lisp/newcomment.el
parent4c57cca724993ab1334cc5c0b35c22b06daee0c3 (diff)
parent0fea1d10293b4c6d35c1e55b68cd26e91445213c (diff)
downloademacs-447b0165acd09060977e05c843f81c0bee4aa4df.tar.gz
emacs-447b0165acd09060977e05c843f81c0bee4aa4df.tar.bz2
emacs-447b0165acd09060977e05c843f81c0bee4aa4df.zip
Merged from emacs@sv.gnu.org
Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-216 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-217 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-218 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-219 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-220 Improve tq.el. * emacs@sv.gnu.org/emacs--devo--0--patch-221 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-222 Update from CVS: src/puresize.h (PURESIZE_RATIO): Reduce to 10/6. * emacs@sv.gnu.org/emacs--devo--0--patch-223 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-224 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-225 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-226 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-227 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-228 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-229 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-230 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-231 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-232 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-233 Update from CVS: lisp/progmodes/python.el (python-mode): Fix typo. * emacs@sv.gnu.org/gnus--rel--5.10--patch-84 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-85 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-86 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-550
Diffstat (limited to 'lisp/newcomment.el')
-rw-r--r--lisp/newcomment.el14
1 files changed, 8 insertions, 6 deletions
diff --git a/lisp/newcomment.el b/lisp/newcomment.el
index 5fa9ac09b0b..877d5c9f399 100644
--- a/lisp/newcomment.el
+++ b/lisp/newcomment.el
@@ -895,6 +895,11 @@ indentation to be kept as it was before narrowing."
(delete-char n)
(setq ,bindent (- ,bindent n)))))))))))
+(defun comment-add (arg)
+ (if (and (null arg) (= (string-match "[ \t]*\\'" comment-start) 1))
+ comment-add
+ (1- (prefix-numeric-value arg))))
+
(defun comment-region-internal (beg end cs ce
&optional ccs cce block lines indent)
"Comment region BEG .. END.
@@ -999,7 +1004,6 @@ The strings used as comment starts are built from
(defun comment-region-default (beg end &optional arg)
(let* ((numarg (prefix-numeric-value arg))
- (add comment-add)
(style (cdr (assoc comment-style comment-styles)))
(lines (nth 2 style))
(block (nth 1 style))
@@ -1032,8 +1036,7 @@ The strings used as comment starts are built from
((consp arg) (uncomment-region beg end))
((< numarg 0) (uncomment-region beg end (- numarg)))
(t
- (setq numarg (if (and (null arg) (= (length comment-start) 1))
- add (1- numarg)))
+ (setq numarg (comment-add arg))
(comment-region-internal
beg end
(let ((s (comment-padright comment-start numarg)))
@@ -1091,9 +1094,8 @@ You can configure `comment-style' to change the way regions are commented."
;; FIXME: If there's no comment to kill on this line and ARG is
;; specified, calling comment-kill is not very clever.
(if arg (comment-kill (and (integerp arg) arg)) (comment-indent))
- (let ((add (if arg (prefix-numeric-value arg)
- (if (= (length comment-start) 1) comment-add 0))))
- ;; Some modes insist on keeping column 0 comment in column 0
+ (let ((add (comment-add arg)))
+ ;; Some modes insist on keeping column 0 comment in column 0
;; so we need to move away from it before inserting the comment.
(indent-according-to-mode)
(insert (comment-padright comment-start add))