Open yantar92 opened 5 months ago
(eval-when-compile (require 'xdg))
(defcustom gptel-crowdsourced-prompts-file
(expand-file-name "gptel-crowdsourced-prompts.csv" (xdg-cache-home))
"File used to store crowdsourced system prompts.
These are prompts cached from an online source (see
`gptel--crowdsourced-prompts-url'), and can be set from the
transient menu interface provided by `gptel-menu'."
:group 'gptel
:type 'file)
karthink @.***> writes:
- Does xdg.el support Windows?
XDG does not provide standards for Windows. AFAIU, `xdg-cache-home' will return ~/.cache on Windows.
- I don't know if xdg.el is loaded with Emacs. I would like to avoid requiring the library just to fetch the cache directory.
xdg.el is very lightweight. And it is generally a good idea to follow configurable standard that respect user settings rather than not.
... Is the following valid, or do you have any suggestions?
(eval-when-compile (require 'xdg)) (defcustom gptel-crowdsourced-prompts-file (expand-file-name "gptel-crowdsourced-prompts.csv" (xdg-cache-home)) "File used to store crowdsourced system prompts.
Bad idea. xdg.el pulls data from environment variables, when they are defined. If you execute (xdg-cache-home) at compile time, environment variables may not be respected if the user changes them.
-- Ihor Radchenko // yantar92, Org mode contributor, 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
Bad idea. xdg.el pulls data from environment variables, when they are defined. If you execute (xdg-cache-home) at compile time, environment variables may not be respected if the user changes them.
Noted.
It would be nice if
gptel-crowdsourced-prompts-file
did not hard-code using environment variables only. xdg.el library (when available) is more accurate. It is enough to callxdg-cache-home
.