minibuffer

How to turn a function into a command in Emacs Lisp?

August 29, 2023
(defun foo ()
  "Print \"bar\""
  (interactive)
  (message "bar"))

(foo)

(global-set-key (kbd "C-<f1>") #'foo)