1

Why some functions in simple.el are invokable with M-x and some others aren't?
For example I can do M-x what-line but I can't do M-x line-number-at-pos.

Drew
  • 77,472
  • 10
  • 114
  • 243
element
  • 47
  • 5

1 Answers1

1

Only functions which are declared to be interactive are callable with M-x. The declaration is done by putting an (interactive) form as the first thing in the body of the function. Like this:

(defun an-example ()
  "this is an example function"
  (interactive)
  (insert "42"))

There is a lot of other information you should know about interactive functions, so you should type C-h f and enter interactive to see more help for it.

db48x
  • 17,977
  • 1
  • 22
  • 28