From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: nuxdoors@cegetel.net Newsgroups: gmane.emacs.bugs Subject: reindent-then-newline-and-indent doesn't indent properly in emacs 22.1 Date: Sat, 13 Oct 2007 01:02:09 +0200 Message-ID: <470FFCF1.5050201@cegetel.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7BIT X-Trace: sea.gmane.org 1192250676 10425 80.91.229.12 (13 Oct 2007 04:44:36 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 13 Oct 2007 04:44:36 +0000 (UTC) To: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Oct 13 06:44:25 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 1IgYrN-0008Jn-QB for geb-bug-gnu-emacs@m.gmane.org; Sat, 13 Oct 2007 06:44:22 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IgYrH-0003rk-KE for geb-bug-gnu-emacs@m.gmane.org; Sat, 13 Oct 2007 00:44:15 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IgTYI-0006I2-AE for bug-gnu-emacs@gnu.org; Fri, 12 Oct 2007 19:04:18 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IgTYG-0006Fl-SG for bug-gnu-emacs@gnu.org; Fri, 12 Oct 2007 19:04:17 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IgTYG-0006Fb-Ka for bug-gnu-emacs@gnu.org; Fri, 12 Oct 2007 19:04:16 -0400 Original-Received: from sp604005mt.neufgp.fr ([84.96.92.11] helo=smtp.Neuf.fr) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IgTYG-0002Uy-50 for bug-gnu-emacs@gnu.org; Fri, 12 Oct 2007 19:04:16 -0400 Original-Received: from [86.77.76.137] by sp604005mt.gpm.neuf.ld (Sun Java System Messaging Server 6.2-5.05 (built Feb 16 2006)) with ESMTP id <0JPT007SLMOTFR90@sp604005mt.gpm.neuf.ld> for bug-gnu-emacs@gnu.org; Sat, 13 Oct 2007 01:02:53 +0200 (CEST) User-Agent: Icedove 1.5.0.12 (X11/20070607) X-detected-kernel: by monty-python.gnu.org: Windows 98 (3 X-Mailman-Approved-At: Sat, 13 Oct 2007 00:44:14 -0400 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:16739 Archived-At: Hi, In GNU Emacs 22.1: reindent-then-newline-and-indent doesn't indent properly. The command currently calls delete-horizontal-space after indenting the line, which in effect deletes the re-indentation since at that very moment the point is at the beginning of the text. If you swap the order of the delete-horizontal-space and indent-according-to-mode functions it then works as intended, like this : (defun reindent-then-newline-and-indent () "Reindent current line, insert newline, 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. In some text modes, where TAB inserts a tab, this indents to the column specified by the function `current-left-margin'." (interactive "*") (let ((pos (point))) ;; Be careful to insert the newline before indenting the line. ;; Otherwise, the indentation might be wrong. (newline) (save-excursion (goto-char pos) (delete-horizontal-space t) (indent-according-to-mode)) (indent-according-to-mode))) Regards, Fabrice.