embark icon indicating copy to clipboard operation
embark copied to clipboard

Idea: `embark-become`-like functionality for `read-file-name`, allowing user to use different functions to return a filename

Open Hugo-Heagren opened this issue 3 years ago • 0 comments

The basic idea is that I could call some embark action during any call to read-file-name, be presented with a list of possible alternatives (some of which I might have defined myself), like with embark-become, select one, type something, hit enter, have the function I chose return something from that input, and have that return value returned to whatever function initially called read-file-name.

That's the abstract version. Here's a motivating use-case. I'm a student, and I often need to send academic papers to other people at my university. As a good amateur archivist, I name all my pdfs with the key of the relevant bib entry in my bib file. This makes it very easy for ebib and citar to play nicely with my pdf library, which is great. But if I want to attach a file to an email, I have to open ebib, find the record, copy its key, switch back to the email, attach a file (which calls read-file-name), then navigate to my pdf dir and yank the key into the minibuffer. It would be very easy to hack together a function from the ebib or citar codebases which reads a paper name and returns the filepath to it, but I wouldn't be able to use this directly in my email composition -- thus the idea of integrating with embark using functionality similar to become.

This is just an idea, and I have no idea how it could be implemented, but it seemed very close to things which embark already does, so I thought I would float it. Of course, functions other than read-file-name might benefit from similar flexibility, but it's the one which would be most useful for me.

Hugo-Heagren avatar Aug 01 '22 21:08 Hugo-Heagren