:type 'integer
:group 'comment)
(make-variable-buffer-local 'comment-column)
+;;;###autoload(put 'comment-column 'safe-local-variable 'integerp)
;;;###autoload
(defvar comment-start nil
"*String to insert to start a new comment, or nil if no comment syntax.")
+;;;###autoload(put 'comment-start 'safe-local-variable 'string-or-null-p)
;;;###autoload
(defvar comment-start-skip nil
"*Regexp to match the start of a comment plus everything up to its body.
If there are any \\(...\\) pairs, the comment delimiter text is held to begin
at the place matched by the close of the first pair.")
+;;;###autoload(put 'comment-start-skip 'safe-local-variable 'string-or-null-p)
;;;###autoload
(defvar comment-end-skip nil
"Regexp to match the end of a comment plus everything up to its body.")
+;;;###autoload(put 'comment-end-skip 'safe-local-variable 'string-or-null-p)
;;;###autoload
(defvar comment-end ""
"*String to insert to end a new comment.
Should be an empty string if comments are terminated by end-of-line.")
+;;;###autoload(put 'comment-end 'safe-local-variable 'string-or-null-p)
;;;###autoload
(defvar comment-indent-function 'comment-indent-default
(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.
(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))
((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)))
;; 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))