diff options
-rw-r--r-- | early-init.el | 10 | ||||
-rw-r--r-- | init.el | 89 | ||||
-rw-r--r-- | lisp/acdw-modeline.el | 82 | ||||
-rw-r--r-- | lisp/acdw.el | 27 |
4 files changed, 152 insertions, 56 deletions
diff --git a/early-init.el b/early-init.el index 62d8217..5ef77f7 100644 --- a/early-init.el +++ b/early-init.el | |||
@@ -77,7 +77,7 @@ | |||
77 | (left-fringe . 8) ; Width of fringes | 77 | (left-fringe . 8) ; Width of fringes |
78 | (right-fringe . 8) ; (8 is default) | 78 | (right-fringe . 8) ; (8 is default) |
79 | (font . ,(pcase acdw/system | 79 | (font . ,(pcase acdw/system |
80 | (:home "Terminus 12") | 80 | (:home "DejaVu Sans Mono 10") |
81 | (:work "Consolas 10")))) | 81 | (:work "Consolas 10")))) |
82 | frame-inhibit-implied-resize t ; Don't resize randomly | 82 | frame-inhibit-implied-resize t ; Don't resize randomly |
83 | frame-resize-pixelwise t ; Resize by pixels, not chars | 83 | frame-resize-pixelwise t ; Resize by pixels, not chars |
@@ -160,3 +160,11 @@ | |||
160 | gcs-done)) | 160 | gcs-done)) |
161 | 161 | ||
162 | (add-hook 'emacs-startup-hook #'hook--message-startup-time) | 162 | (add-hook 'emacs-startup-hook #'hook--message-startup-time) |
163 | |||
164 | ;;; Install `no-littering', pointing both directories at `acdw/dir'. This will | ||
165 | ;;; take care of the packages I don't care about configuring. | ||
166 | |||
167 | (straight-use-package 'no-littering) | ||
168 | (setq no-littering-etc-directory acdw/dir | ||
169 | no-littering-var-directory acdw/dir) | ||
170 | (require 'no-littering) | ||
diff --git a/init.el b/init.el index 47b8462..d0b6f6a 100644 --- a/init.el +++ b/init.el | |||
@@ -258,6 +258,9 @@ | |||
258 | (when (require 'imenu) | 258 | (when (require 'imenu) |
259 | (acdw/set '((imenu-auto-rescan t)))) | 259 | (acdw/set '((imenu-auto-rescan t)))) |
260 | 260 | ||
261 | ;; Fonts | ||
262 | (acdw/set-faces ((fixed-pitch . ((t (:inherit default)))))) | ||
263 | |||
261 | ;;; Packages | 264 | ;;; Packages |
262 | 265 | ||
263 | ;; Undo-fu | 266 | ;; Undo-fu |
@@ -283,68 +286,39 @@ | |||
283 | (modus-themes-scale-headings nil) | 286 | (modus-themes-scale-headings nil) |
284 | (modus-themes-mode-line nil)) | 287 | (modus-themes-mode-line nil)) |
285 | :now ((acdw/sunrise-sunset #'modus-themes-load-operandi | 288 | :now ((acdw/sunrise-sunset #'modus-themes-load-operandi |
286 | #'modus-themes-load-vivendi))) | 289 | #'modus-themes-load-vivendi) |
290 | ;; for june | ||
291 | (global-font-lock-mode -1))) | ||
292 | |||
293 | ;; Expand-region | ||
294 | (acdw/pkg expand-region | ||
295 | :binds (("C-=" er/expand-region))) | ||
296 | |||
297 | ;;; Frame title | ||
298 | |||
299 | (acdw/set `((frame-title-format | ||
300 | "%b %+%* GNU Emacs"))) | ||
287 | 301 | ||
288 | ;;; Mode line | 302 | ;;; Mode line |
289 | 303 | ||
290 | ;; Minions | 304 | ;; Minions |
291 | (acdw/pkg minions | 305 | (acdw/pkg minions) |
292 | :now ((minions-mode +1))) | ||
293 | 306 | ||
294 | ;; Simple mode line | 307 | ;; Simple mode line |
295 | (acdw/pkg simple-modeline | 308 | (acdw/pkg simple-modeline |
296 | :set '((simple-modeline-segments | 309 | :set '((simple-modeline-segments |
297 | ((;; left | 310 | ((;; left |
298 | acdw/modeline-modified | 311 | acdw-modeline/modified |
299 | simple-modeline-segment-buffer-name | 312 | acdw-modeline/buffer-name |
300 | simple-modeline-segment-position) | 313 | simple-modeline-segment-position |
314 | simple-modeline-segment-word-count) | ||
301 | (;; right | 315 | (;; right |
302 | simple-modeline-segment-vc | 316 | acdw-modeline/vc-branch |
303 | simple-modeline-segment-misc-info | 317 | simple-modeline-segment-misc-info |
304 | simple-modeline-segment-process | 318 | simple-modeline-segment-process |
305 | acdw/modeline-minions | 319 | acdw-modeline/minions |
306 | simple-modeline-segment-major-mode)))) | 320 | simple-modeline-segment-major-mode)))) |
307 | :now ((defun acdw/modeline-modified () | 321 | :now ((require 'acdw-modeline) |
308 | "Displays a color-coded buffer modification/read-only | ||
309 | indicator in the mode-line." | ||
310 | (if (not (string-match-p "\\*.*\\*" (buffer-name))) | ||
311 | (let* ((read-only (and buffer-read-only (buffer-file-name))) | ||
312 | (modified (buffer-modified-p))) | ||
313 | (propertize | ||
314 | (if read-only " ×" (if modified " ●" " ○")) | ||
315 | 'face `(:inherit | ||
316 | ,(if modified 'simple-modeline-status-modified | ||
317 | (if read-only 'simple-modeline-status-error | ||
318 | 'simple-modeline-unimportant))) | ||
319 | 'help-echo (format | ||
320 | (concat "Buffer is %s and %smodified\n" | ||
321 | "mouse-1: Toggle read-only status.") | ||
322 | (if read-only "read-only" "writable") | ||
323 | (if modified "" "not ")) | ||
324 | 'local-map (purecopy (simple-modeline-make-mouse-map | ||
325 | 'mouse-1 | ||
326 | (lambda (event) | ||
327 | (interactive "e") | ||
328 | (with-selected-window | ||
329 | (posn-window (event-start event)) | ||
330 | (read-only-mode 'toggle))))) | ||
331 | 'mouse-face 'mode-line-highlight)))) | ||
332 | (defun acdw/modeline-minions () | ||
333 | "Display a button for `minions-minor-modes-menu'." | ||
334 | (concat | ||
335 | " " | ||
336 | (propertize | ||
337 | "ⱷ" | ||
338 | 'help-echo (format | ||
339 | "Minor modes menu\nmouse-1: show menu.") | ||
340 | 'local-map (purecopy (simple-modeline-make-mouse-map | ||
341 | 'mouse-1 | ||
342 | (lambda (event) | ||
343 | (interactive "e") | ||
344 | (with-selected-window (posn-window | ||
345 | (event-start event)) | ||
346 | (minions-minor-modes-menu))))) | ||
347 | 'mouse-face 'mode-line-highlight))) | ||
348 | (simple-modeline-mode +1))) | 322 | (simple-modeline-mode +1))) |
349 | 323 | ||
350 | ;;; Magit | 324 | ;;; Magit |
@@ -416,7 +390,19 @@ indicator in the mode-line." | |||
416 | (org-export-headline-levels 8) | 390 | (org-export-headline-levels 8) |
417 | (org-export-with-smart-quotes t) | 391 | (org-export-with-smart-quotes t) |
418 | (org-export-with-sub-superscripts t)) | 392 | (org-export-with-sub-superscripts t)) |
419 | :hooks ((before-save-hook acdw/hook--org-mode-fix-blank-lines))) | 393 | :hooks ((before-save-hook acdw/hook--org-mode-fix-blank-lines)) |
394 | :binds (("RET" unpackaged/org-return-dwim | ||
395 | :map org-mode-map :map-after 'org))) | ||
396 | |||
397 | ;;; Nov.el -- ebook reader | ||
398 | (acdw/pkg nov | ||
399 | :now ((autoload #'nov-mode "nov") | ||
400 | (add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode))) | ||
401 | :set `((nov-text-width ,fill-column))) | ||
402 | |||
403 | ;;; 0x0 -- upload files | ||
404 | (acdw/pkg (0x0 :repo "https://git.sr.ht/~zge/nullpointer-emacs") | ||
405 | :set '((0x0-default-host ttm))) | ||
420 | 406 | ||
421 | ;;; Programming languages | 407 | ;;; Programming languages |
422 | 408 | ||
@@ -434,6 +420,9 @@ indicator in the mode-line." | |||
434 | (put 'dotimes-protect 'common-lisp-indent-function | 420 | (put 'dotimes-protect 'common-lisp-indent-function |
435 | (get 'when 'common-lisp-indent-function))) | 421 | (get 'when 'common-lisp-indent-function))) |
436 | 422 | ||
423 | ;; Racket | ||
424 | (acdw/pkg racket-mode) | ||
425 | |||
437 | ;;; Miscellaneous | 426 | ;;; Miscellaneous |
438 | 427 | ||
439 | (acdw/set '((disabled-command-function nil) | 428 | (acdw/set '((disabled-command-function nil) |
diff --git a/lisp/acdw-modeline.el b/lisp/acdw-modeline.el new file mode 100644 index 0000000..89037f9 --- /dev/null +++ b/lisp/acdw-modeline.el | |||
@@ -0,0 +1,82 @@ | |||
1 | :;;; acdw-modeline.el -*- lexical-binding: t; coding: utf-8-unix -*- | ||
2 | ;; | ||
3 | ;; Author: Case Duckworth <acdw@acdw.net> | ||
4 | ;; Created: Sometime during Covid-19, 2020 | ||
5 | ;; Keywords: configuration | ||
6 | ;; URL: https://tildegit.org/acdw/emacs | ||
7 | ;; | ||
8 | ;; This file is NOT part of GNU Emacs. | ||
9 | ;; | ||
10 | ;;; License: | ||
11 | ;; | ||
12 | ;; Everyone is permitted to do whatever with this software, without | ||
13 | ;; limitation. This software comes without any warranty whatsoever, | ||
14 | ;; but with two pieces of advice: | ||
15 | ;; - Don't hurt yourself. | ||
16 | ;; - Make good choices. | ||
17 | ;; | ||
18 | ;;; Commentary: | ||
19 | ;; `acdw-modeline' is a dumping ground for extra modeline functions, so they | ||
20 | ;; don't clutter up `init.el'. | ||
21 | ;; | ||
22 | ;;; Code: | ||
23 | |||
24 | (require 'simple-modeline) | ||
25 | (require 'minions) | ||
26 | |||
27 | ;; modified from `simple-modeline' | ||
28 | (defun acdw-modeline/modified () | ||
29 | "Displays a color-coded buffer modification/read-only | ||
30 | indicator in the mode-line." | ||
31 | (if (not (string-match-p "\\*.*\\*" (buffer-name))) | ||
32 | (let* ((read-only (and buffer-read-only (buffer-file-name))) | ||
33 | (modified (buffer-modified-p))) | ||
34 | (propertize | ||
35 | (if read-only " =" (if modified " +" " -")) | ||
36 | 'help-echo (format | ||
37 | (concat "Buffer is %s and %smodified\n" | ||
38 | "mouse-1: Toggle read-only status.") | ||
39 | (if read-only "read-only" "writable") | ||
40 | (if modified "" "not ")) | ||
41 | 'local-map (purecopy (simple-modeline-make-mouse-map | ||
42 | 'mouse-1 | ||
43 | (lambda (event) | ||
44 | (interactive "e") | ||
45 | (with-selected-window | ||
46 | (posn-window (event-start event)) | ||
47 | (read-only-mode 'toggle))))) | ||
48 | 'mouse-face 'mode-line-highlight)))) | ||
49 | |||
50 | ;; all me, baby | ||
51 | (defun acdw-modeline/minions () | ||
52 | "Display a button for `minions-minor-modes-menu'." | ||
53 | (concat | ||
54 | " " | ||
55 | (propertize | ||
56 | "&" | ||
57 | 'help-echo (format | ||
58 | "Minor modes menu\nmouse-1: show menu.") | ||
59 | 'local-map (purecopy (simple-modeline-make-mouse-map | ||
60 | 'mouse-1 | ||
61 | (lambda (event) | ||
62 | (interactive "e") | ||
63 | (with-selected-window (posn-window | ||
64 | (event-start event)) | ||
65 | (minions-minor-modes-menu))))) | ||
66 | 'mouse-face 'mode-line-highlight))) | ||
67 | |||
68 | ;; from https://www.gonsie.com/blorg/modeline.html, from Doom | ||
69 | (defun acdw-modeline/vc-branch () | ||
70 | (let ((backend (vc-backend buffer-file-name))) | ||
71 | (substring vc-mode (+ (if (eq backend 'Hg) 2 3) 2)))) | ||
72 | |||
73 | ;; from gonsie | ||
74 | (defun acdw-modeline/buffer-name () | ||
75 | (propertize " %b " | ||
76 | 'face | ||
77 | (if (buffer-modified-p) | ||
78 | 'font-lock-warning-face | ||
79 | 'font-lock-type-face) | ||
80 | 'help-echo (buffer-file-name))) | ||
81 | |||
82 | (provide 'acdw-modeline) | ||
diff --git a/lisp/acdw.el b/lisp/acdw.el index 84fcb99..e25de43 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el | |||
@@ -145,20 +145,37 @@ otherwise it's wrapped in `kbd'. | |||
145 | The following keywords are recognized: | 145 | The following keywords are recognized: |
146 | 146 | ||
147 | :after ARGS .. call `autoload' on COMMAND using ARGS before | 147 | :after ARGS .. call `autoload' on COMMAND using ARGS before |
148 | binding the key. ARGS can be just the filename to | 148 | binding the key. ARGS can be just the filename to |
149 | load; in that case it's wrapped in a list. | 149 | load; in that case it's wrapped in a list. |
150 | |||
150 | :map KEYMAP .. define KEY in KEYMAP instead of the | 151 | :map KEYMAP .. define KEY in KEYMAP instead of the |
151 | default `acdw/bind-default-map'." | 152 | default `acdw/bind-default-map'. If `:after' is also supplied, |
153 | run `autoload' on KEYMAP (except when using `:map-after', see). | ||
154 | |||
155 | :map-after FILE .. run the underlying `define-key' command in an | ||
156 | `with-eval-after-load'. For the rare occasion when the keymap is | ||
157 | defined in a different file than the command it binds (looking | ||
158 | at you, `org-mode')." | ||
152 | (let ((after (when-let (sym (plist-get args :after)) | 159 | (let ((after (when-let (sym (plist-get args :after)) |
153 | (if (not (listp sym)) | 160 | (if (not (listp sym)) |
154 | (list sym) | 161 | (list sym) |
155 | sym))) | 162 | sym))) |
163 | (map-after (plist-get args :map-after)) | ||
156 | (keymap (or (plist-get args :map) acdw/bind-default-map)) | 164 | (keymap (or (plist-get args :map) acdw/bind-default-map)) |
157 | (keycode (if (vectorp key) key (kbd key))) | 165 | (keycode (if (vectorp key) key (kbd key))) |
158 | (command-list)) | 166 | (command-list)) |
159 | (push `(define-key ,keymap ,keycode ',command) command-list) | 167 | (let ((define-key-command `(define-key ,keymap ,keycode ',command))) |
168 | (if map-after | ||
169 | (push `(with-eval-after-load ,map-after | ||
170 | ,define-key-command) | ||
171 | command-list) | ||
172 | (push define-key-command command-list))) | ||
160 | (when after | 173 | (when after |
161 | (push `(autoload ',command ,@after) command-list)) | 174 | (unless (fboundp command) |
175 | (push `(autoload ',command ,@after) command-list)) | ||
176 | (unless (or map-after | ||
177 | (eq keymap acdw/bind-default-map)) | ||
178 | (push `(autoload ',keymap ,(car after) nil nil 'keymap) command-list))) | ||
162 | `(progn | 179 | `(progn |
163 | ,@command-list))) | 180 | ,@command-list))) |
164 | 181 | ||