From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: Re: comment-indent and tail comments Date: Wed, 09 Aug 2006 21:14:11 -0400 Message-ID: References: <874pwm5ms6.fsf@actcom.com> Reply-To: rms@gnu.org NNTP-Posting-Host: main.gmane.org Content-Type: text/plain; charset=ISO-8859-15 X-Trace: sea.gmane.org 1155172593 23118 80.91.229.2 (10 Aug 2006 01:16:33 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 10 Aug 2006 01:16:33 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Aug 10 03:16:32 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GAz9x-0004kJ-Vr for ged-emacs-devel@m.gmane.org; Thu, 10 Aug 2006 03:16:30 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GAz9x-0007cC-3t for ged-emacs-devel@m.gmane.org; Wed, 09 Aug 2006 21:16:29 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GAz7m-00061H-2b for emacs-devel@gnu.org; Wed, 09 Aug 2006 21:14:14 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GAz7l-00060V-5U for emacs-devel@gnu.org; Wed, 09 Aug 2006 21:14:13 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GAz7l-00060O-2H for emacs-devel@gnu.org; Wed, 09 Aug 2006 21:14:13 -0400 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GAzCY-0003An-TL for emacs-devel@gnu.org; Wed, 09 Aug 2006 21:19:11 -0400 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.34) id 1GAz7j-0002tL-8h; Wed, 09 Aug 2006 21:14:11 -0400 Original-To: Yoni Rabkin Katzenell In-reply-to: <874pwm5ms6.fsf@actcom.com> (message from Yoni Rabkin Katzenell on Wed, 09 Aug 2006 11:35:53 +0300) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:58245 Archived-At: 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))))