oantolin / embark

Emacs Mini-Buffer Actions Rooted in Keymaps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`embark-act` doesn't respect prefix argument with extended commands

josephmturner opened this issue · comments

It appears that embark-act doesn't respect the prefix argument when used with extended commands.

For example, do the following to reproduce this issue with transpose-sexps:

Given a buffer containing the following text:

a b c d e

Do the following:

M-< to put point at buffer start.
C-. (for embark-act) C-u M-x transpose-sexps RET

Expected:

b c d e a

Actual:

b a c d e

On my machine, Embark then prompts again, saying Rep on file "~/ardour" (which I assume is an attempt to complete a filename starting with a in the current directory.


By contrast, running embark-act with transpose-sexps by its keybinding gives the expected result:

M-< to put point at buffer start.
C-. (for embark-act) C-u C-M-t (to transpose the sexp at point 4 times.


This issue arose for me because I wanted to run embark-select on multiple files in the minibuffer with completion, then run embark-act-all with C-u mml-attach-file to attach all files to the current message composition buffer. Once working, this could be an alternative to gnus-dired-attach (folks who are reading #376 might find this interesting).

Thank you!!!

This issue can also be demonstrated with the example commands in the Embark info manual (info "(embark)How does Embark call the actions?"):

"For example,
you can use ‘C-u X2’ with the above demonstration actions to make the
message printed by ‘example-action-command2’ more emphatic."

However, running C-u M-x example-action-command2 does not add "truly " to the message.

That was tricky! Emacs was sneakily clearing prefix-arg before the next command. I think maybe any call to completing-read clears it? In my tests it works now, but please let me know if there is still a problem.

Thank you! The fix works. I wonder why let-bind prefix-arg twice here:

4d87456#r134492640

Oh, because it was actually two bugs: the prefix was ignored both for commands entered via M-x and via C-h.

(When I fix a bug I try to also fix all other bugs that require the same fix even if they were not reported. 😜)

I see! Good catch - I tested it, and both let-bindings are indeed necessary. Thank you!!

Congratulations on v1.0!!

Congratulations on v1.0!!

Thanks!