Being more used to Vim, I know that it was correct to think "everything in Vim is a macro" but what about Emacs?

Is it fine/correct to think that everything is a function in Emacs?

  • 3
    The question is too broad, and so should be closed IMO. "Function" has zillions of meanings in math, computer science, and programming. Can someone say that everything in the universe is a function or can be modeled by a function? Sure. And? Certainly everything in Emacs Lisp is not a function as defined by the language. Not everything satisfies functionp, for example, or funcall. If there is a useful, specific question here about Elisp, please rephrase to make clear what that is.
    – Drew
    Jun 17, 2020 at 15:10
  • Sorry, didn't meant to make this as broad as it was :/ i mean, it's mostly just a meta question about Emacs so, that does make it more specific than talking about it's "zillions of meanings in math, computer science, and programming" :) It's just a saying i heard many times before, and doubted how correct it was... Jun 17, 2020 at 17:12
  • 1
    Maybe you want to change the question to ask whether everything in Elisp satisfies predicate functionp? But that has an easy answer - if everything satisfied it then it would have no reason to exist. Any way you look at it, your question is too broad or unclear, even if interpretation is limited to what Elisp calls a function. And we don't know what you mean by "function" wrt Elisp, in your question.
    – Drew
    Jun 18, 2020 at 0:32
  • followed your recommendation and changed the question to something more specific Jun 18, 2020 at 1:04
  • 1
    The question is now somewhat different to what it was when it was answered. I realise the edit was made in good faith, but I'm not sure it was for the best at this point? In particular, the accepted answer doesn't match as well as it did originally -- if we're now only asking about "the majority" rather than "everything" then it's pretty redundant to be pointing out the there are some things which aren't functions. FWIW, the question I thought you were asking was something like "Does every interactive action call a function?", and my answer doesn't fit any other question terribly well.
    – phils
    Jun 18, 2020 at 14:45

3 Answers 3


Not everything is a function, no. For starters, Elisp (the language) has many other kinds of object besides functions.

However, I think you're specifically asking whether every interactive action from the user is invoking a function behind the scenes; and the answer is still no.

The majority of commands will be functions; but not all of them.

Quoting from C-hig (elisp)Interactive Call:

Commands include strings and vectors (which are treated as keyboard macros), lambda expressions that contain a top-level ‘interactive’ form (*note Using Interactive::), byte-code function objects made from such lambda expressions, autoload objects that are declared as interactive (non-‘nil’ fourth argument to ‘autoload’), and some primitive functions. Also, a symbol is considered a command if it has a non-‘nil’ ‘interactive-form’ property, or if its function definition satisfies ‘commandp’.

  • Didn't knew! I guess this should be the accepted answer, but I'm glad i learned this :) Jun 17, 2020 at 8:28
  • 3
    @NordineLotfi if you like this better than my answer, you should absolutely change your pick. You can change your vote anytime, and you should when a better answer comes along!
    – Tyler
    Jun 17, 2020 at 13:36
  • 2
    Aren't all of these things still functions/macros, just in different forms? e.g. a byte-code object is a compiled representation of a function, autoload objects only wrap functions/macros, symbols with an 'interactive-form' property must reference a function, etc.
    – 0x5453
    Jun 17, 2020 at 13:43
  • 1
    @0x5453 by "functions/macros" you mean lisp macros or keyboard macros? Keyboard macros are quite different from functions, which I think is the point of this answer.
    – npostavs
    Jun 17, 2020 at 15:18
  • 1
    @0x5453 A keyboard macro could, hypothetically, be defined as a list of commands, but it isn't. It's defined as a sequence (specifically, a string or vector) of keys. You can observe this if you make keyboard macro, and then rebind one of the key bindings it uses.
    – npostavs
    Jun 18, 2020 at 12:06

Yes, I think so. Every key is bound to a function. Actually, a command, which is an interactive function (meaning a function the user can call during editing, not just by running elisp code). Adding a letter to a file is accomplished via the command self-insert, which is bound to most unmodified keys by default.

I'm not sure how useful that is, but nearly every interaction you have with emacs is via a function.


In the emacs lisp sense, not everything is a function. functionp is a predicate to determine wether a symbol is bound to a function or not.

 (functionp 'set)
 (functionp 'setq)

set is a built-in function writen in C, setq a special form which don't evaluate all its argument like functions does.

  • n.b. The OBJECT in (functionp OBJECT) needn't be a symbol.
    – phils
    Jun 18, 2020 at 1:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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