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: Sun, 23 Sep 2007 19:37:23 -0700 Message-ID: <200709240237.l8O2bN4I019905@oogie-boogie.ics.uci.edu> References: <200709142159.l8ELxFpE029330@oogie-boogie.ics.uci.edu> <200709170409.l8H49nmZ022542@oogie-boogie.ics.uci.edu> <46EF0242.1080806@gmail.com> <200709172328.l8HNSCK9001067@oogie-boogie.ics.uci.edu> <200709190342.l8J3gpHQ020774@oogie-boogie.ics.uci.edu> <200709200154.l8K1sX2u011202@oogie-boogie.ics.uci.edu> <200709220100.l8M10Ub3008452@oogie-boogie.ics.uci.edu> <871wcokiuq.fsf@jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1190601481 526 80.91.229.12 (24 Sep 2007 02:38:01 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 24 Sep 2007 02:38:01 +0000 (UTC) Cc: emacs-devel@gnu.org To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 24 04:37:57 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 1IZdpb-00011F-0N for ged-emacs-devel@m.gmane.org; Mon, 24 Sep 2007 04:37:55 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IZdpY-0007II-6S for ged-emacs-devel@m.gmane.org; Sun, 23 Sep 2007 22:37:52 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IZdpU-0007Et-ES for emacs-devel@gnu.org; Sun, 23 Sep 2007 22:37:48 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IZdpT-0007DX-ND for emacs-devel@gnu.org; Sun, 23 Sep 2007 22:37:48 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IZdpT-0007DM-JT for emacs-devel@gnu.org; Sun, 23 Sep 2007 22:37:47 -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 1IZdpT-0005wz-EU for emacs-devel@gnu.org; Sun, 23 Sep 2007 22:37:47 -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 l8O2bN4I019905; Sun, 23 Sep 2007 19:37:23 -0700 (PDT) In-Reply-To: <871wcokiuq.fsf@jurta.org> (Juri Linkov's message of "Mon\, 24 Sep 2007 03\:07\:57 +0300") Original-Lines: 64 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:79661 Archived-At: Juri Linkov writes: > > I have committed the patch. > > > > cc-mode would need to be updated to do the same thing. I emailed the > > maintainer. > > > > Other major modes might need updates too. We can do them as soon as we > > find out they need changes. > > Thanks! It's a pity this very good feature doesn't work yet in c-mode. It seems that binding TAB to c-indent-line-or-region might be enough. I haven't tested this though... > I also tried it in some other modes (fundamental-mode, text-mode) > and it doesn't do something useful here. It inserts a single TAB whereas > C-M-\ (`indent-region') tries to indent the region. However, what C-M-\ > does in text modes is not useful too because it shifts each consequent > line relative to the previous line in a staircase-like style. This patch might allow TAB to run indent-region for those modes too: *** indent.el 21 Sep 2007 18:37:51 -0700 1.69 --- indent.el 23 Sep 2007 19:20:24 -0700 *************** *** 95,108 **** (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)) ;; The region is active, indent it. ((and transient-mark-mode mark-active (not (eq (region-beginning) (region-end)))) (indent-region (region-beginning) (region-end))) ;; Indent the line. (t (indent-according-to-mode)))) --- 95,108 ---- (or (> (current-column) (current-indentation)) (eq this-command last-command)))) (insert-tab arg)) ;; The region is active, indent it. ((and transient-mark-mode mark-active (not (eq (region-beginning) (region-end)))) (indent-region (region-beginning) (region-end))) + ;; 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)))) > What would be useful to do in text modes is to make a similar change for > M-q (`fill-paragraph'). When the region is active in transient-mark-mode, > then M-q would call `fill-region' instead of `fill-paragraph'. Good idea!