unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
To: rms@gnu.org
Cc: Dan Nicolaescu <dann@ics.uci.edu>,
	Drew Adams <drew.adams@oracle.com>,
	emacs-devel@gnu.org
Subject: Re: TAB when the region is active
Date: Tue, 18 Sep 2007 00:40:02 +0200	[thread overview]
Message-ID: <46EF0242.1080806@gmail.com> (raw)
In-Reply-To: <E1IXP17-0003qT-1C@fencepost.gnu.org>

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:

- 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

  reply	other threads:[~2007-09-17 22:40 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) [this message]
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
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=46EF0242.1080806@gmail.com \
    --to=lennart.borgman@gmail.com \
    --cc=dann@ics.uci.edu \
    --cc=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=rms@gnu.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).