1

I'm evaluating the current options to upgrade my aging ido-mode and smex usage, particularly ido-use-filename-at-point. One pattern that is important to me is going from a file path string to browsing the filesystem at the point as close to that file path string as possible. I use this regularly in almost all kinds of buffers: Docker compose volumes in YAML buffers, example paths in docs, symlink targets in dired buffers to open the target's parent, etc.. I don't care what key binding starts it, IOW I don't care if it's different than C-x C-f. I do care that whatever action I do puts me directly into the same filesystem navigation UI that C-x C-f does. Much of the time I don't even want to go straight to the given path, but I want to inspect something near by. Or the exact path doesn't exist but a slightly different path is what I want.

I've gotten a satisfactory point with the Ivy and Helm stacks, but not with the Vertico+Consult+Embark stack. After significant time reading docs and searching, the only thing I could find was a Reddit comment that suggested using Embark. I can run M-x embark-act and then type f to navigate to the path but I can't figure out how to get to the Vertico interactive filesystem navigation UI from there.

Is there a way to do this with Embark? More importantly, is there a better way to serve these use cases using Embark? I'm intrigued by Embark's UX model and want to learn The Right Way.

1 Answer 1

3

There is built-in support for find-file-at-point commands. You don't need to go through Embark for this, as Vertico will provide the completion UI using the ffap commands. See https://www.gnu.org/software/emacs/manual/html_node/emacs/FFAP.html.

All you need to do to set up those commands is add the following to your config.

(ffap-bindings) 

This will change the bindings for commands like find-file to their ffap equivalents. Vertico will work with them just fine.

If you're using the Consult commands, you may have become accustomed to using C-x b to open files. The suggested configuration for Consult doesn't alter the binding for C-x C-f. However, with the ffap commands you won't get the previewing that you get with the Consult commands.

2
  • Sorry, I omitted the context for where I got the idea to use Embark. Thanks for the (ffap-bindings) clue and I'll test that next, but can you clarify what I'm not understanding between my intended use case and why those commenters suggested using Embark? Commented Oct 2 at 0:31
  • 1
    You want to get the Vertico UI so that it suggests the file-at-point. That's what the FFAP commands do. embark-act pops up a menu. There's also embark-dwim, which immediately opens a file-at-point with no other interaction. My reading of the Reddit comment is that it's saying to use the FFAP commands for the purpose you described. But the question included the statement "I also tried Embark, and it immediately gave me errors, so I turned it off." So the commenter is encouraging them not to give up on Embark generally, because it is a good and useful package. Commented Oct 2 at 11:21

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.