all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Indent region with prefix
@ 2008-01-16 18:56 Chris L
  2008-01-16 20:08 ` Stephen Berman
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Chris L @ 2008-01-16 18:56 UTC (permalink / raw)
  To: help-gnu-emacs

If I have these lines:

There once was a geek from Nantucket
who counted his loops in a bucket.
But then he found Perl,
his hair started to curl,
and his slide rule fell out of his pucket.

And I want to transform them as quickly as possible to:

> There once was a geek from Nantucket
> who counted his loops in a bucket.
> But then he found Perl,
> his hair started to curl,
> and his slide rule fell out of his pucket.

What do I do? I'm not in Gnus or email mode, this is for Markdown
text. Right now I am using a keyboard macro, but it seems like there
should be a simple bit of magic to accomplish this, since it is so
similar to commenting.

c

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

* Re: Indent region with prefix
  2008-01-16 18:56 Indent region with prefix Chris L
@ 2008-01-16 20:08 ` Stephen Berman
  2008-01-16 20:17 ` David Golden
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Stephen Berman @ 2008-01-16 20:08 UTC (permalink / raw)
  To: help-gnu-emacs

On Wed, 16 Jan 2008 10:56:09 -0800 (PST) Chris L <Chris.Lott@gmail.com> wrote:

> If I have these lines:
>
> There once was a geek from Nantucket
> who counted his loops in a bucket.
> But then he found Perl,
> his hair started to curl,
> and his slide rule fell out of his pucket.
>
> And I want to transform them as quickly as possible to:
>
>> There once was a geek from Nantucket
>> who counted his loops in a bucket.
>> But then he found Perl,
>> his hair started to curl,
>> and his slide rule fell out of his pucket.

Mark the region to be indented and then type C-x r t (string-rectangle).

Steve Berman

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

* Re: Indent region with prefix
  2008-01-16 18:56 Indent region with prefix Chris L
  2008-01-16 20:08 ` Stephen Berman
@ 2008-01-16 20:17 ` David Golden
  2008-01-16 21:12 ` Andrea Vettorello
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: David Golden @ 2008-01-16 20:17 UTC (permalink / raw)
  To: help-gnu-emacs

Chris L wrote:

 
> What do I do? I'm not in Gnus or email mode, this is for Markdown
> text. Right now I am using a keyboard macro, but it seems like there
> should be a simple bit of magic to accomplish this, since it is so
> similar to commenting.
> 
> c


Note that there is a full-featured markdown-mode for emacs which
provides blockquote formatting (C-c C-s b with region active):
http://jblevins.org/projects/markdown-mode/  
though I've never used it personally.


If you're just in Text mode, say, and not saying it's the best way, but
a very quick way to do it is:

Have a line containing "> ", place point just after. Hit "C-x ."   
(That's set-fill-prefix).

indent-region uses the fill-prefix if it's set, so now set the region 
to the lines you want prefixed,   and hit C-M-\    
(that's indent-region).   The indent will insert "> " for you.

That also means that you can M-x fill-region  (rewrap) the 
"> " prefixed text, and fill-region will keep the prefixes 
where they're supposed to be while fill-prefix is set.

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

* Re: Indent region with prefix
  2008-01-16 18:56 Indent region with prefix Chris L
  2008-01-16 20:08 ` Stephen Berman
  2008-01-16 20:17 ` David Golden
@ 2008-01-16 21:12 ` Andrea Vettorello
  2008-01-16 21:17 ` Scott Frazer
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Andrea Vettorello @ 2008-01-16 21:12 UTC (permalink / raw)
  To: help-gnu-emacs

On Jan 16, 2008 7:56 PM, Chris L <Chris.Lott@gmail.com> wrote:
> If I have these lines:
>
> There once was a geek from Nantucket
> who counted his loops in a bucket.
> But then he found Perl,
> his hair started to curl,
> and his slide rule fell out of his pucket.
>
> And I want to transform them as quickly as possible to:
>
> > There once was a geek from Nantucket
> > who counted his loops in a bucket.
> > But then he found Perl,
> > his hair started to curl,
> > and his slide rule fell out of his pucket.
>
> What do I do? I'm not in Gnus or email mode, this is for Markdown
> text. Right now I am using a keyboard macro, but it seems like there
> should be a simple bit of magic to accomplish this, since it is so
> similar to commenting.

With cursor on the first line i would run cua-set-rectangle-mark (i
don't know the default keybind, here it's M-Enter), select the first
row (C-u C-n) then insert "> ", it will be replicated on the
rectangular region.


-- 
Andrea

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

* Re: Indent region with prefix
  2008-01-16 18:56 Indent region with prefix Chris L
                   ` (2 preceding siblings ...)
  2008-01-16 21:12 ` Andrea Vettorello
@ 2008-01-16 21:17 ` Scott Frazer
       [not found] ` <mailman.6204.1200517983.18990.help-gnu-emacs@gnu.org>
  2008-01-17  8:23 ` Giorgos Keramidas
  5 siblings, 0 replies; 7+ messages in thread
From: Scott Frazer @ 2008-01-16 21:17 UTC (permalink / raw)
  To: help-gnu-emacs

Chris L wrote:
> If I have these lines:
> 
> There once was a geek from Nantucket
> who counted his loops in a bucket.
> But then he found Perl,
> his hair started to curl,
> and his slide rule fell out of his pucket.
> 
> And I want to transform them as quickly as possible to:
> 
>> There once was a geek from Nantucket
>> who counted his loops in a bucket.
>> But then he found Perl,
>> his hair started to curl,
>> and his slide rule fell out of his pucket.
> 
> What do I do? I'm not in Gnus or email mode, this is for Markdown
> text. Right now I am using a keyboard macro, but it seems like there
> should be a simple bit of magic to accomplish this, since it is so
> similar to commenting.
> 

C-space at the beginning to set the mark, go past the last line and
M-x string-insert-rectangle > SPACE RET

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

* Re: Indent region with prefix
       [not found] ` <mailman.6204.1200517983.18990.help-gnu-emacs@gnu.org>
@ 2008-01-17  0:15   ` Exal de Jesus Garcia Carrillo
  0 siblings, 0 replies; 7+ messages in thread
From: Exal de Jesus Garcia Carrillo @ 2008-01-17  0:15 UTC (permalink / raw)
  To: help-gnu-emacs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andrea Vettorello em gnu.emacs.help escreveu :

>
> With cursor on the first line i would run cua-set-rectangle-mark (i
> don't know the default keybind, here it's M-Enter)



C-h f cua-set-rectangle-mark RET says <C-return>.


- -- 
Spam protection: 
In my e-mail replace the words `no-spam' with `exal'.


.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8+ <http://mailcrypt.sourceforge.net/>

iD8DBQFHjp4woZmxoVJRtGIRAgO0AJ4sATsMrmU5pUdTluo/2dqMjdWF5wCfdV38
vnSS+PtHSs40aiOza+xYVsU=
=lQez
-----END PGP SIGNATURE-----

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

* Re: Indent region with prefix
  2008-01-16 18:56 Indent region with prefix Chris L
                   ` (4 preceding siblings ...)
       [not found] ` <mailman.6204.1200517983.18990.help-gnu-emacs@gnu.org>
@ 2008-01-17  8:23 ` Giorgos Keramidas
  5 siblings, 0 replies; 7+ messages in thread
From: Giorgos Keramidas @ 2008-01-17  8:23 UTC (permalink / raw)
  To: help-gnu-emacs

On Wed, 16 Jan 2008 10:56:09 -0800 (PST), Chris L <Chris.Lott@gmail.com> wrote:
> If I have these lines:
>
> There once was a geek from Nantucket
> who counted his loops in a bucket.
> But then he found Perl,
> his hair started to curl,
> and his slide rule fell out of his pucket.
>
> And I want to transform them as quickly as possible to:
>
>> There once was a geek from Nantucket
>> who counted his loops in a bucket.
>> But then he found Perl,
>> his hair started to curl,
>> and his slide rule fell out of his pucket.
>
> What do I do? I'm not in Gnus or email mode, this is for Markdown
> text. Right now I am using a keyboard macro, but it seems like there
> should be a simple bit of magic to accomplish this, since it is so
> similar to commenting.

You already have a fair number of suggestions in this thread, but in
this case it's also simple to:

  1. Mark the region
  2. M-x replace-regexp RET ^ RET > SPC RET

The string-rectangle command is my favorite for anything more complex
than a simple regexp can do.

HTH,
Giorgos

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

end of thread, other threads:[~2008-01-17  8:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-16 18:56 Indent region with prefix Chris L
2008-01-16 20:08 ` Stephen Berman
2008-01-16 20:17 ` David Golden
2008-01-16 21:12 ` Andrea Vettorello
2008-01-16 21:17 ` Scott Frazer
     [not found] ` <mailman.6204.1200517983.18990.help-gnu-emacs@gnu.org>
2008-01-17  0:15   ` Exal de Jesus Garcia Carrillo
2008-01-17  8:23 ` Giorgos Keramidas

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.