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
A simple example:
(defun hello-world () "Insert \"Hello World!\"." (interactive) (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.
- 1tell me in more detail , what commands to useMini kute– Mini kute2019-12-31 21:18:13 +00:00Commented 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– Dan2019-12-31 21:35:23 +00:00Commented Dec 31, 2019 at 21:35