From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: C-u prefix behavior of TAB broken Date: Sun, 24 Feb 2008 21:05:09 +0200 Organization: JURTA Message-ID: <8763we18xf.fsf@jurta.org> References: <874peijnu4.fsf@catnip.gol.com> <47667010.40209@gmx.at> <87tzmhs8g8.fsf@catnip.gol.com> <4766C7F7.5060504@gmx.at> <87fxxvbnbv.fsf@catnip.gol.com> <476CD8CF.4060108@gmx.at> <874peac02g.fsf@catnip.gol.com> <476D4C5D.7020202@gmx.at> <87bq8ia4mp.fsf@catnip.gol.com> <476D9138.2070808@gmx.at> <87mys272v7.fsf@catnip.gol.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1203880528 28311 80.91.229.12 (24 Feb 2008 19:15:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 24 Feb 2008 19:15:28 +0000 (UTC) Cc: emacs-devel@gnu.org To: Miles Bader Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Feb 24 20:15:53 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JTMKH-0000bM-1Q for ged-emacs-devel@m.gmane.org; Sun, 24 Feb 2008 20:15:53 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JTMJl-0002ZH-4J for ged-emacs-devel@m.gmane.org; Sun, 24 Feb 2008 14:15:21 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JTMJ0-00024z-T1 for emacs-devel@gnu.org; Sun, 24 Feb 2008 14:14:34 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JTMIy-00023m-Fr for emacs-devel@gnu.org; Sun, 24 Feb 2008 14:14:33 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JTMIy-00023i-CK for emacs-devel@gnu.org; Sun, 24 Feb 2008 14:14:32 -0500 Original-Received: from relay03.kiev.sovam.com ([62.64.120.201]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JTMIu-0007pH-GX; Sun, 24 Feb 2008 14:14:28 -0500 Original-Received: from [83.170.232.243] (helo=smtp.svitonline.com) by relay03.kiev.sovam.com with esmtp (Exim 4.67) (envelope-from ) id 1JTMIr-000CIZ-DX; Sun, 24 Feb 2008 21:14:25 +0200 In-Reply-To: <87mys272v7.fsf@catnip.gol.com> (Miles Bader's message of "Sun, 23 Dec 2007 07:59:08 +0900") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-amd64-linux-gnu) X-Scanner-Signature: 4fe2b897d4d72954524b6b73d18f8617 X-DrWeb-checked: yes X-SpamTest-Envelope-From: juri@jurta.org X-SpamTest-Group-ID: 00000000 X-SpamTest-Header: Not Detected X-SpamTest-Info: Profiles 2309 [Feb 24 2008] X-SpamTest-Info: helo_type=3 X-SpamTest-Info: {HEADERS: header Content-Type found without required header Content-Transfer-Encoding} X-SpamTest-Method: none X-SpamTest-Rate: 11 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0278], KAS30/Release X-detected-kernel: by monty-python.gnu.org: FreeBSD 6.x (1) 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:90261 Archived-At: > + ;; If a prefix argument was given, rigidly indent the following > + ;; sexp to match the change in the current line's indentation. > + (when arg > + (let ((indentation-change (- (current-indentation) old-indent))) > + (unless (zerop indentation-change) > + (save-excursion > + (forward-line 1) > + (when (< (point) end-marker) > + (indent-rigidly (point) end-marker indentation-change)))))))))) I have bound a key to the command that calls `indent-for-tab-command' with a prefix argument, and when I accidently type it a close parenthesis, it fails with the error "Containing expression ends prematurely". I think it would be better not to fail at such places, and just indent the current line without indenting the following sexp. The following patch fixes this. Any better ideas? Index: lisp/indent.el =================================================================== RCS file: /sources/emacs/emacs/lisp/indent.el,v retrieving revision 1.76 diff -u -r1.76 indent.el --- lisp/indent.el 8 Jan 2008 20:44:48 -0000 1.76 +++ lisp/indent.el 24 Feb 2008 19:04:32 -0000 @@ -29,6 +29,8 @@ ;;; Code: +(eval-when-compile (require 'cl)) ;; for `ignore-errors' + (defgroup indent nil "Indentation commands." :group 'editing) @@ -109,7 +111,7 @@ (let ((end-marker (and arg (save-excursion - (forward-line 0) (forward-sexp) (point-marker)))) + (forward-line 0) (ignore-errors (forward-sexp)) (point-marker)))) (old-indent (current-indentation))) -- Juri Linkov http://www.jurta.org/emacs/