I feel like this question is super basic, but I haven't been able to figure out how to automatically make a simple interactive command available in an Emacs session...
This is in ~/random/exploration/exploration.el
.
;;; Code:
;;;###autoload
(defun exploration ()
"a test package"
(interactive)
(message "hi"))
(provide 'exploration)
;;; exploration.el ends here
This is in init.el
:
(add-to-list 'load-path (expand-file-name "~/random/exploration"))
exploration
isn't available via M-x
though. I have to do M-: (require 'exploration)
before it appears.
How would I make this command available automatically, like plugins do? I've been poring over the docs for load-path
and autoload
but can't figure out how to make this happen.
I want to do this so I can put other functions in exploration.el
and have them only available after the user first does M-x exploration
. That implies that exploration
needs to be autoloaded.
Comments on any redundancies in what I've done here, or tips on how I could have debugged this on my own would also be welcome.