Systematically converting denote links to file links. #424
JLucasGaldino
started this conversation in
General
Replies: 1 comment 1 reply
-
From: Lucas Galdino ***@***.***>
Date: Sun, 1 Sep 2024 20:39:51 -0700
[... 5 lines elided]
My question is: is there a way to write a function that uses the
"denote-org-extras-convert-links-to-file-type" command to convert all
links in all files that link to a certain file into denote links,
updates the file name according to its new metadata, and then converts
all links back to normal file links?
Yes, this can be done. Though it will need some custom code that I do
not have time to write and test right now.
I will try to revisit this topic after I publish Denote version 3.1.0.
Forgive me if this is a stupid question.
This is fine, no worries!
I am rather new to both Emacs and denote, but I find both to be
wonderful tools. I just need a hand to know how I could write this
function in elisp. For file A, find all files that link to it, convert
all links in these files to denote links, update the filename for file
A, and convert all links back to regular file links.
The idea is this:
- Use 'denote-link-return-backlinks' to find the FILE's backlinks.
- Go through all the files in a loop, using 'denote-org-extras-convert-links-to-file-type'.
Because this works with file contents, you need to visit the file and
operate therein. For example:
(with-current-buffer (find-file-noselect FILE)
do stuff here...)
- The above steps can be repeated for link conversions back and forth.
About the "update the filename" part, I am not sure I understood what
your goal is. Why do you need to rename the files? It can be done in the
same loop, of course.
…--
Protesilaos Stavrou
https://protesilaos.com
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello. I use org mode on both my pc and android phone, as a way of quickly capturing my thoughts as I need throughout the day. I have been thinking about switching to denote, since I really like its filename-based approach to organizing notes and other media, but on my phone (using Orgzly to edit and Orgro to read org-mode notes), only file links are really properly usable. Other kinds of links are unusable in either one or both of the apps.
One of the solutions that I have found for this problem is to constantly convert all my denote links to file links. Whenever I need to edit the tags or name of a note, I have to go to all notes that link to it, convert the links back to denote links, make the changes I need to make, and then convert all links back to file links.
My question is: is there a way to write a function that uses the "denote-org-extras-convert-links-to-file-type" command to convert all links in all files that link to a certain file into denote links, updates the file name according to its new metadata, and then converts all links back to normal file links?
Forgive me if this is a stupid question. I am rather new to both Emacs and denote, but I find both to be wonderful tools. I just need a hand to know how I could write this function in elisp. For file A, find all files that link to it, convert all links in these files to denote links, update the filename for file A, and convert all links back to regular file links.
Beta Was this translation helpful? Give feedback.
All reactions