From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Miles Bader Newsgroups: gmane.emacs.devel Subject: Re: C-u prefix behavior of TAB broken Date: Sun, 23 Dec 2007 07:59:08 +0900 Message-ID: <87mys272v7.fsf@catnip.gol.com> 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> Reply-To: Miles Bader NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1198364376 15474 80.91.229.12 (22 Dec 2007 22:59:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 22 Dec 2007 22:59:36 +0000 (UTC) Cc: Stefan Monnier , rms@gnu.org, emacs-devel@gnu.org To: martin rudalics Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Dec 22 23:59:48 2007 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 1J6DJr-0001Cc-Kj for ged-emacs-devel@m.gmane.org; Sat, 22 Dec 2007 23:59:47 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J6DJX-0002eu-NH for ged-emacs-devel@m.gmane.org; Sat, 22 Dec 2007 17:59:27 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1J6DJT-0002b8-Q7 for emacs-devel@gnu.org; Sat, 22 Dec 2007 17:59:23 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1J6DJR-0002Vt-BJ for emacs-devel@gnu.org; Sat, 22 Dec 2007 17:59:23 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J6DJR-0002Vg-1W for emacs-devel@gnu.org; Sat, 22 Dec 2007 17:59:21 -0500 Original-Received: from smtp02.dentaku.gol.com ([203.216.5.72]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1J6DJJ-00034C-Hw; Sat, 22 Dec 2007 17:59:14 -0500 Original-Received: from 203-216-96-195.dsl.gol.ne.jp ([203.216.96.195] helo=catnip.gol.com) by smtp02.dentaku.gol.com with esmtpa (Dentaku) id 1J6DJF-0006B4-Rg; Sun, 23 Dec 2007 07:59:10 +0900 Original-Received: by catnip.gol.com (Postfix, from userid 1000) id 7DC772FF7; Sun, 23 Dec 2007 07:59:08 +0900 (JST) System-Type: i686-pc-linux-gnu In-Reply-To: <476D9138.2070808@gmx.at> (martin rudalics's message of "Sat, 22 Dec 2007 23:35:36 +0100") Original-Lines: 64 X-Abuse-Complaints: abuse@gol.com X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) 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:85390 Archived-At: martin rudalics writes: >> + (let ((indentation-change (- (current-indentation) old-indent))) > > `lisp-indent-line' quits here when `indentation-change' equals zero. Good point (fixed below). -Miles --- orig/lisp/indent.el +++ mod/lisp/indent.el @@ -86,10 +86,10 @@ indent the region. The function actually called to indent the line is determined by the value of `indent-line-function'." - (interactive "p") + (interactive "P") (cond ;; The region is active, indent it. - ((and arg transient-mark-mode mark-active + ((and transient-mark-mode mark-active (not (eq (region-beginning) (region-end)))) (indent-region (region-beginning) (region-end))) ((or ;; indent-to-left-margin is only meant for indenting, @@ -99,13 +99,27 @@ (or (> (current-column) (current-indentation)) (eq this-command last-command)))) (insert-tab arg)) - ;; Those functions are meant specifically for tabbing and not for - ;; indenting, so we can't pass them to indent-according-to-mode. - ((memq indent-line-function '(indent-relative indent-relative-maybe)) - (funcall indent-line-function)) - ;; Indent the line. (t - (indent-according-to-mode)))) + (let ((end-marker + (and arg + (save-excursion + (forward-line 0) (forward-sexp) (point-marker)))) + (old-indent + (current-indentation))) + + ;; Indent the line. + (funcall indent-line-function) + + ;; 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)))))))))) (defun insert-tab (&optional arg) (let ((count (prefix-numeric-value arg))) -- The car has become... an article of dress without which we feel uncertain, unclad, and incomplete. [Marshall McLuhan, Understanding Media, 1964]