diff lisp/simple.el @ 448:3078fd1074e8 r21-2-39

Import from CVS: tag r21-2-39
author cvs
date Mon, 13 Aug 2007 11:38:25 +0200
parents 1ccc32a20af4
children 0784d089fdc9
line wrap: on
line diff
--- a/lisp/simple.el	Mon Aug 13 11:37:23 2007 +0200
+++ b/lisp/simple.el	Mon Aug 13 11:38:25 2007 +0200
@@ -2544,7 +2544,8 @@
   :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 @@
 		     (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)