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?

Drew
  • 75,699
  • 9
  • 109
  • 225
Mini kute
  • 15
  • 4

2 Answers2

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.

Dan
  • 32,584
  • 6
  • 98
  • 168
  • 1
    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
0

A simple example:

(defun hello-world ()
  "Insert \"Hello World!\"."
  (interactive)
  (insert "Hello World!\n"))
ceving
  • 1,308
  • 1
  • 14
  • 28