[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: comment-indent and tail comments
From: |
Richard Stallman |
Subject: |
Re: comment-indent and tail comments |
Date: |
Wed, 09 Aug 2006 21:14:11 -0400 |
After looking at it I got to Line 604 in the function `comment-indent'
which is defined in the file "newcomment.el". Line 604 runs
`delete-region', which modifies the buffer and then runs `indent-to'
which intents to the exact same place as the comment was before.
Do you mean this code?
(unless (= (current-column) indent)
;; If that's different from current, change it.
(delete-region (point) (progn (skip-chars-backward " \t") (point)))
(indent-to (if (bolp) indent
(max indent (1+ (current-column)))))))
Does this fix it?
*** newcomment.el 11 May 2006 14:33:16 -0400 1.94
--- newcomment.el 09 Aug 2006 19:23:27 -0400
***************
*** 599,609 ****
(if (and other (<= other max) (> other min))
;; There is a comment and it's in the range: bingo.
(setq indent other))))))))
(unless (= (current-column) indent)
- ;; If that's different from current, change it.
(delete-region (point) (progn (skip-chars-backward " \t") (point)))
! (indent-to (if (bolp) indent
! (max indent (1+ (current-column)))))))
(goto-char cpos)
(set-marker cpos nil))))
--- 599,614 ----
(if (and other (<= other max) (> other min))
;; There is a comment and it's in the range: bingo.
(setq indent other))))))))
+ ;; Update INDENT to leave at least one space
+ ;; after other nonwhite text on the line.
+ (save-excursion
+ (skip-chars-backward " \t")
+ (unless (bolp)
+ (setq indent (max indent (1+ (current-column))))))
+ ;; If that's different from comment's current position, change it.
(unless (= (current-column) indent)
(delete-region (point) (progn (skip-chars-backward " \t") (point)))
! (indent-to indent)))
(goto-char cpos)
(set-marker cpos nil))))