Helm and keyboard macro

148 views
Skip to first unread message

Tu Hoang Do

unread,
Jun 5, 2014, 2:29:21 AM6/5/14
to emacs...@googlegroups.com
Is there a way to make helm work with keyboard macro? For example, there are some operations that requires input from a list of candidates, and in Emacs 24.4.50, Helm is always available for selecting completion (which is good). But, it does not work with key board macro and I have to temporary disable Helm to create a keyboard macro.

Thierry Volpiatto

unread,
Jun 5, 2014, 6:15:35 AM6/5/14
to emacs...@googlegroups.com

Tu Hoang Do <solidi...@gmail.com> writes:

> Is there a way to make helm work with keyboard macro?

Which kmacro* command are you using ?

--
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997

Tu Hoang Do

unread,
Jun 5, 2014, 6:21:20 AM6/5/14
to emacs...@googlegroups.com
Hmm it seems to work now. Not sure which command I had problem with during the recording session. Probably I did something wrong there. I will notify again when it happens.

Raju Gandhi

unread,
Jan 17, 2015, 10:51:57 AM1/17/15
to emacs...@googlegroups.com
I seem to have a similar problem as Tu Hoang Do .

Here is the macro I am trying to record (I have a selected region in a buffer) - I want to htmlize-region, and save the resulting buffer in a file called code.html (SInce the file already exists emacs asks for a confirmation prior to overriding the file) - then kill the buffer and disable the selection.


Macro:

M-x                   ;; helm-M-x
htmlize-region        ;; self-insert-command * 14
RET                   ;; eshell-send-input
C-x C-s               ;; save-buffer
code.html             ;; self-insert-command * 9
RET                   ;; eshell-send-input
y                     ;; self-insert-command
C-x k                 ;; kill-buffer
RET                   ;; eshell-send-input
C-SPC                 ;; set-mark-command


When I run this macro I get "After 0 kbd macro iterations: helm: Error: Trying to run helm within a running helm session"

Am I missing something really obvious here?

Thanks!!!

Thierry Volpiatto

unread,
Jan 17, 2015, 3:38:42 PM1/17/15
to emacs...@googlegroups.com

Raju Gandhi <raju....@gmail.com> writes:

> I seem to have a similar problem as Tu Hoang Do .
>
> Here is the macro I am trying to record (I have a selected region in a buffer) - I want to htmlize-region, and save the resulting buffer in a file called code.html
> (SInce the file already exists emacs asks for a confirmation prior to overriding the file) - then kill the buffer and disable the selection.
>
> Macro:
>
> M-x ;; helm-M-x
> htmlize-region ;; self-insert-command * 14
> RET ;; eshell-send-input
> C-x C-s ;; save-buffer
> code.html ;; self-insert-command * 9
> RET ;; eshell-send-input
> y ;; self-insert-command
> C-x k ;; kill-buffer
> RET ;; eshell-send-input
> C-SPC ;; set-mark-command
>
> When I run this macro I get "After 0 kbd macro iterations: helm: Error: Trying to run helm within a running helm session"
>
> Am I missing something really obvious here?

Of course! you have recorded an helm command in your macro, you should
not do that, bind instead htmlize-region to a key and don't record
helm-M-x.

Michael Heerdegen

unread,
Jan 17, 2015, 7:06:14 PM1/17/15
to emacs...@googlegroups.com
Thierry Volpiatto
<thierry....@gmail.com> writes:

> > When I run this macro I get "After 0 kbd macro iterations: helm:
> > Error: Trying to run helm within a running helm session"
> >
> > Am I missing something really obvious here?
>
> Of course! you have recorded an helm command in your macro, you should
> not do that, bind instead htmlize-region to a key and don't record
> helm-M-x.

For the normal user not acquainted with Helm internals, this is not
obvious.

Calling any command that enters a helm session will likely break any
keyboard macro execution. This is quite an restriction!

Sadly, given how keyboard macros are implemented, and how helm is
implemented, I don't see an easy way to fix this limitation.


Michael.

Thierry Volpiatto

unread,
Jan 18, 2015, 1:30:06 AM1/18/15
to emacs...@googlegroups.com

Michael Heerdegen <michael_...@web.de> writes:

> For the normal user not acquainted with Helm internals, this is not
> obvious.

It could be documented.

> Calling any command that enters a helm session will likely break any
> keyboard macro execution. This is quite an restriction!

Sometimes you have to understand we may have such restrictions and
limitations in the use of a feature.

> Sadly, given how keyboard macros are implemented, and how helm is
> implemented, I don't see an easy way to fix this limitation.

In some special use cases we are using ":allow-nest t", but I don't want
to allow this everywhere (it is why we have an error message when trying
to run an helm command within helm, but not e.g with *kill-ring).

Well, in this use case one just have to bind a key to htmlize-region and
go...

Raju Gandhi

unread,
Jan 18, 2015, 11:10:59 AM1/18/15
to emacs...@googlegroups.com
Thierry,

Thank you for the prompt response! I should have thought of that :-/ My apologies - rookie error.

Michael - I appreciate the clarification - Thank you.

As for the documentation, looking over this group's previous messages I did not see anyone else have similar issues, so I am going to chalk it up to my not understanding Helm and it's implementation. However, I do appreciate the quick response on this, and I think to a large extent it fixes what may lacking in the documentation.

Again, with my appreciation, considering this was over the weekend.

Warm regards,

Raju

Michael Heerdegen

unread,
Jan 18, 2015, 11:12:52 PM1/18/15
to emacs...@googlegroups.com
Thierry Volpiatto
<thierry....@gmail.com> writes:

> > For the normal user not acquainted with Helm internals, this is not
> > obvious.
>
> It could be documented.

I wonder where a comment about that could be added. The "FAQ" section
in the wiki?

Reply all
Reply to author
Forward
0 new messages