summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2021-04-01 16:41:41 -0500
committerCase Duckworth2021-04-01 16:41:41 -0500
commit9af70cbf60e78309a3902315a7d444877677fdfe (patch)
tree6ca4570c50329b9668cc2669a26a6bb8151ce336
parentAdd comments (diff)
downloademacs-9af70cbf60e78309a3902315a7d444877677fdfe.tar.gz
emacs-9af70cbf60e78309a3902315a7d444877677fdfe.zip
Define `acdw/reindent-buffer' and hook into elisp
Hopefully this will put a halt to all of my whitespace commits.  Of course, this
commit also includes whitespace-only diffs.
-rw-r--r--early-init.el10
-rw-r--r--init.el31
-rw-r--r--lisp/acdw.el11
3 files changed, 30 insertions, 22 deletions
diff --git a/early-init.el b/early-init.el index 60889f8..f993d03 100644 --- a/early-init.el +++ b/early-init.el
@@ -76,11 +76,11 @@
76(defun hook--disable-ui-modes () 76(defun hook--disable-ui-modes ()
77 "Disable frame UI using modes, for toggling later." 77 "Disable frame UI using modes, for toggling later."
78 (dolist (mode ;; each mode is of the form (MODE . FRAME-ALIST-VAR) 78 (dolist (mode ;; each mode is of the form (MODE . FRAME-ALIST-VAR)
79 '((tool-bar-mode . tool-bar-lines) 79 '((tool-bar-mode . tool-bar-lines)
80 (menu-bar-mode . menu-bar-lines) 80 (menu-bar-mode . menu-bar-lines)
81 (scroll-bar-mode . vertical-scroll-bars) 81 (scroll-bar-mode . vertical-scroll-bars)
82 (horizontal-scroll-bar-mode . horizontal-scroll-bars) 82 (horizontal-scroll-bar-mode . horizontal-scroll-bars)
83 )) 83 ))
84 (let ((setting (alist-get (cdr mode) default-frame-alist))) 84 (let ((setting (alist-get (cdr mode) default-frame-alist)))
85 (when (or (not setting) 85 (when (or (not setting)
86 (= 0 setting)) 86 (= 0 setting))
diff --git a/init.el b/init.el index 5d0bc1b..12f25a6 100644 --- a/init.el +++ b/init.el
@@ -391,7 +391,7 @@
391;;;;; MWIM 391;;;;; MWIM
392(setup (:straight mwim) 392(setup (:straight mwim)
393 (:global "C-a" mwim-beginning 393 (:global "C-a" mwim-beginning
394 "C-e" mwim-end)) 394 "C-e" mwim-end))
395 395
396;;;;; Expand-region 396;;;;; Expand-region
397(setup (:straight expand-region) 397(setup (:straight expand-region)
@@ -400,20 +400,20 @@
400;;;;; CRUX 400;;;;; CRUX
401(setup (:straight crux) 401(setup (:straight crux)
402 (:global "M-o" crux-other-window-or-switch-buffer 402 (:global "M-o" crux-other-window-or-switch-buffer
403 "C-k" crux-kill-and-join-forward 403 "C-k" crux-kill-and-join-forward
404 "C-o" crux-smart-open-line-above 404 "C-o" crux-smart-open-line-above
405 "C-S-o" crux-smart-open-line 405 "C-S-o" crux-smart-open-line
406 "C-M-\\" crux-cleanup-buffer-or-region 406 "C-M-\\" crux-cleanup-buffer-or-region
407 "C-c i" crux-find-user-init-file) 407 "C-c i" crux-find-user-init-file)
408 (crux-reopen-as-root-mode +1)) 408 (crux-reopen-as-root-mode +1))
409 409
410;;;;; AVY ... & friends 410;;;;; AVY ... & friends
411(setup (:straight avy) 411(setup (:straight avy)
412 (:global "C-:" avy-goto-char 412 (:global "C-:" avy-goto-char
413 "C-'" avy-goto-char-timer 413 "C-'" avy-goto-char-timer
414 "M-g f" avy-goto-line 414 "M-g f" avy-goto-line
415 "M-g w" avy-goto-word-1 415 "M-g w" avy-goto-word-1
416 "C-c C-j" avy-resume) 416 "C-c C-j" avy-resume)
417 (eval-after-load "isearch" 417 (eval-after-load "isearch"
418 '(define-key isearch-mode-map (kbd "C-'") #'avy-isearch))) 418 '(define-key isearch-mode-map (kbd "C-'") #'avy-isearch)))
419 419
@@ -435,7 +435,7 @@ call `zzz-to-char'."
435 (add-to-list 'mode-line-misc-info '(:eval (anzu--update-mode-line))) 435 (add-to-list 'mode-line-misc-info '(:eval (anzu--update-mode-line)))
436 436
437 (:global [remap query-replace] anzu-query-replace 437 (:global [remap query-replace] anzu-query-replace
438 [remap query-replace-regexp] anzu-query-replace-regexp) 438 [remap query-replace-regexp] anzu-query-replace-regexp)
439 (:with-map isearch-mode-map 439 (:with-map isearch-mode-map
440 (:bind [remap isearch-query-replace] anzu-isearch-query-replace 440 (:bind [remap isearch-query-replace] anzu-isearch-query-replace
441 [remap isearch-query-replace-regexp] 441 [remap isearch-query-replace-regexp]
@@ -446,7 +446,7 @@ call `zzz-to-char'."
446;;;;; smart hungry delete 446;;;;; smart hungry delete
447(setup (:straight smart-hungry-delete) 447(setup (:straight smart-hungry-delete)
448 (:global "<backspace>" smart-hungry-delete-backward-char 448 (:global "<backspace>" smart-hungry-delete-backward-char
449 "C-d" smart-hungry-delete-forward-char) 449 "C-d" smart-hungry-delete-forward-char)
450 (smart-hungry-delete-add-default-hooks)) 450 (smart-hungry-delete-add-default-hooks))
451 451
452;;;; Functionality 452;;;; Functionality
@@ -458,8 +458,8 @@ call `zzz-to-char'."
458 458
459;;;;; Undo-fu 459;;;;; Undo-fu
460(setup (:straight undo-fu) 460(setup (:straight undo-fu)
461 (:global "C-/" undo-fu-only-undo 461 (:global "C-/" undo-fu-only-undo
462 "C-?" undo-fu-only-redo)) 462 "C-?" undo-fu-only-redo))
463 463
464(setup (:straight undo-fu-session) 464(setup (:straight undo-fu-session)
465 (:option undo-fu-session-incompatible-files '("/COMMIT_EDITMSG\\'" 465 (:option undo-fu-session-incompatible-files '("/COMMIT_EDITMSG\\'"
@@ -733,7 +733,8 @@ if ripgrep is installed, otherwise `consult-grep'."
733(setup emacs-lisp-mode 733(setup emacs-lisp-mode
734 (:option eval-expression-print-length nil 734 (:option eval-expression-print-length nil
735 eval-expression-print-level nil 735 eval-expression-print-level nil
736 lisp-indent-function #'lisp-indent-function)) 736 lisp-indent-function #'lisp-indent-function)
737 (:local-hook before-save-hook acdw/reindent-buffer))
737 738
738(setup (:straight macrostep) 739(setup (:straight macrostep)
739 (define-key emacs-lisp-mode-map (kbd "C-c e") #'macrostep-expand)) 740 (define-key emacs-lisp-mode-map (kbd "C-c e") #'macrostep-expand))
diff --git a/lisp/acdw.el b/lisp/acdw.el index 6409f89..8096a70 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el
@@ -58,6 +58,13 @@ Ready for use with `after-focus-change-function'."
58 (run-at-time sunset-time (* 60 60 24) sunset-command) 58 (run-at-time sunset-time (* 60 60 24) sunset-command)
59 (run-at-time "12:00am" (* 60 60 24) sunset-command))) 59 (run-at-time "12:00am" (* 60 60 24) sunset-command)))
60 60
61;;;; Re-indent a buffer
62(defun acdw/reindent-buffer ()
63 "Call `indent-region' on the whole buffer."
64 (interactive)
65 (save-excursion
66 (indent-region (point-min) (point-max))))
67
61;;; Garbage collection hacks 68;;; Garbage collection hacks
62 69
63(defconst acdw/gc-cons-threshold-basis (* 800 1024) 70(defconst acdw/gc-cons-threshold-basis (* 800 1024)
@@ -97,7 +104,7 @@ directory."
97;;; Reading mode 104;;; Reading mode
98 105
99(define-minor-mode acdw/reading-mode 106(define-minor-mode acdw/reading-mode
100 "A mode for reading." 107 "A mode for reading."
101 :init-value t 108 :init-value t
102 :lighter " Read" 109 :lighter " Read"
103 (if acdw/reading-mode 110 (if acdw/reading-mode
@@ -144,7 +151,7 @@ directory."
144 "A keymap for my custom bindings.") 151 "A keymap for my custom bindings.")
145 152
146(define-minor-mode acdw/mode 153(define-minor-mode acdw/mode
147 "A mode for `acdw/map'." 154 "A mode for `acdw/map'."
148 :init-value t 155 :init-value t
149 :lighter " acdw" 156 :lighter " acdw"
150 :keymap acdw/map) 157 :keymap acdw/map)