unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Indent region by one tabstop
@ 2012-04-19 22:00 BDB
  2012-04-19 23:19 ` Drew Adams
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: BDB @ 2012-04-19 22:00 UTC (permalink / raw)
  To: help-gnu-emacs

Is there a way to make emacs move a region of code left or right by one
tabstop?  I don't want to use emacs' built in indentation because it's
not indenting the lines where I want them to be.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: Indent region by one tabstop
  2012-04-19 22:00 Indent region by one tabstop BDB
@ 2012-04-19 23:19 ` Drew Adams
       [not found] ` <mailman.262.1334877565.751.help-gnu-emacs@gnu.org>
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Drew Adams @ 2012-04-19 23:19 UTC (permalink / raw)
  To: 'BDB', help-gnu-emacs

> Is there a way to make emacs move a region of code left or 
> right by one tabstop?  I don't want to use emacs' built in
> indentation because it's not indenting the lines where I
> want them to be.

Use `indent-rigidly' with the value of `tab-width'?

(defun my-indent-a-tab-width (start end)
  (interactive "r")
  (indent-rigidly start end tab-width))





^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Indent region by one tabstop
       [not found] ` <mailman.262.1334877565.751.help-gnu-emacs@gnu.org>
@ 2012-04-20  0:04   ` BDB
  2012-04-20  2:05     ` Drew Adams
  0 siblings, 1 reply; 10+ messages in thread
From: BDB @ 2012-04-20  0:04 UTC (permalink / raw)
  To: help-gnu-emacs

Drew Adams wrote:
> Use `indent-rigidly' with the value of `tab-width'?
>
> (defun my-indent-a-tab-width (start end)
>   (interactive "r")
>   (indent-rigidly start end tab-width))

Works great, thanks!  You wouldn't happen to know a way to do the inverse,
delete 4 spaces from the beginning of each line in a region?


^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: Indent region by one tabstop
  2012-04-20  0:04   ` BDB
@ 2012-04-20  2:05     ` Drew Adams
  0 siblings, 0 replies; 10+ messages in thread
From: Drew Adams @ 2012-04-20  2:05 UTC (permalink / raw)
  To: 'BDB', help-gnu-emacs

> > Use `indent-rigidly' with the value of `tab-width'?
> >
> > (defun my-indent-a-tab-width (start end)
> >   (interactive "r")
> >   (indent-rigidly start end tab-width))
> 
> Works great, thanks!  You wouldn't happen to know a way to do 
> the inverse,
> delete 4 spaces from the beginning of each line in a region?

Same function, `indent-rigidly', but with a negative argument.

C-h f indent-rigidly




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Indent region by one tabstop
  2012-04-19 22:00 Indent region by one tabstop BDB
  2012-04-19 23:19 ` Drew Adams
       [not found] ` <mailman.262.1334877565.751.help-gnu-emacs@gnu.org>
@ 2012-04-20  2:09 ` Jambunathan K
  2012-04-20  3:07 ` Teemu Likonen
  2012-04-20 22:48 ` Mark Skilbeck
  4 siblings, 0 replies; 10+ messages in thread
From: Jambunathan K @ 2012-04-20  2:09 UTC (permalink / raw)
  To: BDB; +Cc: help-gnu-emacs

BDB <noemail@yahoo.com> writes:

> Is there a way to make emacs move a region of code left or right by one
> tabstop?  I don't want to use emacs' built in indentation because it's
> not indenting the lines where I want them to be.

You can also try

C-h K C-x r o
C-h K C-x r k

Btw, it takes some time to get used to rectangle editing.
--



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Indent region by one tabstop
  2012-04-19 22:00 Indent region by one tabstop BDB
                   ` (2 preceding siblings ...)
  2012-04-20  2:09 ` Jambunathan K
@ 2012-04-20  3:07 ` Teemu Likonen
  2012-04-21  6:16   ` Andreas Röhler
  2012-04-20 22:48 ` Mark Skilbeck
  4 siblings, 1 reply; 10+ messages in thread
From: Teemu Likonen @ 2012-04-20  3:07 UTC (permalink / raw)
  To: BDB; +Cc: help-gnu-emacs

* BDB [2012-04-19 22:00:56 +0000] wrote:

> Is there a way to make emacs move a region of code left or right by
> one tabstop? I don't want to use emacs' built in indentation because
> it's not indenting the lines where I want them to be.

Here's my proposed improvement:

http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8196



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Indent region by one tabstop
  2012-04-19 22:00 Indent region by one tabstop BDB
                   ` (3 preceding siblings ...)
  2012-04-20  3:07 ` Teemu Likonen
@ 2012-04-20 22:48 ` Mark Skilbeck
  4 siblings, 0 replies; 10+ messages in thread
From: Mark Skilbeck @ 2012-04-20 22:48 UTC (permalink / raw)
  To: BDB; +Cc: help-gnu-emacs

On Thu, Apr 19, 2012 at 10:00:56PM +0000, BDB wrote:
> Is there a way to make emacs move a region of code left or right by one
> tabstop?  I don't want to use emacs' built in indentation because it's
> not indenting the lines where I want them to be.

You might want to take a look at replace-rectangle. For example, mark a region
from in the first column of the first lane to the first column of the last line.
Then, using replace-rectangle, insert a tab.

- mgsk.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Indent region by one tabstop
  2012-04-20  3:07 ` Teemu Likonen
@ 2012-04-21  6:16   ` Andreas Röhler
  2012-04-21  7:01     ` Teemu Likonen
  0 siblings, 1 reply; 10+ messages in thread
From: Andreas Röhler @ 2012-04-21  6:16 UTC (permalink / raw)
  To: help-gnu-emacs

Am 20.04.2012 05:07, schrieb Teemu Likonen:
> * BDB [2012-04-19 22:00:56 +0000] wrote:
>
>> Is there a way to make emacs move a region of code left or right by
>> one tabstop? I don't want to use emacs' built in indentation because
>> it's not indenting the lines where I want them to be.
>
> Here's my proposed improvement:
>
> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8196
>
>

what about binding that at `indent-tabs-mode'?

Andreas




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Indent region by one tabstop
  2012-04-21  6:16   ` Andreas Röhler
@ 2012-04-21  7:01     ` Teemu Likonen
  2012-04-21  7:30       ` Andreas Röhler
  0 siblings, 1 reply; 10+ messages in thread
From: Teemu Likonen @ 2012-04-21  7:01 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: help-gnu-emacs

* Andreas Röhler [2012-04-21 08:16:14 +0200] wrote:

> Am 20.04.2012 05:07, schrieb Teemu Likonen:
>> Here's my proposed improvement:
>>
>> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8196

> what about binding that at `indent-tabs-mode'?

Since my "tl-indent-region" supersedes "indent-rigidly" I just bind it
globally to "C-x TAB". Technically it has all the features of
"indent-rigidly".

But you could add your suggestion to the bug report (#8196).



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Indent region by one tabstop
  2012-04-21  7:01     ` Teemu Likonen
@ 2012-04-21  7:30       ` Andreas Röhler
  0 siblings, 0 replies; 10+ messages in thread
From: Andreas Röhler @ 2012-04-21  7:30 UTC (permalink / raw)
  To: Teemu Likonen; +Cc: help-gnu-emacs

Am 21.04.2012 09:01, schrieb Teemu Likonen:
> * Andreas Röhler [2012-04-21 08:16:14 +0200] wrote:
>
>> Am 20.04.2012 05:07, schrieb Teemu Likonen:
>>> Here's my proposed improvement:
>>>
>>> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8196
>
>> what about binding that at `indent-tabs-mode'?
>
> Since my "tl-indent-region" supersedes "indent-rigidly" I just bind it
> globally to "C-x TAB". Technically it has all the features of
> "indent-rigidly".
>
> But you could add your suggestion to the bug report (#8196).
>

yes, will do that.

BTW I'm concerned it the default just changes, bug-reports resp. feature requests will drop in from the other side than.

Cheers,



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-04-21  7:30 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-19 22:00 Indent region by one tabstop BDB
2012-04-19 23:19 ` Drew Adams
     [not found] ` <mailman.262.1334877565.751.help-gnu-emacs@gnu.org>
2012-04-20  0:04   ` BDB
2012-04-20  2:05     ` Drew Adams
2012-04-20  2:09 ` Jambunathan K
2012-04-20  3:07 ` Teemu Likonen
2012-04-21  6:16   ` Andreas Röhler
2012-04-21  7:01     ` Teemu Likonen
2012-04-21  7:30       ` Andreas Röhler
2012-04-20 22:48 ` Mark Skilbeck

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).