about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2021-04-10 17:25:22 -0500
committerCase Duckworth2021-04-10 17:27:45 -0500
commitc5c8929180c228d66e3b23d1f609cf944e3bb145 (patch)
treebc1984a0a392b719beb5a10f017f41b3015bc52c
parentAdd docstrings (diff)
downloademacs-c5c8929180c228d66e3b23d1f609cf944e3bb145.tar.gz
emacs-c5c8929180c228d66e3b23d1f609cf944e3bb145.zip
Add `:mode' setup form
(:mode EXTENSION) expands to
(add-to-list 'auto-mode-alist '(EXTENSION . setup-mode)).
-rw-r--r--init.el34
1 files changed, 18 insertions, 16 deletions
diff --git a/init.el b/init.el index a53dada..1784039 100644 --- a/init.el +++ b/init.el
@@ -45,6 +45,12 @@
45 :documentation "Bind KEY to COMMAND in `acdw/leader' (C-z) map." 45 :documentation "Bind KEY to COMMAND in `acdw/leader' (C-z) map."
46 :repeatable t) 46 :repeatable t)
47 47
48(setup-define :mode
49 (lambda (ext)
50 `(add-to-list 'auto-mode-alist '(,ext . setup-mode)))
51 :documentation "Add SETUP-MODE to `auto-mode-alist' for EXTENSION."
52 :repeatable t)
53
48;;; `no-littering' 54;;; `no-littering'
49(setup (:straight no-littering) 55(setup (:straight no-littering)
50 (:option no-littering-etc-directory (acdw/dir) 56 (:option no-littering-etc-directory (acdw/dir)
@@ -408,8 +414,7 @@
408(setup (:straight (gemini-mode 414(setup (:straight (gemini-mode
409 :host nil 415 :host nil
410 :repo "https://git.carcosa.net/jmcbray/gemini.el.git")) 416 :repo "https://git.carcosa.net/jmcbray/gemini.el.git"))
411 (:option (append auto-mode-alist) 417 (:mode "\\.\\(gemini\\|gmi\\)\\'"))
412 '("\\.\\(gemini\\|gmi\\)\\'" . gemini-mode)))
413 418
414(setup dired 419(setup dired
415 (:option dired-recursive-copies 'always 420 (:option dired-recursive-copies 'always
@@ -450,8 +455,8 @@
450 magit-popup-display-buffer-action '((display-buffer-same-window)))) 455 magit-popup-display-buffer-action '((display-buffer-same-window))))
451 456
452(setup (:straight nov) 457(setup (:straight nov)
453 (:option nov-text-width fill-column 458 (:option nov-text-width fill-column)
454 (append auto-mode-alist) '("\\.epub\\'" . nov-mode))) 459 (:mode "\\.epub\\'"))
455 460
456(when (eq acdw/system :home) 461(when (eq acdw/system :home)
457 (setup (:straight pdf-tools) 462 (setup (:straight pdf-tools)
@@ -784,12 +789,11 @@ don't want."
784 789
785(when (executable-find "fennel") 790(when (executable-find "fennel")
786 (setup (:straight fennel-mode) 791 (setup (:straight fennel-mode)
787 (autoload 'fennel-mode "fennel-mode" nil t)
788 (autoload 'fennel-repl "fennel-mode" nil t) 792 (autoload 'fennel-repl "fennel-mode" nil t)
789 (:option (append auto-mode-alist) '("\\.fnl\\'" . fennel-mode)))) 793 (:mode "\\.fnl\\'")))
790 794
791(setup (:straight lua-mode) 795(setup (:straight lua-mode)
792 (:option (append auto-mode-alist) '("\\.lua\\'" . lua-mode))) 796 (:mode "\\.lua\\'"))
793 797
794(setup sh-mode 798(setup sh-mode
795 (:option sh-basic-offset tab-width 799 (:option sh-basic-offset tab-width
@@ -812,15 +816,13 @@ don't want."
812 (:option css-level-offset 2 816 (:option css-level-offset 2
813 js-indent-level 2 817 js-indent-level 2
814 sgml-indent-offset 2) 818 sgml-indent-offset 2)
815 (dolist (extension '("\\(p\\|dj\\)?html" 819 (:mode "\\.\\(p\\|dj\\)?html\\'"
816 "html?" 820 "\\.html?\\'"
817 "\\(tpl\\.\\)?php" 821 "\\.\\(tpl\\.\\)?php\\'"
818 "[agj]sp" 822 "\\.[agj]sp\\'"
819 "as[cp]x" 823 "\\.as[cp]x\\'"
820 "erb" 824 "\\.erb\\'"
821 "mustache")) 825 "\\.mustache\\'"))
822 (add-to-list 'auto-mode-alist
823 `(,(concat "\\." extension "\\'") . web-mode))))
824 826
825(when (locate-library "gforth") 827(when (locate-library "gforth")
826 (autoload 'forth-mode "gforth") 828 (autoload 'forth-mode "gforth")