I'm writing a package to interact with a web service via HTTP API. But I need to make an action once to get permission to send my data. This action must be made just one time.
How can I configure my package to run this setup
function only once after installed?
Asked
Active
Viewed 92 times
0
-
Do you want to run it after uninstall and reinstall? What about package update? – npostavs Apr 20 '17 at 23:04
1 Answers
1
Well you need to save this information somewhere persistently.
You might write data to a package-specific config file (see locate-user-emacs-file
), but the simplest approach is probably to use defcustom
to define an option indicating whether or not the setup has been completed, and to call (customize-save-variable 'VARNAME VALUE)
in your code once setup is complete.
I'm assuming that the setup isn't already creating variable values that you could test for.

phils
- 50,977
- 3
- 79
- 122