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
  2024-12-15 14:14 ` Ihor Radchenko
  0 siblings, 1 reply; 2+ messages 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] 2+ messages in thread

* Re: org-id-locations-load should probably abbreviate file names
  2024-09-26 19:45 org-id-locations-load should probably abbreviate file names Martin Edström
@ 2024-12-15 14:14 ` Ihor Radchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Ihor Radchenko @ 2024-12-15 14:14 UTC (permalink / raw)
  To: Martin Edström; +Cc: emacs-orgmode

"Martin Edström" <meedstrom@runbox.eu> writes:

> 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.
> ...

Fixed, on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=036e8dcf04

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-12-15 14:14 UTC | newest]

Thread overview: 2+ messages (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
2024-12-15 14:14 ` Ihor Radchenko

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).