help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Use tab key to indent both region AND line?


From: weber
Subject: Re: Use tab key to indent both region AND line?
Date: 20 Apr 2007 09:01:36 -0700
User-agent: G2/1.0

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]