bbatsov / emacs-lisp-style-guide

A community-driven Emacs Lisp style guide
1.08k stars 53 forks source link

[Suggestion]: Minimize additions to list variables #60

Closed progfolio closed 9 months ago

progfolio commented 1 year ago

Add one element when appropriate. e.g. Instead of adding multiple entries to auto-mode-alist:

(add-to-list 'auto-mode-list ("\\.inp\\'" . apdl-mode))
(add-to-list 'auto-mode-list ("\\.dat\\'" . apdl-mode))
(add-to-list 'auto-mode-list ("\\.ans\\'" . apdl-mode))
(add-to-list 'auto-mode-list ("\\.mac\\'" . apdl-mode))

Add a single element:

(add-to-list 'auto-mode-list ("\\.\\(?:ans\\|dat\\|inp\\|mac\\)\\'" . apdl-mode))

The same should be considered for any global variable which is checked frequently.