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?

Drew
  • 77,472
  • 10
  • 114
  • 243
squiter
  • 229
  • 1
  • 9

1 Answers1

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