When you install clojure-mode via package-install
, you can then open any .clj
file and automatically enter the mode.
And this works for every subsequent Emacs launch ; Yet, no (require 'clojure-mode)
(or a custom definition, nothing) has been inserted in the init file.
I carefully reviewed the clojure-mode.el file, and found no clue as to how this works. Yes, the main interactive functions and the major modes definitions are autoloaded, and the common clojure file extensions are added to auto-mode-alist
:
;;;###autoload
(progn
(add-to-list 'auto-mode-alist
'("\\.\\(clj\\|dtm\\|edn\\)\\'" . clojure-mode))
(add-to-list 'auto-mode-alist '("\\.cljc\\'" . clojurec-mode))
(add-to-list 'auto-mode-alist '("\\.cljx\\'" . clojurex-mode))
(add-to-list 'auto-mode-alist '("\\.cljs\\'" . clojurescript-mode)))
But this is not enough for the mode I'm working on. I found no way of loading it without explicitly requiring it in the init file..?
What is this magic?