From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: Re: reindent-then-newline-and-indent doesn't indent properly in emacs 22.1 Date: Sun, 14 Oct 2007 15:48:21 -0400 Message-ID: References: <470FFCF1.5050201@cegetel.net> <4710849B.30104@gmx.at> <471145BA.6050600@cegetel.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1192391344 13887 80.91.229.12 (14 Oct 2007 19:49:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 14 Oct 2007 19:49:04 +0000 (UTC) To: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Oct 14 21:48:55 2007 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Ih9S1-0007s2-6D for geb-bug-gnu-emacs@m.gmane.org; Sun, 14 Oct 2007 21:48:37 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ih9Ru-0003zn-KA for geb-bug-gnu-emacs@m.gmane.org; Sun, 14 Oct 2007 15:48:30 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ih9Rr-0003vz-Mu for bug-gnu-emacs@gnu.org; Sun, 14 Oct 2007 15:48:27 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ih9Rn-0003n5-3P for bug-gnu-emacs@gnu.org; Sun, 14 Oct 2007 15:48:27 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ih9Rm-0003mt-T5 for bug-gnu-emacs@gnu.org; Sun, 14 Oct 2007 15:48:22 -0400 Original-Received: from tomts36.bellnexxia.net ([209.226.175.93] helo=tomts36-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Ih9Rm-0001eu-L8 for bug-gnu-emacs@gnu.org; Sun, 14 Oct 2007 15:48:22 -0400 Original-Received: from pastel.home ([70.55.141.81]) by tomts36-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20071014194821.RVPF7990.tomts36-srv.bellnexxia.net@pastel.home> for ; Sun, 14 Oct 2007 15:48:21 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 193787F82; Sun, 14 Oct 2007 15:48:20 -0400 (EDT) User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.50 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Solaris 8 (1) X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:16749 Archived-At: > --- lisp/simple.el.orig 2007-05-27 16:35:51.000000000 +0200 > +++ lisp/simple.el 2007-10-14 15:21:13.000000000 +0200 > @@ -618,7 +618,8 @@ > (indent-according-to-mode)) > (defun reindent-then-newline-and-indent () > - "Reindent current line, insert newline, then indent the new line. > + "Reindent current line, insert newline deleting trailing spaces or tabs, > +then indent the new line. > Indentation of both lines is done according to the current major mode, > which means calling the current value of `indent-line-function'. > In programming language modes, this is the same as TAB. > @@ -631,8 +632,12 @@ > (newline) > (save-excursion > (goto-char pos) > - (indent-according-to-mode) > - (delete-horizontal-space t)) > + ;; Beware of indentation functions moving point. > + (save-excursion > + (indent-according-to-mode)) > + ;; Delete all trailing spaces or tabs introduced by the newline command > + ;; or the new indentation. 0 is for no space. > + (just-one-space 0)) > (indent-according-to-mode))) > (defun quoted-insert (arg) The patch looks OK w.r.t wrapping indent-according-to-mode in save-excursion (indeed I do expect all indentation functions to "preserve" point but it's not stated anywhere, so I think both reindent-then-newline-and-indent and indent-to-left-margin are at fault here). But I do not understand why you replaced delete-horizontal-space with just-one-space. Stefan