0

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?

0

A simple example:

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

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.

  • tell me in more detail , what commands to use – Mini kute Dec 31 '19 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 Dec 31 '19 at 21:35

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