0

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?

  • Do you want to run it after uninstall and reinstall? What about package update? – npostavs Apr 20 '17 at 23:04
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.