about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--early-init.el3
-rw-r--r--init.el41
-rw-r--r--lisp/acdw.el82
3 files changed, 100 insertions, 26 deletions
diff --git a/early-init.el b/early-init.el index b8f652e..53059cd 100644 --- a/early-init.el +++ b/early-init.el
@@ -28,7 +28,8 @@
28;;; Speed up init 28;;; Speed up init
29;; see doom-emacs, et al. 29;; see doom-emacs, et al.
30 30
31(setq orig-file-name-handler-alist file-name-handler-alist 31(setq load-prefer-newer noninteractive
32 orig-file-name-handler-alist file-name-handler-alist
32 file-name-handler-alist nil) 33 file-name-handler-alist nil)
33(acdw/gc-disable) 34(acdw/gc-disable)
34 35
diff --git a/init.el b/init.el index 4b0bd8c..033b907 100644 --- a/init.el +++ b/init.el
@@ -66,7 +66,7 @@
66 calendar-longitude -91.1) 66 calendar-longitude -91.1)
67 67
68 ;; Lines 68 ;; Lines
69 (:option fill-column 80 69 (:option fill-column 79
70 word-wrap t 70 word-wrap t
71 truncate-lines nil) 71 truncate-lines nil)
72 72
@@ -115,7 +115,7 @@
115 ;; Cursor 115 ;; Cursor
116 (:option cursor-type 'bar 116 (:option cursor-type 'bar
117 cursor-in-non-selected-windows 'hollow 117 cursor-in-non-selected-windows 'hollow
118 blink-cursor-blinks 1) 118 blink-cursor-blinks 1)
119 (blink-cursor-mode +1) 119 (blink-cursor-mode +1)
120 120
121 ;; Scrolling 121 ;; Scrolling
@@ -306,7 +306,14 @@
306 (write-region "" nil ispell-personal-dictionary nil 0)) 306 (write-region "" nil ispell-personal-dictionary nil 0))
307 307
308 (add-hook 'text-mode-hook #'flyspell-mode) 308 (add-hook 'text-mode-hook #'flyspell-mode)
309 (add-hook 'prog-mode-hook #'flyepell-prog-mode)) 309 (add-hook 'prog-mode-hook #'flyspell-prog-mode))
310
311(setup scratch
312 (hook-defun immortal-scratch kill-buffer-query-functions
313 (if (eq (current-buffer (get-buffer "*scratch*")))
314 (progn (bury-buffer)
315 nil)
316 t)))
310 317
311 318
312;; Applications 319;; Applications
@@ -405,17 +412,17 @@
405 '("\\.\\(gemini\\|gmi\\)\\'" . gemini-mode))) 412 '("\\.\\(gemini\\|gmi\\)\\'" . gemini-mode)))
406 413
407(setup dired 414(setup dired
408 (:setq-default dired-recursive-copies 'always 415 (:option dired-recursive-copies 'always
409 dired-recursive-deletes 'always 416 dired-recursive-deletes 'always
410 delete-by-moving-to-trash t 417 delete-by-moving-to-trash t
411 dired-listing-switches "-Al" 418 dired-listing-switches "-Al"
412 ls-lisp-dirs-first t 419 ls-lisp-dirs-first t
413 dired-ls-F-marks-symlinks t 420 dired-ls-F-marks-symlinks t
414 dired-no-confirm '(byte-compile 421 dired-no-confirm '(byte-compile
415 chgrp chmod chown copy 422 chgrp chmod chown copy
416 hardlink load move 423 hardlink load move
417 shell touch symlink) 424 shell touch symlink)
418 dired-dwim-target t) 425 dired-dwim-target t)
419 (:also-load dired-x) 426 (:also-load dired-x)
420 (:hook dired-hide-details-mode 427 (:hook dired-hide-details-mode
421 hl-line-mode) 428 hl-line-mode)
@@ -435,7 +442,7 @@
435 (:option trashed-action-confirmer 'y-or-n-p)))) 442 (:option trashed-action-confirmer 'y-or-n-p))))
436 443
437(setup (:straight magit) 444(setup (:straight magit)
438 (:acdw/leader "g" magit-status) 445 (:leader "g" magit-status)
439 (:option magit-display-buffer-function 446 (:option magit-display-buffer-function
440 (defun magit-display-buffer-same-window (buffer) 447 (defun magit-display-buffer-same-window (buffer)
441 "Display BUFFER in the selected window like God intended." 448 "Display BUFFER in the selected window like God intended."
@@ -736,8 +743,8 @@ if ripgrep is installed, otherwise `consult-grep'."
736(when (executable-find "fennel") 743(when (executable-find "fennel")
737 (setup (:straight fennel-mode) 744 (setup (:straight fennel-mode)
738 (autoload 'fennel-mode "fennel-mode" nil t) 745 (autoload 'fennel-mode "fennel-mode" nil t)
739 (:option (append auto-mode-alist) '("\\.fnl\\'" . fennel-mode)) 746 (autoload 'fennel-repl "fennel-mode" nil t)
740 (:bind "C-c C-c" ))) 747 (:option (append auto-mode-alist) '("\\.fnl\\'" . fennel-mode))))
741 748
742(setup (:straight geiser)) 749(setup (:straight geiser))
743 750
diff --git a/lisp/acdw.el b/lisp/acdw.el index 69f9a7f..7b555fd 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el
@@ -22,9 +22,9 @@
22;; Utility constants 22;; Utility constants
23 23
24(defconst acdw/system (pcase system-type 24(defconst acdw/system (pcase system-type
25 ('gnu/linux :home) 25 ('gnu/linux :home)
26 ((or 'msdos 'windows-nt) :work) 26 ((or 'msdos 'windows-nt) :work)
27 (_ :other)) 27 (_ :other))
28 "Which computer system is currently being used.") 28 "Which computer system is currently being used.")
29 29
30 30
@@ -38,7 +38,7 @@ is unfocused."
38 `(progn 38 `(progn
39 (defun ,func-name () "Defined by `when-unfocused'." 39 (defun ,func-name () "Defined by `when-unfocused'."
40 (when (seq-every-p #'null 40 (when (seq-every-p #'null
41 (mapcar #'frame-focus-state (frame-list))) 41 (mapcar #'frame-focus-state (frame-list)))
42 ,@forms)) 42 ,@forms))
43 (add-function :after after-focus-change-function #',func-name)))) 43 (add-function :after after-focus-change-function #',func-name))))
44 44
@@ -52,7 +52,7 @@ each hook in HOOKS."
52 `(progn 52 `(progn
53 (defun ,func-name () "Defined by `hook-defun'." ,@forms) 53 (defun ,func-name () "Defined by `hook-defun'." ,@forms)
54 ,@(dolist (hook hook-list hook-defun-add-hook-list) 54 ,@(dolist (hook hook-list hook-defun-add-hook-list)
55 (push `(add-hook ',hook #',func-name) hook-defun-add-hook-list))))) 55 (push `(add-hook ',hook #',func-name) hook-defun-add-hook-list)))))
56 56
57(defun refresh-emacs () 57(defun refresh-emacs ()
58 "Reload Emacs's configuration files." 58 "Reload Emacs's configuration files."
@@ -73,7 +73,7 @@ if MAKE-DIRECTORY is non-nil."
73 user-emacs-directory))) 73 user-emacs-directory)))
74 (if file 74 (if file
75 (let ((file-name (expand-file-name (convert-standard-filename file) 75 (let ((file-name (expand-file-name (convert-standard-filename file)
76 dir))) 76 dir)))
77 (when make-directory 77 (when make-directory
78 (make-directory (file-name-directory file-name) 'parents)) 78 (make-directory (file-name-directory file-name) 'parents))
79 file-name) 79 file-name)
@@ -82,12 +82,33 @@ if MAKE-DIRECTORY is non-nil."
82(defun acdw/gc-enable () 82(defun acdw/gc-enable ()
83 "Enable the Garbage collector." 83 "Enable the Garbage collector."
84 (setq gc-cons-threshold (* 800 1024 1024) 84 (setq gc-cons-threshold (* 800 1024 1024)
85 gc-cons-percentage 0.1)) 85 gc-cons-percentage 0.1))
86 86
87(defun acdw/gc-disable () 87(defun acdw/gc-disable ()
88 "Functionally disable the Garbage collector." 88 "Functionally disable the Garbage collector."
89 (setq gc-cons-threshold most-positive-fixnum 89 (setq gc-cons-threshold most-positive-fixnum
90 gc-cons-percentage 0.8)) 90 gc-cons-percentage 0.8))
91
92(defun acdw/sunrise-sunset (sunrise-command sunset-command)
93 "Run commands at sunrise and sunset."
94 (let* ((times-regex (rx (* nonl)
95 (: (any ?s ?S) "unrise") " "
96 (group (repeat 1 2 digit) ":"
97 (repeat 1 2 digit)
98 (: (any ?a ?A ?p ?P) (any ?m ?M)))
99 (* nonl)
100 (: (any ?s ?S) "unset") " "
101 (group (repeat 1 2 digit) ":"
102 (repeat 1 2 digit)
103 (: (any ?a ?A ?p ?P) (any ?m ?M)))
104 (* nonl)))
105 (ss (sunrise-sunset))
106 (_m (string-match times-regex ss))
107 (sunrise-time (match-string 1 ss))
108 (sunset-time (match-string 2 ss)))
109 (run-at-time sunrise-time (* 60 60 24) sunrise-command)
110 (run-at-time sunset-time (* 60 60 24) sunset-command)
111 (run-at-time "12:00am" (* 60 60 24) sunset-command)))
91 112
92 113
93;; Make `C-z' more useful 114;; Make `C-z' more useful
@@ -98,5 +119,50 @@ if MAKE-DIRECTORY is non-nil."
98 (define-key map "\C-z" c-z) 119 (define-key map "\C-z" c-z)
99 map)) 120 map))
100 121
122
123;; `acdw/reading-mode'
124(define-minor-mode acdw/reading-mode
125 "A mode for reading."
126 :init-value nil
127 :lighter " Read"
128 (if acdw/reading-mode
129 (progn ;; turn on
130 ;; settings
131 (setq-local mode-line-format
132 '(:eval
133 (let* ((fmt " Reading %b")
134 (len (length (format-mode-line fmt))))
135 (concat
136 (propertize " "
137 'display `((space :align-to (- right
138 ,len)))
139 'face '(:inherit italic))
140 fmt)))
141 orig-indicate-empty-lines indicate-empty-lines
142 indicate-empty-lines nil
143 orig-indicate-buffer-boundaries indicate-buffer-boundaries
144 indicate-buffer-boundaries nil)
145 ;; disable modes
146 (dolist (mode '(display-fill-column-indicator-mode))
147 (when (fboundp mode)
148 (funcall mode -1)))
149 ;; enable modes
150 (dolist (mode '(iscroll-mode olivetti-mode))
151 (when (fboundp mode)
152 (funcall mode +1))))
153 ;; turn off
154 ;; settings
155 (setq-local indicate-empty-lines orig-indicate-empty-lines
156 indicate-buffer-boundaries orig-indicate-buffer-boundaries)
157 (kill-local-variable 'mode-line-format)
158 ;; enable modes
159 (dolist (mode '(display-fill-column-indicator-mode))
160 (when (fboundp mode)
161 (funcall mode +1)))
162 ;; disable modes
163 (dolist (mode '(olivetti-mode iscroll-mode))
164 (when (fboundp mode)
165 (funcall mode -1)))))
166
101(provide 'acdw) 167(provide 'acdw)
102;;; acdw.el ends here 168;;; acdw.el ends here