From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: TAB when the region is active Date: Tue, 18 Sep 2007 22:11:18 -0700 Message-ID: References: <200709190342.l8J3gpHQ020774@oogie-boogie.ics.uci.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1190178699 15052 80.91.229.12 (19 Sep 2007 05:11:39 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 19 Sep 2007 05:11:39 +0000 (UTC) To: Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 19 07:11:38 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 1IXrqb-00038u-8v for ged-emacs-devel@m.gmane.org; Wed, 19 Sep 2007 07:11:37 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IXrqZ-0001UN-CO for ged-emacs-devel@m.gmane.org; Wed, 19 Sep 2007 01:11:35 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IXrqU-0001U8-67 for emacs-devel@gnu.org; Wed, 19 Sep 2007 01:11:30 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IXrqS-0001TR-Te for emacs-devel@gnu.org; Wed, 19 Sep 2007 01:11:28 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IXrqS-0001TM-63 for emacs-devel@gnu.org; Wed, 19 Sep 2007 01:11:28 -0400 Original-Received: from agminet01.oracle.com ([141.146.126.228]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IXrqR-0002Wm-Mb for emacs-devel@gnu.org; Wed, 19 Sep 2007 01:11:27 -0400 Original-Received: from rgmgw1.us.oracle.com (rgmgw1.us.oracle.com [138.1.186.110]) by agminet01.oracle.com (Switch-3.2.4/Switch-3.1.7) with ESMTP id l8J5BNiE027793 for ; Wed, 19 Sep 2007 00:11:23 -0500 Original-Received: from acsmt350.oracle.com (acsmt350.oracle.com [141.146.40.150]) by rgmgw1.us.oracle.com (Switch-3.2.4/Switch-3.2.4) with ESMTP id l8HLXSdO023271 for ; Tue, 18 Sep 2007 23:11:22 -0600 Original-Received: from dhcp-amer-csvpn-gw1-141-144-66-217.vpn.oracle.com by acsmt350.oracle.com with ESMTP id 3225309001190178664; Tue, 18 Sep 2007 22:11:04 -0700 X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) In-Reply-To: <200709190342.l8J3gpHQ020774@oogie-boogie.ics.uci.edu> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Brightmail-Tracker: AAAAAQAAAAI= X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-Whitelist: TRUE X-Detected-Kernel: Linux 2.4-2.6 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:79274 Archived-At: 1. `indent-region' only indents lines that start within the region. There's probably a good reason for that, but I'm not sure that's the behavior we want here. I wonder if it wouldn't be better here to apply `indent-line' (e.g. `lisp-indent-line') to each line, in turn, that has at least one character (not necessarily its first character) in the region. A typical use case for me is wanting to see what really changes when I do `C-M-q' on a large defun (> one screen). I want, for instance, to see if only some comment positions change or if some sexps move because I might have an extra or a missing paren. I'll hit TAB for each of several successive lines to see if/how they move. (You might have an alternative that you prefer, but I often do this.) If TAB, as proposed, will now affect the region, then I'll just select some lines and hit TAB - great. But, IIUC, the first line selected would need to have its beginning selected also, or else `indent-region' won't apply to it. It would be handier, I think, to have `lisp-indent-line' applied to each selected line, in turn. That way, the region would show all of the lines that would be affected by the operation. You could quickly zap the mouse over some lines to select them, without regard to the exact beginning or end of the region, and TAB would indent them all appropriately (in turn). (No, I didn't try the patch; I just scanned it.) 2. BTW, does `lisp-indent-region' really do the right thing? E.g., if you select all lines after the first one here, and then do (lisp-indent-region (region-beginning) (region-end)), the last three lines are not indented correctly. Is that THT? (cond (foobar (fibrillate) ; select this and subsequent lines (frobnicate) (message "Fabulous!")) (t (barn-owl) (bobolink) (message "Bar none."))) `lisp-indent-region' gives this (is it a bug or intended?): (cond (foobar (fibrillate) (frobnicate) (message "Fabulous!")) (t (barn-owl) ; incorrectly indented (bobolink) (message "Bar none."))) The problem I was referring to in #1 is the difference between this and what happens if you don't start the selection at the beginning of the second line, but in some other part of the second line (e.g. at its opening paren). The result is then this: (cond (foobar (fibrillate) ; incorrect indentation (not moved) (frobnicate) ; correctly indented relative to previous (message "Fabulous!")) (t (barn-owl) (bobolink) (message "Bar none.")))) (Yes, you can, remembering this gotcha, always start selecting one line ahead of what you want to indent, but I think it's clearer if the region clearly indicates the lines to be affected.) 3. Wrt my use case mentioned in #1, yes, it might be nice to have a visual indication of the first significant (i.e. non-comment) change in indentation, starting at point, when you do `C-M-q'. Or perhaps even an indication of all indentation changes. That might be done by highlighting any added whitespace and indicating any removed whitespace in some other way - perhaps by highlighting (differently) the chars that were moved leftward to replace previous whitespace. E.g., moving from the first sexp above to the second would show something like this, where `x' indicates removed whitespace (but highlighting would be used, not `x'). (cond (foobar xxibrillate) xxxxxxicate) xxxxsage "Fabulous!")) xxx xxxxxxxxl) xxxxxxink) (message "Bar none."))) Apologies for adding topics. Only #1 is relevant to this thread. (And perhaps #2.)