2

In https://www.emacswiki.org/emacs/AutoModeAlist one needs to use this command in order to add .py for python-mode (add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))
Why do we need the . between '"\\.py\\'" and the python-mode ?
Thanks.

2 Answers 2

4

This is lisp syntax for a dotted pair:

(cons 'a 'b) -> (a . b) 

Here's a link.

Briefly, dotted pairs are the fundamental building blocks for lists: lists are special dotted pairs, defined recursively. Most of the time, you work with lists so the dotted pairs are hidden in the background, but once in a while (as in this case), they poke through.

3

That's because auto-mode-alist is an "association list" (a list of pairs).

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.