unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: weber <hugows@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Use tab key to indent both region AND line?
Date: 20 Apr 2007 09:01:36 -0700	[thread overview]
Message-ID: <1177084896.286288.184040@e65g2000hsc.googlegroups.com> (raw)
In-Reply-To: <mailman.2307.1177077814.7795.help-gnu-emacs@gnu.org>

On 20 abr, 10:58, Livin Stephen Sharma <livin.step...@gmail.com>
wrote:
> and
> C-c C-q will "Indent the current top-level declaration or macro
> syntactically."
>   (i.e. indent current function).
>
> On 20-Apr-07, at 18:15 , Denis Bueno wrote:
>
> > On 20 Apr 2007 05:10:40 -0700, mopi <52ha...@gmail.com> wrote:
> >> If there is a region marked I want the tab key to indent the region.
> >> Shift-tab would preferably unindent the region. But if there is no
>
> > This is perhaps a good idea. However, C-M-\ is a workaround which will
> > indent when a region is selected
>
> > -Denis
>
> > _______________________________________________
> > help-gnu-emacs mailing list
> > help-gnu-em...@gnu.org
> >http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

What do you mean to indent a region? Let emacs indent it or insert a
tab in the beginning of each selected line ?

In the first case, this should get you started:

(defun indent-line-or-region ()
  "indent line or region"
  (interactive)
  (if mark-active   ;; there is a region selected
      (indent-region)
      (indent-according-to-mode))) ;; indent line

Just bind it to tab.

Hope i could help you,
-weber

  parent reply	other threads:[~2007-04-20 16:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-20 12:10 Use tab key to indent both region AND line? mopi
2007-04-20 12:45 ` Denis Bueno
2007-04-20 13:58   ` Livin Stephen Sharma
     [not found]   ` <mailman.2307.1177077814.7795.help-gnu-emacs@gnu.org>
2007-04-20 16:01     ` weber [this message]
2007-04-20 17:16       ` Lennart Borgman (gmail)
2007-04-20 22:41         ` Lennart Borgman (gmail)
     [not found]       ` <mailman.2326.1177089678.7795.help-gnu-emacs@gnu.org>
2007-04-20 17:54         ` mopi
2007-04-20 19:07           ` mopi
2007-04-20 22:12             ` weber

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=1177084896.286288.184040@e65g2000hsc.googlegroups.com \
    --to=hugows@gmail.com \
    --cc=help-gnu-emacs@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.
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).