From: Dan Nicolaescu <dann@ics.uci.edu>
To: Juri Linkov <juri@jurta.org>
Cc: emacs-devel@gnu.org
Subject: Re: TAB when the region is active
Date: Sun, 23 Sep 2007 19:37:23 -0700 [thread overview]
Message-ID: <200709240237.l8O2bN4I019905@oogie-boogie.ics.uci.edu> (raw)
In-Reply-To: <871wcokiuq.fsf@jurta.org> (Juri Linkov's message of "Mon\, 24 Sep 2007 03\:07\:57 +0300")
Juri Linkov <juri@jurta.org> 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!
next prev parent reply other threads:[~2007-09-24 2:37 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-14 21:59 TAB when the region is active Dan Nicolaescu
2007-09-16 5:35 ` Richard Stallman
2007-09-17 4:09 ` Dan Nicolaescu
2007-09-17 22:24 ` Richard Stallman
2007-09-17 22:40 ` Lennart Borgman (gmail)
2007-09-17 22:47 ` Drew Adams
2007-09-17 23:28 ` Dan Nicolaescu
2007-09-19 3:42 ` Dan Nicolaescu
2007-09-19 5:11 ` Drew Adams
2007-09-19 13:45 ` Stefan Monnier
2007-09-19 14:34 ` Drew Adams
2007-09-19 13:45 ` Stefan Monnier
2007-09-20 1:54 ` Dan Nicolaescu
2007-09-20 13:52 ` Stefan Monnier
2007-09-22 1:00 ` Dan Nicolaescu
2007-09-24 0:07 ` Juri Linkov
2007-09-24 1:09 ` Drew Adams
2007-09-24 1:15 ` Juri Linkov
2007-09-24 3:50 ` Stefan Monnier
2007-09-29 23:18 ` M-q when the region is active (Re: TAB when the region is active) Juri Linkov
2007-09-30 12:54 ` Richard Stallman
2007-10-06 22:43 ` M-$ when the region is active (Re: M-q " Juri Linkov
2007-09-24 18:20 ` TAB when the region is active Richard Stallman
2007-09-24 2:37 ` Dan Nicolaescu [this message]
2007-09-24 18:20 ` Richard Stallman
2007-09-17 23:13 ` Dan Nicolaescu
2007-09-16 18:48 ` Lennart Borgman
2007-09-16 19:17 ` Paul Pogonyshev
2007-09-16 20:32 ` Drew Adams
2007-09-17 3:59 ` Richard Stallman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200709240237.l8O2bN4I019905@oogie-boogie.ics.uci.edu \
--to=dann@ics.uci.edu \
--cc=emacs-devel@gnu.org \
--cc=juri@jurta.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).