I am trying to install simplenote2 to read my org files on my phone.
The official setup method is:
(require 'simplenote2) (setq simplenote2-email "[email protected]") (setq simplenote2-password "yourpassword") (simplenote2-setup)
and the app starts with
In practice credentials are not necessary in clear and
(require...) can be omitted because
simplenote2-setup is autoloaded.
I would like to use a
use-package declaration, therefore I am using:
(use-package simplenote2 :config (setq simplenote2-email "[email protected]") (setq simplenote2-password "yourpassword") (setq simplenote2-notes-mode (quote org-mode)) (simplenote2-setup))
(The extra line is for org-mode integration).
When I start the library with
M-x simplenote2-list, I get an error due to a void variable
This variable is defined through a
defvar in simplenote2.el. So, it seems that the
use-package declaration is not requiring
The likely cause is that the autoloaded function
simplenote2-list is defined in the separate file
simplenote2-list requires only
simplenote2-list.el, but not
If this is the cause, how can I instruct
use-package to require also
simplenote2.el the first time
M-x simplenote2-list is run?
Or alternatively: before running
M-x simplenote2-list, how can I run the autoloaded
(simplenote2-setup), which automatically requires
Note that I have the global option
use-package-always-defer set true.
You cannot easily run
simplenote2-setup when lazy loading the package.
However, there are several options, to make lazy loading happening:
:after and defining a use-package declaration for
(use-package simplenote2-list :after (simplenote2))
simplenote2 from simplenote2-list use-package declaration
(use-package simplenote2-list :config (require 'simplenote2))
you could define a keybinding for
simplenote2 use-package declaration:
(use-package simplenote2 :bind ("C-c s" . simplenote2-list) :config ...)
This works for the same reason like the next option.
a somewhat hacky one, declaring
simplenote2-list as command of
simplenote2. This works because
simplenote2-list is required by
(use-package simplenote2 :commands (simplenote2-list) :config ...)
if simplenotes2 is able to be started with hooks or mode-interpreters, you could emulate the simplenote2-setup with keywords
:hook. Please read the use-package manual.
Answered by jue on November 15, 2021
1 Asked on September 2, 2021
1 Asked on September 2, 2021 by nilaksh-singh
1 Asked on September 2, 2021 by x-yuri
1 Asked on September 2, 2021
0 Asked on September 2, 2021 by brian-postow
3 Asked on September 2, 2021 by erwann
1 Asked on September 2, 2021 by starquake
0 Asked on September 2, 2021 by grepcake
0 Asked on September 2, 2021 by scientific_explorer
1 Asked on September 2, 2021 by aleks224
0 Asked on September 2, 2021 by a-blizzard
2 Asked on September 2, 2021 by lorem-ipsum
1 Asked on September 2, 2021 by omar113
Get help from others!