emacs

Consider also joining #cider, #lsp and #inf-clojure, where most of the tool-specific discussions are happening.
bartuka 2020-10-18T02:09:57.090200Z

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

bartuka 2020-10-18T02:18:54.090600Z

(file-name-directory load-file-name) (Y)

ericdallo 2020-10-18T03:02:18.092100Z

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

bartuka 2020-10-18T12:37:54.092300Z

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

1👍
bartuka 2020-10-18T12:38:53.092600Z

the full code can be found here: https://github.com/wandersoncferreira/oblique-strategies

2020-10-18T12:52:11.092900Z

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

dakra 2020-10-19T07:15:17.093400Z

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

2020-10-19T09:18:07.093900Z

thanks for sharing that

bartuka 2020-10-18T12:37:54.092300Z

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

1👍
bartuka 2020-10-18T12:38:53.092600Z

the full code can be found here: https://github.com/wandersoncferreira/oblique-strategies

2020-10-18T12:52:11.092900Z

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