I have a project that wants to play a sound file. I'd like to distribute this project in MELPA. There are two issues I'm having with that. They're both part of the question "how do I use resources in an Emacs package", so I'm asking this as one question.
1. Package setup
How do I set it up so I can distribute it through ELPA? Obviously the sound file needs to be included. Is there anything I need to do in the package, or is that something that needs to happen upon someone creating the package download?
2. Referencing the file
I'm having a problem referencing the sound file from the Emacs Lisp file. There's the function expand-file-name
, but if I open a new Emacs and load-file
the elisp file, during the call to expand-file-name
for the sound file, the path is expanded relative to the location of the Emacs executable.
There's an argument to expand-file-name
that is the default directory to start with, but I'm not sure how to get the directory the file is in when the file is being loaded. During the execution of load-file
, default-directory
gets the value of the folder that holds the Emacs executable. How can I get the file to load without hardcoding the full path?