From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs Subject: Re: reindent-then-newline-and-indent doesn't indent properly in emacs 22.1 Date: Sun, 14 Oct 2007 20:26:54 +0200 Message-ID: <47125F6E.8000803@gmx.at> References: <470FFCF1.5050201@cegetel.net> <4710849B.30104@gmx.at> <471145BA.6050600@cegetel.net> <47121848.1060800@cegetel.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1192386445 395 80.91.229.12 (14 Oct 2007 18:27:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 14 Oct 2007 18:27:25 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org To: nuxdoors@cegetel.net Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Oct 14 20:27:15 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 1Ih8Ai-0003q3-1P for geb-bug-gnu-emacs@m.gmane.org; Sun, 14 Oct 2007 20:26:40 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ih8Aa-0006V0-T7 for geb-bug-gnu-emacs@m.gmane.org; Sun, 14 Oct 2007 14:26:32 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ih8AZ-0006Us-2P for bug-gnu-emacs@gnu.org; Sun, 14 Oct 2007 14:26:31 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ih8AW-0006Tv-I2 for bug-gnu-emacs@gnu.org; Sun, 14 Oct 2007 14:26:29 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ih8AW-0006Tr-DA for bug-gnu-emacs@gnu.org; Sun, 14 Oct 2007 14:26:28 -0400 Original-Received: from mail.gmx.net ([213.165.64.20]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1Ih8AW-0001p7-3K for bug-gnu-emacs@gnu.org; Sun, 14 Oct 2007 14:26:28 -0400 Original-Received: (qmail invoked by alias); 14 Oct 2007 18:26:26 -0000 Original-Received: from N719P005.adsl.highway.telekom.at (EHLO [62.47.33.197]) [62.47.33.197] by mail.gmx.net (mp045) with SMTP; 14 Oct 2007 20:26:26 +0200 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX18LgJZ02cQL8Hu1W3k2tZXqWUN3M9aoyaNEpuRhHh 6ScHa6rOdJRpVd User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: de-DE, de, en-us, en In-Reply-To: <47121848.1060800@cegetel.net> X-Y-GMX-Trusted: 0 X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) 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:16748 Archived-At: > Here is the patch alone, hopefully without thunderbird mangling it. With Thunderbird better send patches as attachments. > > --- 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. Note that the first sentence of a doc-string should fit on one 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)) Why is this better than `delete-horizontal-space'? > (indent-according-to-mode))) > > (defun quoted-insert (arg) In any case you might have to convince other people first that your solution is preferable to using, for example, (save-excursion (indent-line-to (current-left-margin)))) as `indent-line-function'.