summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--init.el52
-rw-r--r--lisp/acdw.el39
2 files changed, 59 insertions, 32 deletions
diff --git a/init.el b/init.el index a21e35d..a064bda 100644 --- a/init.el +++ b/init.el
@@ -49,12 +49,6 @@
49 :documentation "Bind KEY to COMMAND in `acdw/leader' (C-z) map." 49 :documentation "Bind KEY to COMMAND in `acdw/leader' (C-z) map."
50 :repeatable t) 50 :repeatable t)
51 51
52(setup-define :mode
53 (lambda (ext)
54 `(add-to-list 'auto-mode-alist (cons ,ext setup-mode)))
55 :documentation "Add SETUP-MODE to `auto-mode-alist' for EXTENSION."
56 :repeatable t)
57
58;;; `no-littering' 52;;; `no-littering'
59(setup (:straight no-littering) 53(setup (:straight no-littering)
60 (:option no-littering-etc-directory (acdw/dir) 54 (:option no-littering-etc-directory (acdw/dir)
@@ -179,7 +173,7 @@
179 completion-category-defaults nil 173 completion-category-defaults nil
180 completion-category-overrides 174 completion-category-overrides
181 '((file (styles . (partial-completion))))) 175 '((file (styles . (partial-completion)))))
182 (icomplete-mode +1) 176 ;; (icomplete-mode +1)
183 177
184 ;; Emoji 178 ;; Emoji
185 (let ((ffl (font-family-list))) 179 (let ((ffl (font-family-list)))
@@ -257,7 +251,8 @@
257 "C-c i" acdw/find-emacs-dotfiles 251 "C-c i" acdw/find-emacs-dotfiles
258 "C-x k" acdw/kill-a-buffer) 252 "C-x k" acdw/kill-a-buffer)
259 253
260 (:leader "C-c" save-buffers-kill-emacs) 254 (:leader "C-c" save-buffers-kill-emacs
255 "t" acdw/insert-iso-date)
261 256
262 ;;; Advice 257 ;;; Advice
263 ;; `acdw/kill-line-and-join-advice' cribs from `crux-kill-and-join-forward'. 258 ;; `acdw/kill-line-and-join-advice' cribs from `crux-kill-and-join-forward'.
@@ -478,6 +473,7 @@
478 (:option elpher-ipv4-always t 473 (:option elpher-ipv4-always t
479 elpher-certificate-directory (acdw/dir "elpher/") 474 elpher-certificate-directory (acdw/dir "elpher/")
480 elpher-gemini-max-fill-width fill-column) 475 elpher-gemini-max-fill-width fill-column)
476 (:leader "e" elpher-bookmarks)
481 (:bind "n" elpher-next-link 477 (:bind "n" elpher-next-link
482 "p" elpher-prev-link 478 "p" elpher-prev-link
483 "o" elpher-follow-current-link 479 "o" elpher-follow-current-link
@@ -497,7 +493,16 @@
497(setup (:straight (gemini-mode 493(setup (:straight (gemini-mode
498 :host nil 494 :host nil
499 :repo "https://git.carcosa.net/jmcbray/gemini.el.git")) 495 :repo "https://git.carcosa.net/jmcbray/gemini.el.git"))
500 (:mode "\\.\\(gemini\\|gmi\\)\\'")) 496 (:file-match "\\.\\(gemini\\|gmi\\)\\'"))
497
498(setup (:straight (gemini-write
499 :host nil
500 :repo "https://alexschroeder.ch/cgit/gemini-write"
501 :fork
502 (:repo "https://tildegit.org/acdw/gemini-write"
503 :branch "main")))
504 (with-eval-after-load 'elpher
505 (require 'gemini-write)))
501 506
502(setup dired 507(setup dired
503 (setq-default dired-recursive-copies 'always 508 (setq-default dired-recursive-copies 'always
@@ -551,7 +556,7 @@
551 556
552(setup (:straight nov) 557(setup (:straight nov)
553 (:option nov-text-width fill-column) 558 (:option nov-text-width fill-column)
554 (:mode "\\.epub\\'")) 559 (:file-match "\\.epub\\'"))
555 560
556(setup gnus 561(setup gnus
557 (:option gnus-home-directory (expand-file-name "gnus" user-emacs-directory) 562 (:option gnus-home-directory (expand-file-name "gnus" user-emacs-directory)
@@ -845,6 +850,8 @@ if ripgrep is installed, otherwise `consult-grep'."
845 850
846(setup (:straight paredit) 851(setup (:straight paredit)
847 852
853 ;; I don't use paredit-splice-sexp much, and it stomps on isearch.
854 (:unbind "M-s")
848 (defun setup-paredit-mode () 855 (defun setup-paredit-mode ()
849 "Correct weirdnesses and set up paredit mode." 856 "Correct weirdnesses and set up paredit mode."
850 (paredit-mode +1) 857 (paredit-mode +1)
@@ -914,10 +921,10 @@ if ripgrep is installed, otherwise `consult-grep'."
914(when (executable-find "fennel") 921(when (executable-find "fennel")
915 (setup (:straight fennel-mode) 922 (setup (:straight fennel-mode)
916 (autoload 'fennel-repl "fennel-mode" nil t) 923 (autoload 'fennel-repl "fennel-mode" nil t)
917 (:mode "\\.fnl\\'"))) 924 (:file-match "\\.fnl\\'")))
918 925
919(setup (:straight lua-mode) 926(setup (:straight lua-mode)
920 (:mode "\\.lua\\'")) 927 (:file-match "\\.lua\\'"))
921 928
922(setup sh-mode 929(setup sh-mode
923 (:option sh-basic-offset tab-width 930 (:option sh-basic-offset tab-width
@@ -940,13 +947,13 @@ if ripgrep is installed, otherwise `consult-grep'."
940 (:option css-level-offset 2 947 (:option css-level-offset 2
941 js-indent-level 2 948 js-indent-level 2
942 sgml-indent-offset 2) 949 sgml-indent-offset 2)
943 (:mode "\\.\\(p\\|dj\\)?html\\'" 950 (:file-match "\\.\\(p\\|dj\\)?html\\'"
944 "\\.html?\\'" 951 "\\.html?\\'"
945 "\\.\\(tpl\\.\\)?php\\'" 952 "\\.\\(tpl\\.\\)?php\\'"
946 "\\.[agj]sp\\'" 953 "\\.[agj]sp\\'"
947 "\\.as[cp]x\\'" 954 "\\.as[cp]x\\'"
948 "\\.erb\\'" 955 "\\.erb\\'"
949 "\\.mustache\\'")) 956 "\\.mustache\\'"))
950 957
951(when (locate-library "gforth") 958(when (locate-library "gforth")
952 (autoload 'forth-mode "gforth") 959 (autoload 'forth-mode "gforth")
@@ -956,3 +963,10 @@ if ripgrep is installed, otherwise `consult-grep'."
956 963
957(when (eq acdw/system :home) 964(when (eq acdw/system :home)
958 (setup (:straight pkgbuild-mode))) 965 (setup (:straight pkgbuild-mode)))
966
967
968;;; Server
969
970(require 'server)
971(unless (server-running-p)
972 (server-start))
diff --git a/lisp/acdw.el b/lisp/acdw.el index f1c1a8d..96b69f9 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el
@@ -57,19 +57,26 @@ each hook in HOOKS."
57(defun refresh-emacs () 57(defun refresh-emacs ()
58 "Reload Emacs's configuration files." 58 "Reload Emacs's configuration files."
59 (interactive) 59 (interactive)
60 (dolist (file (append 60 (let ((init-files (append
61 ;; Load lisp libraries first, in case their functionality is 61 ;; Load lisp libraries first, in case their functionality
62 ;; used by {early-,}init.el 62 ;; is used by {early-,}init.el
63 (let* ((dir (expand-file-name "lisp/" user-emacs-directory)) 63 (let* ((dir (expand-file-name "lisp/"
64 (full-name (lambda (f) 64 user-emacs-directory))
65 (concat (file-name-as-directory dir) f)))) 65 (full-name (lambda (f)
66 (mapcar full-name (directory-files dir nil "\\.el\\'"))) 66 (concat
67 ;; Load regular init files 67 (file-name-as-directory dir) f))))
68 (list (locate-user-emacs-file "early-init.el") 68 (mapcar full-name (directory-files dir nil "\\.el\\'")))
69 (locate-user-emacs-file "init.el" ".emacs")))) 69 ;; Load regular init files
70 (with-message (format "Loading %s" file) 70 (list (locate-user-emacs-file "early-init.el")
71 (when (file-exists-p file) 71 (locate-user-emacs-file "init.el" ".emacs"))))
72 (load-file file))))) 72 (debug-on-error t))
73 (with-message "Saving init files"
74 (save-some-buffers :no-confirm (lambda () (member (buffer-file-name)
75 init-files))))
76 (dolist (file init-files)
77 (with-message (format "Loading %s" file)
78 (when (file-exists-p file)
79 (load-file file))))))
73 80
74(defun expand-file-name-exists-p (&rest expand-file-name-args) 81(defun expand-file-name-exists-p (&rest expand-file-name-args)
75 "Call `expand-file-name' on EXPAND-FILE-NAME-ARGS, returning 82 "Call `expand-file-name' on EXPAND-FILE-NAME-ARGS, returning
@@ -162,6 +169,12 @@ Prompt only if there are unsaved changes."
162 (16 (mapc 'kill-buffer (delq (current-buffer) (buffer-list))) 169 (16 (mapc 'kill-buffer (delq (current-buffer) (buffer-list)))
163 (delete-other-windows)))) 170 (delete-other-windows))))
164 171
172(defun acdw/insert-iso-date (with-time)
173 "Insert the ISO-8601-formatted date, with optional time."
174 (interactive "P")
175 (let ((format (if with-time "%FT%T%z" "%F")))
176 (insert (format-time-string format (current-time)))))
177
165 178
166;; Make `C-z' more useful 179;; Make `C-z' more useful
167(defvar acdw/leader 180(defvar acdw/leader