-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
Just an idea: denote for attachments #1
Comments
Thanks @Ypot!
Yes, it is useful.
I already do this locally for my multimedia, but I don't have any Elisp I am now trying to think how it could be done. We could have a command, Unlike the other commands, What do you think? [ Maybe a better name is Though we need to be careful not to go very far with this idea, as it is
You are welcome! |
Not sure! I just thought attachments could be benefited with an analogous naming and listing. But it's more like a brainstormed idea that could fit in your project, if it suits you. For completion candidates I would find more useful keywords than extensions (why bother with existing extensions?). Best regards :-) |
Hello again! Here is a prototype (I made some other changes): (defun denote-dired-rename-file (title keywords)
"Return path to new file with TITLE and KEYWORDS."
(interactive
(list
(denote--title-prompt)
(denote--keywords-prompt)))
(let* ((file (dired-get-filename))
(dir (file-name-directory file))
(old-name (file-name-nondirectory file))
(extension (file-name-extension file t))
(new-name (denote--format-file
dir
(format-time-string denote--id)
keywords
(denote--sluggify title)
extension)))
(when (y-or-n-p
(format "Rename %s to %s?"
(propertize old-name 'face 'error)
(propertize (file-name-nondirectory new-name) 'face 'success)))
(rename-file old-name new-name nil)
(revert-buffer)))) It uses the standard prompts for The renaming only happens relative to the current directory. It does EDIT: I removed the sample diff, as I already pushed the changes. |
There is no need to limit it to the denote-directory. We ultimately want to fontify all Denote-style file names, not just the notes created by Denote. For example, I have been recording all my longer-term storage using such a naming scheme: this mode gives me the extra faces for .pdf, .mp3, and other files. Users of Denote may want this for attachments. The upside of having this as a buffer-local mode is that the user can write a wrapper function that applies the mode only in a given directory (like we were doing before). Thanks to Ypot for suggesting a kernel of this idea in issue 1 over at the GitHub mirror: <#1>.
This is not limited to notes that were created with Denote: it works on any file in any directory. The idea is to apply the Denote-style file name in more contexts, such as for longer-term storage and attachments to notes. Also see commit 431124f, which is thematically aligned with this one. Thanks to Ypot for giving me the idea in issue 1 over at the GitHub mirror: <#1>.
I made some changes early today to how renaming works. The current functionality is described here: https://protesilaos.com/emacs/denote#h:532e8e2a-9b7d-41c0-8f4b-3c5cbb7d4dca |
I am receiving this message: Maybe I should try without customizations. |
Offtopic: I am trying to send you what seems to be a "typo". But I don't know how to, I share it here (last line):
|
Thanks to Ypon for reporting it: <#1 (comment)>.
Fixed. Thank you! |
Can you please report this in a new issue? It will be easier to track Also please note what you tried to produce this error. Maybe |
I am closing this issue now as Denote supports the idea of renaming other files. |
If you think this is something you might use, but disagree with some of its decisions, now is the best time to act.
Just in case this idea could be useful:
I use attached or linked local files for adding multimedia (jpg, pdf, etc) or references (saved html, podcasts, etc) to my org notes.
These multimedia files are in a folder almost kaotically.
To sort those files in the way you've described could give to them a new dimension.
Thanks for elisping!
The text was updated successfully, but these errors were encountered: