Search code examples
lispelisp

"&optional" in (prettify-symbols-mode &optional ARG)


using Emacs Lisp:

Upon invoking describe-function to review prettify-symbols-mode

(prettify-symbols-mode &optional ARG)

What does &optional mean? is & is a 'logand'?


Solution

  • &optional in an argument list mean that the arguments that follow are not required. If the caller provides them then they'll be assigned to the respective variables. If not, then the variables will be nil.

    See also https://www.gnu.org/software/emacs/manual/html_node/elisp/Argument-List.html

    The '&' in front of 'optional' makes it possible for the defun to recognize '&optional' as a keyword and not an argument itself.