-
-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancing denote-rename-file
to handle not-yet-saved visiting buffer
#279
Comments
I am surprised this does not already work, but I tested it by calling
If you have not assigned copyright to the FSF, it would probably be best to continue opening issues for others to fix. |
Cool. I'll hold off until that's done. This may finally get me to stop procrastinating on it. |
I think this is fixed in the latest code, if you want to test it. Create a new note, call (Just make sure to revert the last commit, because it breaks the creation command. I'll fix it.) |
Just got around to looking at this: works great, one more hacky monkey-patch removed from my config! Thanks @jeanphilippegg & @protesilaos ! |
You're welcome! |
I use
denote-rename-file
a lot for changing information that shows up in a Denoted file name.Sometimes, I'll create a note, do some writing, and only then I'll think of some change to the title or the tags. But at that moment I often haven't saved the note yet and don't even know if I'm going to keep it - I don't want to save it just to change the relevant information.
So I think it would be a nice addition if
denote-rename-file
would work on files that don't exist, but for which a visiting buffer exists, doing everything except writing the file out to disk.Architecturally, to me it makes a whole lot of sense, especially when using/considering Denote's public functions as building blocks to build even more good things on top of Denote's goodness, that
denote-rename-file
, and the upcoming/mentioned change of making that function respect the prompts variable to control what it prompts for when used interactively, as agreement. (Consider the combinatoric explosion otherwise: right now I only have to learn+understand and wrap+advise one function -denote-rename-file
- to get all the behavior that I want.)My first solution to this was to have the following code in my
denote-rename-file
wrapper to make this happen. It was crude, but it was quick, simple, didn't require me to know or couple any implementation details, and it works "well enough" - it temporarily creates the file if it doesn't exist before runningdenote-rename-file
and then deletes it right after:But obviously, it would be cleaner to just operate on the visited buffer without touching the file system.
Currently I use this more invasive monkey-patching to achieve that:
I suspect in-package support would be cleaner, simpler code that's easier to follow and maintain. If there's agreement that it's worth adding in-package, I can draft a full patch/PR.
The text was updated successfully, but these errors were encountered: