ilemming · 2022-04-22 18:29
Does anyone know if Embark lets you preview items in an Embark Collect buffer?
I want to be able to move up & down in the buffer and browse through the items (without having to press RET every time).
I've found `embark-collect-direct-action-minor-mode`, but can't figure out what it does. The docstring is somewhat ambiguous, and turning the mode on doesn't seem to have any effect.
DefiantAverage1 · 2022-04-23 01:26
(just commenting so I get notifications, I'm also after some answers)
ilemming · 2022-04-23 02:42
I couldn't find just the thing in Embark-Collect, however, I was able to get what I needed in Embark-Export, and it's super simple to convert Embark-Collect buffer to Export buffer.
Once in Embark-Export buffer, you can press `C-c C-f` and voila - just what I've described.
Still don't know what `embark-collect-direct-action-minor-mode` does though.
ExistingProgram3883 · 2022-04-23 04:54
/u/oantolin, could you help us here?
oantolin · 2022-04-23 08:07
Embark collect buffers don't have a follow mode. And Embark export buffers are in a variety of different major modes, so some have it and some don't.
It would be easy to add a follow mode for Embark collect buffers, but it seems slightly risky too. The idea would of course be to run the default action automatically on each candidate as you move around, but that means for example that of you run `M-x delete-file` and collect the candidates, follow mode in that buffer would delete files as you move around. That's probably not something you'd want and if you've turned off confirmation for file deletion it could be dangerous.
Thats an extreme case but generally speaking since the default action could be anything (it's the command you ran that produced the completion candidates in the first place), follow mode is really not like a preview mode where the word "preview" has the connotation that previews don't have any long-term consequences. At least that's the way Consult previews are built.
[By the way, in Embark *live* collect buffers you do get Consult previews (for Consult commands that have them) but only while the Consult command is still running.]
Given those concerns I'm a little reluctant to add a follow mode to Embark collect buffers, but can certainly write one and put it on the Embark wiki, say.
Finally, I'm sorry the direct action minor mode docstring was confusing, I'll try to reword it more clearly. What it does is bind each key in the action keymap for the type to run embark-act with that action, so that you don't have to press the key binding for embark-act before it. For example if your collect buffer is for, say, packages (from describe-package for example), then `i` installs a package, `h` describes it, `u` visits the homepage, etc.
oantolin · 2022-04-23 18:41
Sorry, I thought I replied but left a top-level comment instead.
ExistingProgram3883 · 2022-04-23 18:52
Thank you for your reply and the hint on where to find it!
ilemming · 2022-04-24 23:21
Thank you for your detailed answer.
> It would be easy to add a follow mode for Embark collect buffers, but it seems slightly risky too
Since I found a perfectly viable workaround for my case, I wouldn't dare to suggest implementing it (using whitelist or something), and I'm not familiar with the codebase to try doing that myself.
> By the way, in Embark live collect buffers you do get Consult previews (for Consult commands that have them) but only while the Consult command is still running.
Somehow, I have not found a real good use for live collect buffers and not sure what would be a good example of what you just described. But I would like to try and understand, maybe I'm missing something incredibly useful.
The explanation how direct-action-minor-mode works is great. That was a bit of a mystery and now it makes sense.