Emacs' source code contains multiple instances of using fset
with a keymap.
For example, in ediff-util.el:
;; Allow ediff-mode-map to be referenced indirectly
(fset 'ediff-mode-map ediff-mode-map)
Or in esh-mode.el:
(fset eshell-command-prefix (make-sparse-keymap))
Or compile.el:
(defvar compilation-button-map
(let ((map (make-sparse-keymap)))
(define-key map [mouse-2] 'compile-goto-error)
(define-key map [follow-link] 'mouse-face)
(define-key map "\C-m" 'compile-goto-error)
map)
"Keymap for compilation-message buttons.")
(fset 'compilation-button-map compilation-button-map)
I've found examples in third-party elisp projects too, such as projectile. I've looked at the creating keymaps documentation but I can't find anything relevant.
These values cannot even be called as functions:
ELISP> (compilation-button-map)
*** Eval error *** Invalid function: compilation-button-map
What's the purpose of setting the function slot of a symbol with a keymap? Where is it documented?