all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Calling macro by name while defining another macro
@ 2018-03-21 22:35 John Shahid
  2018-03-22 13:53 ` Stefan Monnier
  2018-03-22 15:00 ` Eli Zaretskii
  0 siblings, 2 replies; 10+ messages in thread
From: John Shahid @ 2018-03-21 22:35 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list


Hi all,

I cannot seem to figure out how to call a macro by name from another
macro. Simply doing the following causes the macro to be called twice as
part of the second macro.

1. define macro using `C-x ('
2. finish the macro `C-x )'
3. name the macro `some-macro' using `name-last-kbd-macro'
4. define another macro using `C-x ('
5. call `some-macro' using `M-x some-macro' (some-macro called once)
6. finish macro editing using `C-x )'
7. call the macro again using `C-x e' (effects of `some-macro' are
applied twice)

From looking the new macro definition. It looks like the call to
`some-macro' as well as its keys are being recorded as part of the newly
defined macro. I cannot figure out how to temporarily stop that
recording from happening. Should I use something instead of `M-x' to
call `some-macro' ?

Thanks,

-js



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

* Re: Calling macro by name while defining another macro
  2018-03-21 22:35 Calling macro by name while defining another macro John Shahid
@ 2018-03-22 13:53 ` Stefan Monnier
  2018-03-22 15:12   ` Robert Pluim
  2018-03-22 15:00 ` Eli Zaretskii
  1 sibling, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2018-03-22 13:53 UTC (permalink / raw)
  To: help-gnu-emacs

> 1. define macro using `C-x ('
> 2. finish the macro `C-x )'
> 3. name the macro `some-macro' using `name-last-kbd-macro'
> 4. define another macro using `C-x ('
> 5. call `some-macro' using `M-x some-macro' (some-macro called once)
> 6. finish macro editing using `C-x )'
> 7. call the macro again using `C-x e' (effects of `some-macro' are
> applied twice)

Sounds like a bug.


        Stefan




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

* Re: Calling macro by name while defining another macro
  2018-03-21 22:35 Calling macro by name while defining another macro John Shahid
  2018-03-22 13:53 ` Stefan Monnier
@ 2018-03-22 15:00 ` Eli Zaretskii
  2018-03-22 15:52   ` John Shahid
  1 sibling, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2018-03-22 15:00 UTC (permalink / raw)
  To: help-gnu-emacs

> From: John Shahid <jvshahid@gmail.com>
> Date: Wed, 21 Mar 2018 18:35:02 -0400
> 
> 
> 1. define macro using `C-x ('
> 2. finish the macro `C-x )'
> 3. name the macro `some-macro' using `name-last-kbd-macro'
> 4. define another macro using `C-x ('
> 5. call `some-macro' using `M-x some-macro' (some-macro called once)
> 6. finish macro editing using `C-x )'
> 7. call the macro again using `C-x e' (effects of `some-macro' are
> applied twice)

I seem to be unable to reproduce this in Emacs 26.0.91.  Which version
of Emacs did you see this in?



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

* Re: Calling macro by name while defining another macro
  2018-03-22 13:53 ` Stefan Monnier
@ 2018-03-22 15:12   ` Robert Pluim
  2018-03-22 15:47     ` Stefan Monnier
  0 siblings, 1 reply; 10+ messages in thread
From: Robert Pluim @ 2018-03-22 15:12 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: help-gnu-emacs

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> 1. define macro using `C-x ('
>> 2. finish the macro `C-x )'
>> 3. name the macro `some-macro' using `name-last-kbd-macro'
>> 4. define another macro using `C-x ('
>> 5. call `some-macro' using `M-x some-macro' (some-macro called once)
>> 6. finish macro editing using `C-x )'
>> 7. call the macro again using `C-x e' (effects of `some-macro' are
>> applied twice)
>
> Sounds like a bug.

How so? The macro is faithfully recording all the keystrokes, which is
both literally 'M-x some-macro' and the keystrokes output by running
that macro.

As a workaround, you could edit the second macro after defining it to
remove the bits you don't want, but that does go against the
ease-of-use intent of macros.

Robert



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

* Re: Calling macro by name while defining another macro
  2018-03-22 15:12   ` Robert Pluim
@ 2018-03-22 15:47     ` Stefan Monnier
  2018-03-22 15:56       ` Eli Zaretskii
  2018-03-22 15:56       ` Robert Pluim
  0 siblings, 2 replies; 10+ messages in thread
From: Stefan Monnier @ 2018-03-22 15:47 UTC (permalink / raw)
  To: help-gnu-emacs

> How so? The macro is faithfully recording all the keystrokes, which is
> both literally 'M-x some-macro' and the keystrokes output by running
> that macro.

The keystrokes output by running the macro shouldn't be recorded.


        Stefan



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

* Re: Calling macro by name while defining another macro
  2018-03-22 15:00 ` Eli Zaretskii
@ 2018-03-22 15:52   ` John Shahid
  2018-03-22 15:59     ` Stefan Monnier
  0 siblings, 1 reply; 10+ messages in thread
From: John Shahid @ 2018-03-22 15:52 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs


Eli Zaretskii <eliz@gnu.org> writes:

>> From: John Shahid <jvshahid@gmail.com>
>> Date: Wed, 21 Mar 2018 18:35:02 -0400
>>
>>
>> 1. define macro using `C-x ('
>> 2. finish the macro `C-x )'
>> 3. name the macro `some-macro' using `name-last-kbd-macro'
>> 4. define another macro using `C-x ('
>> 5. call `some-macro' using `M-x some-macro' (some-macro called once)
>> 6. finish macro editing using `C-x )'
>> 7. call the macro again using `C-x e' (effects of `some-macro' are
>> applied twice)
>
> I seem to be unable to reproduce this in Emacs 26.0.91.  Which version
> of Emacs did you see this in?


I thought I was on emacs-26 but apparently I was using emacs-25.2.1. I
am unable to reproduce this issue on either master or emacs-26. That
said, I don't see this mentioned in the NEWS, was it accidentally fixed
?



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

* Re: Calling macro by name while defining another macro
  2018-03-22 15:47     ` Stefan Monnier
@ 2018-03-22 15:56       ` Eli Zaretskii
  2018-03-22 15:56       ` Robert Pluim
  1 sibling, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2018-03-22 15:56 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Stefan Monnier <monnier@IRO.UMontreal.CA>
> Date: Thu, 22 Mar 2018 11:47:25 -0400
> 
> > How so? The macro is faithfully recording all the keystrokes, which is
> > both literally 'M-x some-macro' and the keystrokes output by running
> > that macro.
> 
> The keystrokes output by running the macro shouldn't be recorded.

I believe this problem is already solved for Emacs 26, because I can
reproduce it in Emacs 25.2, but not in Emacs 26.0.91.



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

* Re: Calling macro by name while defining another macro
  2018-03-22 15:47     ` Stefan Monnier
  2018-03-22 15:56       ` Eli Zaretskii
@ 2018-03-22 15:56       ` Robert Pluim
  1 sibling, 0 replies; 10+ messages in thread
From: Robert Pluim @ 2018-03-22 15:56 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: help-gnu-emacs

Stefan Monnier <monnier@IRO.UMontreal.CA> writes:

>> How so? The macro is faithfully recording all the keystrokes, which is
>> both literally 'M-x some-macro' and the keystrokes output by running
>> that macro.
>
> The keystrokes output by running the macro shouldn't be recorded.

D'oh. Of course. The *user* didn't type those.



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

* Re: Calling macro by name while defining another macro
  2018-03-22 15:52   ` John Shahid
@ 2018-03-22 15:59     ` Stefan Monnier
  2018-03-22 17:47       ` John Shahid
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2018-03-22 15:59 UTC (permalink / raw)
  To: help-gnu-emacs

> I thought I was on emacs-26 but apparently I was using emacs-25.2.1. I
> am unable to reproduce this issue on either master or emacs-26.  That
> said, I don't see this mentioned in the NEWS, was it accidentally fixed?

NEWS usually doesn't mention bug-fixes.


        Stefan




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

* Re: Calling macro by name while defining another macro
  2018-03-22 15:59     ` Stefan Monnier
@ 2018-03-22 17:47       ` John Shahid
  0 siblings, 0 replies; 10+ messages in thread
From: John Shahid @ 2018-03-22 17:47 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Help Gnu Emacs mailing list

Thanks y'all and sorry for the spam

On Thu, Mar 22, 2018, 12:00 PM Stefan Monnier <monnier@iro.umontreal.ca>
wrote:

> > I thought I was on emacs-26 but apparently I was using emacs-25.2.1. I
> > am unable to reproduce this issue on either master or emacs-26.  That
> > said, I don't see this mentioned in the NEWS, was it accidentally fixed?
>
> NEWS usually doesn't mention bug-fixes.
>
>
>         Stefan
>
>
>


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

end of thread, other threads:[~2018-03-22 17:47 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-21 22:35 Calling macro by name while defining another macro John Shahid
2018-03-22 13:53 ` Stefan Monnier
2018-03-22 15:12   ` Robert Pluim
2018-03-22 15:47     ` Stefan Monnier
2018-03-22 15:56       ` Eli Zaretskii
2018-03-22 15:56       ` Robert Pluim
2018-03-22 15:00 ` Eli Zaretskii
2018-03-22 15:52   ` John Shahid
2018-03-22 15:59     ` Stefan Monnier
2018-03-22 17:47       ` John Shahid

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.