This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-10-18
Channels
- # announcements (1)
- # babashka (8)
- # beginners (20)
- # calva (2)
- # clara (17)
- # cljsrn (7)
- # clojure (45)
- # clojure-australia (1)
- # clojure-europe (5)
- # clojure-spec (7)
- # clojure-uk (2)
- # clojurescript (30)
- # cursive (3)
- # data-science (1)
- # datomic (2)
- # emacs (9)
- # events (2)
- # figwheel-main (1)
- # fulcro (4)
- # luminus (2)
- # malli (2)
- # pathom (10)
- # re-frame (44)
- # reagent (5)
- # reitit (4)
- # remote-jobs (1)
- # rum (1)
- # sci (2)
- # uncomplicate (2)
- # xtdb (21)
what would be the recommended way to define the path of a file to be read by an emacs package? for example, I wrote a package pkg.el
and it has a json file in the same folder that needs to be read when the user call M-x my-command
but I don't know where the pkg was cloned by the user
I'm not sure it is this what you are looking for, but there is locate-user-emacs-file
which returns the user emacs path, lsp-mode
use this, example: https://github.com/emacs-lsp/lsp-mode/blob/master/lsp-mode.el#L6795
It's not the same behavior. I have a large populated json file and wanted to read from it. The following code did the trick:
(expand-file-name
"sources/data.json"
(if load-file-name
(file-name-directory load-file-name)
default-directory))
the full code can be found here: https://github.com/wandersoncferreira/oblique-strategies
i don't know how robust it is, but i've used this sort of approach in the past: https://github.com/sogaiu/adorn/blob/master/emacs/adorn.el#L54-L59
There was recently discussion about this on emacs-devel because native-comp puts files in a different directory than your normal .el or .elc files
This is the solution in vterm: https://github.com/akermu/emacs-libvterm/blob/01a1332ebb11daca5408f7fcb8a08454b0176e79/vterm.el#L105-L112