branch: externals/org commit 876e8133343cccff32ac1cd17d06ff957715e8f1 Author: Ihor Radchenko <yanta...@gmail.com> Commit: Ihor Radchenko <yanta...@gmail.com>
org-persist.el: Fix Emacs versions where xdg.el is not available * lisp/org-persist.el (org-persist-directory): Make `xdg-cache-home' call optional. Prefer cache directory in `user-emacs-directory' when the cache already exists there. Fixes https://list.orgmode.org/cafqubhf+wpuneeapkcg94wjhfcrxvsf+j-7ut3b_romfkqc...@mail.gmail.com/T/#m99c63439a745c07fd7c30cde0b49b3d5bd1757f0 --- lisp/org-persist.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lisp/org-persist.el b/lisp/org-persist.el index a54276c..e97648b 100644 --- a/lisp/org-persist.el +++ b/lisp/org-persist.el @@ -29,7 +29,7 @@ (require 'org-compat) (require 'org-id) -(require 'xdg) +(require 'xdg nil t) (declare-function org-back-to-heading "org" (&optional invisible-ok)) (declare-function org-next-visible-heading "org" (arg)) @@ -37,9 +37,13 @@ (defvar org-persist-directory (expand-file-name (org-file-name-concat - (let ((cache-dir (xdg-cache-home))) + (let ((cache-dir (when (fboundp 'xdg-cache-home) + (xdg-cache-home)))) (if (or (seq-empty-p cache-dir) - (not (file-exists-p cache-dir))) + (not (file-exists-p cache-dir)) + (file-exists-p (org-file-name-concat + user-emacs-directory + "org-persist"))) user-emacs-directory cache-dir)) "org-persist/"))