I wish to M-x my-func and let my code run. This seems basic but where can I get more documentation about this, if possible inside emacs itself?


2 Answers 2


A simple example:

(defun hello-world ()
  "Insert \"Hello World!\"."
  (insert "Hello World!\n"))

You need to distinguish between a common function and an interactive command. The latter is also a function, but with the addition of (interactive) to its body.

You can run the latter, but not the former, by binding commands to keys or calling them by name via M-x. See the elisp manual links above more more details.

  • 1
    tell me in more detail , what commands to use
    – Mini kute
    Commented Dec 31, 2019 at 21:18
  • @Minikute: your question asked about documentation, and this answer provided it. Please don't ask for documentation if you don't intend to read it.
    – Dan
    Commented Dec 31, 2019 at 21:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.