From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Nicolaescu Newsgroups: gmane.emacs.devel Subject: Re: TAB when the region is active Date: Mon, 17 Sep 2007 16:28:12 -0700 Message-ID: <200709172328.l8HNSCK9001067@oogie-boogie.ics.uci.edu> References: <200709142159.l8ELxFpE029330@oogie-boogie.ics.uci.edu> <200709170409.l8H49nmZ022542@oogie-boogie.ics.uci.edu> <46EF0242.1080806@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1190071883 24408 80.91.229.12 (17 Sep 2007 23:31:23 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 17 Sep 2007 23:31:23 +0000 (UTC) Cc: rms@gnu.org, Drew Adams , emacs-devel@gnu.org To: "Lennart Borgman \(gmail\)" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Sep 18 01:31:20 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 1IXQ3b-0002MP-Tv for ged-emacs-devel@m.gmane.org; Tue, 18 Sep 2007 01:31:12 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IXQ3a-0007KN-IU for ged-emacs-devel@m.gmane.org; Mon, 17 Sep 2007 19:31:10 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IXQ3W-0007JQ-5Y for emacs-devel@gnu.org; Mon, 17 Sep 2007 19:31:06 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IXQ3V-0007Ih-1S for emacs-devel@gnu.org; Mon, 17 Sep 2007 19:31:05 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IXQ3U-0007Ic-VX for emacs-devel@gnu.org; Mon, 17 Sep 2007 19:31:04 -0400 Original-Received: from oogie-boogie.ics.uci.edu ([128.195.1.41]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IXQ3Q-0003gX-Sa; Mon, 17 Sep 2007 19:31:01 -0400 Original-Received: from mothra.ics.uci.edu (mothra.ics.uci.edu [128.195.6.93]) by oogie-boogie.ics.uci.edu (8.13.6/8.13.6) with ESMTP id l8HNSCK9001067; Mon, 17 Sep 2007 16:28:12 -0700 (PDT) In-Reply-To: <46EF0242.1080806@gmail.com> (Lennart Borgman's message of "Tue\, 18 Sep 2007 00\:40\:02 +0200") Original-Lines: 51 X-ICS-MailScanner: Found to be clean X-ICS-MailScanner-SpamCheck: not spam, SpamAssassin (score=-0.84, required 5, autolearn=disabled, ALL_TRUSTED -1.44, J_CHICKENPOX_62 0.60) X-ICS-MailScanner-From: dann@mothra.ics.uci.edu X-Detected-Kernel: Solaris 9 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:79155 Archived-At: "Lennart Borgman (gmail)" writes: > Richard Stallman wrote: > > > The idea is logical, but we need to ask users if they find the change > > > annoying. > > > > Given that we are not close to a release, this would be a good time to > > experiment. Can you please OK such a change? > > > > I will ok trying it, if you agree to follow up in a few weeks > > by reminding people to try it and say if they don't like it. > > > The code below is what I currently use. There are some problems I know > about: Thanks. I don't know much about the code in indent.el, and I don't see how your code would fit in the existing framework there. I would guess that indent-for-tab-command and the functions that it calls would need changes. Any help with getting this right would be greatly appreciated. > - I do not remember what Drew wanted to add (in another message). > > - indent-according-to-mode is not supported everywhere. > > BTW, there is another problem with the indentation functions. I > believe it would be useful (at least in mumamo.el) if the function > that indents a line where split into one that gives the indentation > amount and one that does the indentation (for every major mode). > > > (defun indent-line-or-region () > "Indent line or region. > Only do this if indentation seems bound to \\t. > > Call `indent-region' if region is active, otherwise > `indent-according-to-mode'." > (interactive) > ;; Do a wild guess if we should indent or not ... > (let* ((indent-region-mode) > (t-bound (key-binding [?\t]))) > (if (not > (save-match-data > (string-match "indent" (symbol-name t-bound)))) > (call-interactively t-bound t) > (if (and mark-active ;; there is a visible region selected > transient-mark-mode) > (indent-region (region-beginning) (region-end)) > (indent-according-to-mode))))) ;; indent line