Does the : have a special meaning in Elisp?

     (define-minor-mode dap-mode
          "Global minor mode for DAP mode."
          :init-value nil
          :group 'dap-mode
          :global t
          :require 'dap-mode
          :lighter (:eval (dap-mode-line))
          (add-hook 'lsp-after-open-hook 'dap--after-open))

It turns the symbol into a keyword. See chapter 12.2 Variables that Never Change in the Emacs Lisp manual.

Keywords are frequently used to identify named arguments to Lisp functions and macros. When the implementation of define-minor-mode needs to know whether the mode should be global or not, it walks down the list of arguments looking for :global, then takes the next value in the list. The caller can supply the keyword arguments in any order, and can leave out any arguments if needed.

The other place they are commonly used is as the keys in property lists (plists). These are key-value stores, conceptually similar to dictionaries, association lists, associative arrays and maps in other languages. See chapter 5.9 Property Lists in the Emacs Lisp manual.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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