* How can I keep Org-id links from breaking when moving files?
@ 2021-01-19 2:52 arozbiz
2021-01-19 18:32 ` doltes
0 siblings, 1 reply; 6+ messages in thread
From: arozbiz @ 2021-01-19 2:52 UTC (permalink / raw)
To: Emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 499 bytes --]
This question is in the context of using Org-id UUIDs for linking between
files. If I understand correctly, Org-id knows where to look for UUIDs
(generated by org-id-get-create) by looking at the org-id-locations
variable. But what if I move an .org file that I've generated a UUID into
another folder? I know I can run org-id-update-id-locations, and there's an
org-id-extra-files variable, but is there a way to list all the folders on
the system where Org-id should look for UUIDs?
Thanks,
Alan
[-- Attachment #2: Type: text/html, Size: 563 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How can I keep Org-id links from breaking when moving files?
2021-01-19 2:52 How can I keep Org-id links from breaking when moving files? arozbiz
@ 2021-01-19 18:32 ` doltes
2021-01-20 0:13 ` Samuel Wales
0 siblings, 1 reply; 6+ messages in thread
From: doltes @ 2021-01-19 18:32 UTC (permalink / raw)
To: arozbiz; +Cc: emacs-orgmode
arozbiz@gmail.com writes:
> This question is in the context of using Org-id UUIDs for linking between
> files. If I understand correctly, Org-id knows where to look for UUIDs
> (generated by org-id-get-create) by looking at the org-id-locations
> variable. But what if I move an .org file that I've generated a UUID into
> another folder? I know I can run org-id-update-id-locations, and there's an
> org-id-extra-files variable, but is there a way to list all the folders on
> the system where Org-id should look for UUIDs?
>
> Thanks,
> Alan
After reading the docstring of the function
=org-id-update-id-locations=, I found that the files which are scanned
are defined by 6 variables.
The following was retrieved from the docstring
#+begin_quote
This will scan all agenda files, all associated archives, and all
files currently mentioned in ‘org-id-locations’.
#+end_quote
This implies that when that function is executed, the files whose
content is searched for IDs (i.e. they are scanned) are
+ The files mentioned in =org-agenda-files=.
+ The archives associated to the files in =org-agenda-files=.
+ The files mentioned in =org-id-locations=.
+ The files provided as arguments to the =org-id-update-id-locations=.
The following are not mentioned in the documentation of
=org-id-update-id-locations=, but when looking at the source code, you
can see that the value of the following variables is used
+ =org-id-extra-files=
+ =org-id-files=
As we could see, the files which are scanned are defined by 6 variables.
Now, apparently, you want to get a list of the files which are
scanned. You can do that by executing what
=org-id-update-id-locations= executes in order to get the list of
files to scan. The following was retrieved from that function with
some modifications
#+begin_src elisp :results output
(let ((files (delete-dups
(mapcar #'file-truename
(append
(org-agenda-files t org-id-search-archives)
(unless (symbolp org-id-extra-files)
org-id-extra-files)
org-id-files)))))
(dolist (file files) (princ (format "%s\n" file))))
#+end_src
#+RESULTS:
#+begin_example
/home/username/my/org/Statistics.org
/home/username/my/org/Programming languages/Elisp.org
/home/username/my/org/Programming languages/R.org
#+end_example
Hope that helps. Let me know if that answers your question.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How can I keep Org-id links from breaking when moving files?
2021-01-19 18:32 ` doltes
@ 2021-01-20 0:13 ` Samuel Wales
2021-01-20 11:39 ` doltes
0 siblings, 1 reply; 6+ messages in thread
From: Samuel Wales @ 2021-01-20 0:13 UTC (permalink / raw)
To: doltes; +Cc: arozbiz, emacs-orgmode
(defvar org-id-locations nil
"List of files with IDs in those files.")
(defvar org-id-files nil
"List of files that contain IDs.")
you are in a maze of twisty little passages.
you are in a twisty maze of little passages.
On 1/19/21, doltes <doltes512@gmail.com> wrote:
>
> arozbiz@gmail.com writes:
>
>> This question is in the context of using Org-id UUIDs for linking between
>> files. If I understand correctly, Org-id knows where to look for UUIDs
>> (generated by org-id-get-create) by looking at the org-id-locations
>> variable. But what if I move an .org file that I've generated a UUID into
>> another folder? I know I can run org-id-update-id-locations, and there's
>> an
>> org-id-extra-files variable, but is there a way to list all the folders
>> on
>> the system where Org-id should look for UUIDs?
>>
>> Thanks,
>> Alan
>
> After reading the docstring of the function
> =org-id-update-id-locations=, I found that the files which are scanned
> are defined by 6 variables.
>
> The following was retrieved from the docstring
>
> #+begin_quote
> This will scan all agenda files, all associated archives, and all
> files currently mentioned in ‘org-id-locations’.
> #+end_quote
>
> This implies that when that function is executed, the files whose
> content is searched for IDs (i.e. they are scanned) are
>
> + The files mentioned in =org-agenda-files=.
> + The archives associated to the files in =org-agenda-files=.
> + The files mentioned in =org-id-locations=.
> + The files provided as arguments to the =org-id-update-id-locations=.
>
> The following are not mentioned in the documentation of
> =org-id-update-id-locations=, but when looking at the source code, you
> can see that the value of the following variables is used
>
> + =org-id-extra-files=
> + =org-id-files=
>
> As we could see, the files which are scanned are defined by 6 variables.
>
> Now, apparently, you want to get a list of the files which are
> scanned. You can do that by executing what
> =org-id-update-id-locations= executes in order to get the list of
> files to scan. The following was retrieved from that function with
> some modifications
>
> #+begin_src elisp :results output
> (let ((files (delete-dups
> (mapcar #'file-truename
> (append
> (org-agenda-files t org-id-search-archives)
> (unless (symbolp org-id-extra-files)
> org-id-extra-files)
> org-id-files)))))
> (dolist (file files) (princ (format "%s\n" file))))
> #+end_src
>
> #+RESULTS:
> #+begin_example
> /home/username/my/org/Statistics.org
> /home/username/my/org/Programming languages/Elisp.org
> /home/username/my/org/Programming languages/R.org
> #+end_example
>
> Hope that helps. Let me know if that answers your question.
>
>
--
The Kafka Pandemic
Please learn what misopathy is.
https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How can I keep Org-id links from breaking when moving files?
2021-01-20 0:13 ` Samuel Wales
@ 2021-01-20 11:39 ` doltes
2021-01-21 13:14 ` arozbiz
0 siblings, 1 reply; 6+ messages in thread
From: doltes @ 2021-01-20 11:39 UTC (permalink / raw)
To: Samuel Wales; +Cc: arozbiz, emacs-orgmode
Yeah, I also found that confusing. Basically, because both mean the
same.
I think that a better description for those variables would be
+ =org-id-locations=: List obtained from `org-id-locations-file'. This
list maps each ID to the file in which the definition occurs. It
contains lists of the form (FILE ID).
+ =org-id-files=: List of files which contain ID definitions.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How can I keep Org-id links from breaking when moving files?
2021-01-20 11:39 ` doltes
@ 2021-01-21 13:14 ` arozbiz
2021-01-22 19:16 ` TRS-80
0 siblings, 1 reply; 6+ messages in thread
From: arozbiz @ 2021-01-21 13:14 UTC (permalink / raw)
To: doltes; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 811 bytes --]
This is helpful clarification, thank you. But does that mean that, if I
change the directory where some files with UUIDs are located, there's no
way to programmatically make sure that Org can find those IDs again (since
there's no way to simply add a folder, rather than a list of files, to
=org-id-locations= or =org-id-files=?
Thanks,
Alan
On Wed, Jan 20, 2021 at 5:42 AM doltes <doltes512@gmail.com> wrote:
>
> Yeah, I also found that confusing. Basically, because both mean the
> same.
>
> I think that a better description for those variables would be
>
> + =org-id-locations=: List obtained from `org-id-locations-file'. This
> list maps each ID to the file in which the definition occurs. It
> contains lists of the form (FILE ID).
>
> + =org-id-files=: List of files which contain ID definitions.
>
[-- Attachment #2: Type: text/html, Size: 1176 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How can I keep Org-id links from breaking when moving files?
2021-01-21 13:14 ` arozbiz
@ 2021-01-22 19:16 ` TRS-80
0 siblings, 0 replies; 6+ messages in thread
From: TRS-80 @ 2021-01-22 19:16 UTC (permalink / raw)
To: emacs-orgmode
On 2021-01-21 08:14, arozbiz@gmail.com wrote:
> there's no way to programmatically make sure that Org can find those
> IDs again (since there's no way to simply add a folder, rather than a
> list of files, to =org-id-locations= or =org-id-files=?
Being that this is Emacs, you can do almost anything you want, with a
little Elisp practice. ;)
For example, you could write some custom move command which would
automatically add the new folder to some variable or file with a list of
folders to add to places for org-id to look in from now on.
However perhaps we should take a step back and ask ourselves if this is
a good approach? And IMHO, starting to scatter files here and there
throughout the filesystem is not a good idea. Even if you implement
above mentioned custom Elisp, it adds (IMO, needless) complexity.
Therefore I would think long and hard if that is actually really
necessary, before starting to go down that path. Just my $0.02.
Cheers,
TRS-80
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-01-22 19:17 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-19 2:52 How can I keep Org-id links from breaking when moving files? arozbiz
2021-01-19 18:32 ` doltes
2021-01-20 0:13 ` Samuel Wales
2021-01-20 11:39 ` doltes
2021-01-21 13:14 ` arozbiz
2021-01-22 19:16 ` TRS-80
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.