X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Fsimple.el;fp=lisp%2Fsimple.el;h=38fd6fa737279cf3d5b6c6235aef5ffc43702594;hb=14144012929ab5944f367d5d1b323ab8268abb05;hp=51cc77da059bc5d18501a6be8a367147632b8f29;hpb=864e41347c268e5552ccf01eb3f23f7df671994e;p=chise%2Fxemacs-chise.git.1 diff --git a/lisp/simple.el b/lisp/simple.el index 51cc77d..38fd6fa 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2544,7 +2544,8 @@ If nil, use `comment-end' instead." :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]*$"))) @@ -2571,13 +2572,19 @@ If nil, use `comment-end' instead." (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)