Systematically converting denote links to file links. #424
Replies: 2 comments 2 replies
-
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.
-
This discussion is several months old, and there have been significant improvements to both Orgzly and Orgro in that time. Both of these Android apps now support following Org-ID links that span different files. ID properties are independent of the file-name, so you don't have to update links using search-replace, and you don't have to worry about links breaking if you update a note's tags or title. The one caveat is that if you add an ID property at the file-level, Org adds a property drawer at the very top of that file, which is inserted above Denote's front-matter. Therefore, I'm thinking of having a level-1 Org heading automatically inserted below Denote's front-matter and automatically copying the Denote "identifier" into the ID property of that heading. This way, the front-matter isn't interfered with, and I can just link to the top-level heading instead of the file itself. There's also a minor side-benefit of being able to visually identify in Dired which Denote file the I'm curious to hear others' insight into this cross-platform conundrum. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
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