* keyboard macro question
@ 2009-10-02 14:05 Benjamin
2009-10-02 14:15 ` Joost Kremers
` (4 more replies)
0 siblings, 5 replies; 12+ messages in thread
From: Benjamin @ 2009-10-02 14:05 UTC (permalink / raw)
To: help-gnu-emacs
I use keyboard macros fairly frequently, but I often run into a
situation where I would like to increment a number in the macro, e.g.,
if I start with:
tmp tmp tmp tmp
and I want to end with:
tmp1
tmp2
tmp3
tmp4
I know how to create the macro where it would result in:
tmp1
tmp1
tmp1
tmp1
Is there a way to make the number increment each time the macro is
executed?
Otherwise I am forced to step down through each line and manually put
the numbers in 1, 2, 3, 4, ...
Naturally this is a greatly shortened example for illustration
purposes, and often the incrementing takes place within a longer
statement e.g., tmp(:,1) = function(x,y). My interest here is how to
increment or decrement the number in a more automatic fashion.
I don't mind doing something other than macros, or even external
commands (perl/sed/awk, etc.)
to assist with this.
Thanks,
-Ben
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: keyboard macro question
2009-10-02 14:05 keyboard macro question Benjamin
@ 2009-10-02 14:15 ` Joost Kremers
2009-10-02 14:34 ` David Kastrup
` (3 subsequent siblings)
4 siblings, 0 replies; 12+ messages in thread
From: Joost Kremers @ 2009-10-02 14:15 UTC (permalink / raw)
To: help-gnu-emacs
Benjamin wrote:
> I use keyboard macros fairly frequently, but I often run into a
> situation where I would like to increment a number in the macro, e.g.,
you might start by checking out the documentation on keyboard macros:
(info "(emacs) Keyboard Macros")
--
Joost Kremers joostkremers@yahoo.com
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: keyboard macro question
2009-10-02 14:05 keyboard macro question Benjamin
2009-10-02 14:15 ` Joost Kremers
@ 2009-10-02 14:34 ` David Kastrup
2009-10-02 14:54 ` jbenjam
2009-10-02 14:50 ` Colin S. Miller
` (2 subsequent siblings)
4 siblings, 1 reply; 12+ messages in thread
From: David Kastrup @ 2009-10-02 14:34 UTC (permalink / raw)
To: help-gnu-emacs
Benjamin <jbenjam@gmail.com> writes:
> I use keyboard macros fairly frequently, but I often run into a
> situation where I would like to increment a number in the macro, e.g.,
> if I start with:
>
> tmp tmp tmp tmp
>
> and I want to end with:
> tmp1
> tmp2
> tmp3
> tmp4
>
> I don't mind doing something other than macros, or even external
> commands (perl/sed/awk, etc.)
> to assist with this.
C-M-% tmp SPC RET tmp\,(1+ \#) C-q C-j RET
--
David Kastrup
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: keyboard macro question
2009-10-02 14:05 keyboard macro question Benjamin
2009-10-02 14:15 ` Joost Kremers
2009-10-02 14:34 ` David Kastrup
@ 2009-10-02 14:50 ` Colin S. Miller
2009-10-02 18:12 ` Harry Putnam
2009-10-03 2:04 ` Eric
[not found] ` <d9407676-bb83-46a4-9804-0450cc190b59@v37g2000prg.googlegroups.com>
4 siblings, 1 reply; 12+ messages in thread
From: Colin S. Miller @ 2009-10-02 14:50 UTC (permalink / raw)
To: help-gnu-emacs
Benjamin wrote:
> I use keyboard macros fairly frequently, but I often run into a
> situation where I would like to increment a number in the macro, e.g.,
> if I start with:
>
> tmp tmp tmp tmp
>
> and I want to end with:
> tmp1
> tmp2
> tmp3
> tmp4
>
Benjamin,
These functions are useful for this situation
C-u 1 C-x r n a (number-to-register a)
C-x r i a (insert-register a)
C-x r + a (increment-register a)
HTH,
Colin S. Miller
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: keyboard macro question
2009-10-02 14:34 ` David Kastrup
@ 2009-10-02 14:54 ` jbenjam
0 siblings, 0 replies; 12+ messages in thread
From: jbenjam @ 2009-10-02 14:54 UTC (permalink / raw)
To: help-gnu-emacs
On Oct 2, 10:34 am, David Kastrup <d...@gnu.org> wrote:
>
> C-M-% tmp SPC RET tmp\,(1+ \#) C-q C-j RET
>
Thanks David, I knew it was something relatively simple.
Happy Friday,
-Ben
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: keyboard macro question
2009-10-02 14:50 ` Colin S. Miller
@ 2009-10-02 18:12 ` Harry Putnam
2009-10-02 20:15 ` Tassilo Horn
0 siblings, 1 reply; 12+ messages in thread
From: Harry Putnam @ 2009-10-02 18:12 UTC (permalink / raw)
To: help-gnu-emacs
"Colin S. Miller" <no-spam-thank-you@csmiller.demon.co.uk> writes:
>
> Benjamin,
> These functions are useful for this situation
> C-u 1 C-x r n a (number-to-register a)
> C-x r i a (insert-register a)
> C-x r + a (increment-register a)
I wondered if you could show an example of how this works in a
macro... when I try, it just continues to insert 1.
To reproduce:
Create macro of:
C-u 1 C-x r n a
C-x r i a
C-x r + a
then walk down this column inserting the macro
str
str
str
str
By running the macro at the end of each line, I get:
str1
str1
str1
str1
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: keyboard macro question
2009-10-02 18:12 ` Harry Putnam
@ 2009-10-02 20:15 ` Tassilo Horn
0 siblings, 0 replies; 12+ messages in thread
From: Tassilo Horn @ 2009-10-02 20:15 UTC (permalink / raw)
To: help-gnu-emacs
Harry Putnam <reader@newsguy.com> writes:
Hi Harry,
> To reproduce:
> Create macro of:
> C-u 1 C-x r n a
> C-x r i a
> C-x r + a
The first part (setting register a to 1) must not be part of the macro,
but must be done beforehand. Else, each time the macro executes,
register a will be set to 1, then you insert the 1, and then you
increment it to 2.
So here's how to do it:
C-u 1 C-x r n a ;; Set register a to 1
F3 ;; Start definition of a macro
C-x r i a ;; insert value of register a
C-x r + a ;; Increment register a
F4 ;; End macro definition
Then any additional F4 will insert 2, 3, 4, 5, 6, ...
Bye,
Tassilo
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: keyboard macro question
2009-10-02 14:05 keyboard macro question Benjamin
` (2 preceding siblings ...)
2009-10-02 14:50 ` Colin S. Miller
@ 2009-10-03 2:04 ` Eric
[not found] ` <d9407676-bb83-46a4-9804-0450cc190b59@v37g2000prg.googlegroups.com>
4 siblings, 0 replies; 12+ messages in thread
From: Eric @ 2009-10-03 2:04 UTC (permalink / raw)
To: help-gnu-emacs
On Oct 2, 10:05 pm, Benjamin <jben...@gmail.com> wrote:
> I use keyboard macros fairly frequently, but I often run into a
> situation where I would like to increment a number in the macro, e.g.,
> if I start with:
Keyboard Macro Counters! That's what they're there for:
http://www.gnu.org/software/emacs/manual/html_node/emacs/Keyboard-Macro-Counter.html
Eric
>
> tmp tmp tmp tmp
>
> and I want to end with:
> tmp1
> tmp2
> tmp3
> tmp4
>
> I know how to create the macro where it would result in:
> tmp1
> tmp1
> tmp1
> tmp1
>
> Is there a way to make the number increment each time the macro is
> executed?
> Otherwise I am forced to step down through each line and manually put
> the numbers in 1, 2, 3, 4, ...
> Naturally this is a greatly shortened example for illustration
> purposes, and often the incrementing takes place within a longer
> statement e.g., tmp(:,1) = function(x,y). My interest here is how to
> increment or decrement the number in a more automatic fashion.
>
> I don't mind doing something other than macros, or even external
> commands (perl/sed/awk, etc.)
> to assist with this.
>
> Thanks,
> -Ben
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: keyboard macro question
[not found] ` <d9407676-bb83-46a4-9804-0450cc190b59@v37g2000prg.googlegroups.com>
@ 2009-10-18 1:46 ` David Combs
2009-10-18 17:40 ` Xah Lee
0 siblings, 1 reply; 12+ messages in thread
From: David Combs @ 2009-10-18 1:46 UTC (permalink / raw)
To: help-gnu-emacs
In article <d9407676-bb83-46a4-9804-0450cc190b59@v37g2000prg.googlegroups.com>,
Xah Lee <xahlee@gmail.com> wrote:
Please -- I know you love your nice control-chars your posts
always include, but it sure makes it near IMPOSSIBLE for us
to read, or especially to NICELY save, them.
Suggestion:
Each post you make, DOUBLE it: first part "your way", then
a dashed line or lines, then again, but without that stuff
in it. Just plain ascii, minus any within-line control-chars.
(Presumably you take the trouble to write your posts, to think
them through, etc, because you want us to READ them, to BENEFIT
from them, perhaps to even SAVE them. Seems to me that it would
thus be to YOUR benefit to make them as easy as possible to read,
and likewise to save away, maybe even for OTHERS to read (attributed
to you, of course).)
Thanks for at least considering the above.
David
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: keyboard macro question
2009-10-18 1:46 ` David Combs
@ 2009-10-18 17:40 ` Xah Lee
2009-11-12 3:12 ` David Combs
0 siblings, 1 reply; 12+ messages in thread
From: Xah Lee @ 2009-10-18 17:40 UTC (permalink / raw)
To: help-gnu-emacs
On Oct 17, 6:46 pm, dkco...@panix.com (David Combs) wrote:
> In article <d9407676-bb83-46a4-9804-0450cc190...@v37g2000prg.googlegroups.com>,
> Xah Lee <xah...@gmail.com> wrote:
>
> Please -- I know you love your nice control-chars your posts
> always include, but it sure makes it near IMPOSSIBLE for us
> to read, or especially to NICELY save, them.
>
> Suggestion:
>
> Each post you make, DOUBLE it: first part "your way", then
> a dashed line or lines, then again, but without that stuff
> in it. Just plain ascii, minus any within-line control-chars.
>
> (Presumably you take the trouble to write your posts, to think
> them through, etc, because you want us to READ them, to BENEFIT
> from them, perhaps to even SAVE them. Seems to me that it would
> thus be to YOUR benefit to make them as easy as possible to read,
> and likewise to save away, maybe even for OTHERS to read (attributed
> to you, of course).)
>
> Thanks for at least considering the above.
Hi David,
was it you who wrote me at least twice about this issue in the past in
separate times?
If i didn't recall incorrectly, i never got any reasons what is the
problem.
The "control chars" you mention, are unicode characters, and pretty
standard ones, such as curly quotes and bullets.
I wrote all my posts using just emacs, and they show correctly in just
about all web browsers from groups.google.com. There is no problem in
copy and pasting them, nor can i imagine there any problem in saving
them as file, in any of Windows, Mac, or linux. the encoding used is
utf-8, default in mac, linuxes, and fully supported Windows.
unicode is charset in langs like xml, java... etc.
can you be explicit exactly what is the problem? is it some news
reader that does not support unicode? i haven't tried, but it'd be a
major shame if u telling me emacs+gnus or Mozilla's Thunderbird does
not support unicode out of the box?
Xah
∑ http://xahlee.org/
☄
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: keyboard macro question
2009-10-18 17:40 ` Xah Lee
@ 2009-11-12 3:12 ` David Combs
2009-11-13 18:36 ` Lars Enderin
0 siblings, 1 reply; 12+ messages in thread
From: David Combs @ 2009-11-12 3:12 UTC (permalink / raw)
To: help-gnu-emacs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2418 bytes --]
In article <cd68dc3d-ccfa-48a0-bbac-8bc923e38bd5@u16g2000pru.googlegroups.com>,
Xah Lee <xahlee@gmail.com> wrote:
>On Oct 17, 6:46 pm, dkco...@panix.com (David Combs) wrote:
>> In article <d9407676-bb83-46a4-9804-0450cc190...@v37g2000prg.googlegroups.com>,
>> Xah Lee <xah...@gmail.com> wrote:
>>
>> Please -- I know you love your nice control-chars your posts
>> always include, but it sure makes it near IMPOSSIBLE for us
>> to read, or especially to NICELY save, them.
>>
>> Suggestion:
>>
>> Each post you make, DOUBLE it: first part "your way", then
>> a dashed line or lines, then again, but without that stuff
>> in it. Just plain ascii, minus any within-line control-chars.
>>
>> (Presumably you take the trouble to write your posts, to think
>> them through, etc, because you want us to READ them, to BENEFIT
>> from them, perhaps to even SAVE them. Seems to me that it would
>> thus be to YOUR benefit to make them as easy as possible to read,
>> and likewise to save away, maybe even for OTHERS to read (attributed
>> to you, of course).)
>>
>> Thanks for at least considering the above.
>
>Hi David,
>
>was it you who wrote me at least twice about this issue in the past in
>separate times?
>
>If i didn't recall incorrectly, i never got any reasons what is the
>problem.
>
>The "control chars" you mention, are unicode characters, and pretty
>standard ones, such as curly quotes and bullets.
>
>I wrote all my posts using just emacs, and they show correctly in just
>about all web browsers from groups.google.com. There is no problem in
>copy and pasting them, nor can i imagine there any problem in saving
>them as file, in any of Windows, Mac, or linux. the encoding used is
>utf-8, default in mac, linuxes, and fully supported Windows.
>
>unicode is charset in langs like xml, java... etc.
>
>can you be explicit exactly what is the problem? is it some news
>reader that does not support unicode? i haven't tried, but it'd be a
>major shame if u telling me emacs+gnus or Mozilla's Thunderbird does
>not support unicode out of the box?
>
> Xah
>∑ http://xahlee.org/
>
>☄
You're writing for a web-browser?
I don't use a web-browser for newsgroups -- I use "trn4".
And with that, your unicode orwhatever looks pretty bad,
unreadable in some cases.
How about writing for just plain old ascii terminals, eg
adm3a or vt-100 -- isn't that the working assumption for
newsgroup text?
David
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: keyboard macro question
2009-11-12 3:12 ` David Combs
@ 2009-11-13 18:36 ` Lars Enderin
0 siblings, 0 replies; 12+ messages in thread
From: Lars Enderin @ 2009-11-13 18:36 UTC (permalink / raw)
To: help-gnu-emacs
David Combs wrote:
>
> You're writing for a web-browser?
Thunderbird is a mail and news client, not a browser, although it can
show HTML-formatted messages.
> I don't use a web-browser for newsgroups -- I use "trn4".
You should upgrade, or accept being left behind,
> And with that, your unicode orwhatever looks pretty bad,
> unreadable in some cases.
Unicode is not necessary in Usenet posts, I'll give you that, but I hope
that you won't insist on 7-bit us-ascii text. That is too US-parochial.
I use ISO-8859-1 (ISO Latin 1) because I need it for my Swedish alphabet
(a-z plus åäö, mostly), but Thunderbird is capable of showing Unicode
if necessary. Most modern Linuxes, e g Ubuntu, use UTF-8 by default, by
the way.
> How about writing for just plain old ascii terminals, eg
> adm3a or vt-100 -- isn't that the working assumption for
> newsgroup text?
That is too limiting.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2009-11-13 18:36 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-02 14:05 keyboard macro question Benjamin
2009-10-02 14:15 ` Joost Kremers
2009-10-02 14:34 ` David Kastrup
2009-10-02 14:54 ` jbenjam
2009-10-02 14:50 ` Colin S. Miller
2009-10-02 18:12 ` Harry Putnam
2009-10-02 20:15 ` Tassilo Horn
2009-10-03 2:04 ` Eric
[not found] ` <d9407676-bb83-46a4-9804-0450cc190b59@v37g2000prg.googlegroups.com>
2009-10-18 1:46 ` David Combs
2009-10-18 17:40 ` Xah Lee
2009-11-12 3:12 ` David Combs
2009-11-13 18:36 ` Lars Enderin
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).