emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-id-locations-load should probably abbreviate file names
@ 2024-09-26 19:45 Martin Edström
  0 siblings, 0 replies; only message in thread
From: Martin Edström @ 2024-09-26 19:45 UTC (permalink / raw)
  To: emacs-orgmode

This is not a bug that breaks normal use of org-id, but it may affect downstream uses.

An example is my package org-node, which checks file names known to org-id, and combines that with other sources of information, to build a big file list.

This list is automatically de-duplicated because I can normally assume the names are abbreviated. However, reading the source, it seems that it will not ensure this if `org-id-locations-file-relative` is t.  Then `org-id-locations-load` merely uses `expand-file-name`.  So a path that used to be ~/org/file.org becomes /home/me/org/file.org after loading back from disk.

This can be tested by evalling these sexps (if you replace "/home/me" with your own home):

(org-id-add-location "id1234" "/home/me/org/file.org")
(gethash "id1234" org-id-locations)
;; => "~/org/file.org"

(setq org-id-locations-file-relative t)
(org-id-locations-save)
(org-id-locations-load)
(gethash "id1234" org-id-locations)
;; => "/home/me/org/file.org"

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-09-26 19:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-26 19:45 org-id-locations-load should probably abbreviate file names Martin Edström

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).