:group 'fill-comments)
(defun indent-for-comment ()
- "Indent this line's comment to comment column, or insert an empty comment."
+ "Indent this line's comment to comment column, or insert an empty
+comment. Comments starting in column 0 are not moved."
(interactive "*")
(let* ((empty (save-excursion (beginning-of-line)
(looking-at "[ \t]*$")))
(skip-syntax-backward "^ " (match-beginning 0)))))
(setq begpos (point))
;; Compute desired indent.
- (if (= (current-column)
- (setq indent (funcall comment-indent-function)))
- (goto-char begpos)
+ ;; XEmacs change: Preserve indentation of comments starting in
+ ;; column 0, as documented.
+ (cond
+ ((= (current-column) 0)
+ (goto-char begpos))
+ ((= (current-column)
+ (setq indent (funcall comment-indent-function)))
+ (goto-char begpos))
+ (t
;; If that's different from current, change it.
(skip-chars-backward " \t")
(delete-region (point) begpos)
- (indent-to indent))
+ (indent-to indent)))
;; An existing comment?
(if cpos
(progn (goto-char cpos)