Here is some doco I'm creating but…
I'm not sure what the dot '.' between the extension and the mode is
for though in the following:
File Associations
Example: Associate *.mmd
with markdown-mode
:
(setq auto-mode-alist (cons '("\\.mmd$" . markdown-mode) auto-mode-alist))
basically there is an alist (associative list / hashtable) called
auto-mode-alist
. That points extension -> to mode. Extension looks
like it's a regular expression.
cons
is a function that pre-pends an element to a list
setq
means set quoted (which quotes auto-mode-list for you), otherwise
instead of assigning to the symbol auto-mode-alist, you will assign to
the results of evaluating that symbol…not what you want 😉
Best Answer
Lists are built up from smaller pieces in Lisp. The dot notation indicates those smaller pieces.
An item of the form
(a . b)
syntax is called a cons cell;a
is the car andb
is the cdr. (Those last terms come from the register names used to store them on the minicomputer Lisp was originally developed on, and are not otherwise meaningful. cons is short for "construct".) cons cell s are created with thecons
function. Notice that the behavior for prepending to a list falls naturally out of the internal format of a list, as shown above, and that appending to a list withcons
will not do what one might naïvely expect.Alist s are by historical convention plain cons cell s instead of full lists, originally for speed.