about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--init.el37
-rw-r--r--lisp/+emacs.el38
-rw-r--r--lisp/acdw.el18
3 files changed, 44 insertions, 49 deletions
diff --git a/init.el b/init.el index db5f512..a234d4e 100644 --- a/init.el +++ b/init.el
@@ -43,14 +43,13 @@
43 read-file-name-completion-ignore-case t) 43 read-file-name-completion-ignore-case t)
44 ;; Bindings 44 ;; Bindings
45 (:global "C-x C-k" #'kill-current-buffer 45 (:global "C-x C-k" #'kill-current-buffer
46 "C-x 4 n" #'clone-buffer 46 "C-M--" #'+goto-matching-paren
47 "C-c v" #'visible-mode 47 "C-c v" #'visible-mode
48 "C-M-;" #'+lisp-comment-or-uncomment-sexp 48 "C-M-;" #'+lisp-comment-or-uncomment-sexp
49 "C-x C-o" #'+switch-to-last-buffer 49 "C-x C-o" #'+switch-to-last-buffer
50 "C-x o" #'+switch-to-last-buffer 50 "C-x o" #'+switch-to-last-buffer
51 "C-x C-l" #'+open-paragraph ; original: downcase-region 51 "C-x C-l" #'+open-paragraph ; original: downcase-region
52 "C-w" #'+kill-word-backward-or-region 52 "C-w" #'+kill-word-backward-or-region
53 "C-x C-m" #'execute-extended-command ; original: coding systems
54 "C-<backspace>" #'+backward-kill-word 53 "C-<backspace>" #'+backward-kill-word
55 "C-x TAB" #'+indent-rigidly 54 "C-x TAB" #'+indent-rigidly
56 "<f7>" #'flyspell-mode 55 "<f7>" #'flyspell-mode
@@ -60,8 +59,8 @@
60 ;; Disable bindings 59 ;; Disable bindings
61 (:global "M-j" nil 60 (:global "M-j" nil
62 "<Scroll_Lock>" nil) 61 "<Scroll_Lock>" nil)
63 (:+leader "C-t d" #'toggle-debug-on-error 62 (:+leader "C-d e" #'toggle-debug-on-error
64 "C-t q" #'toggle-debug-on-quit) 63 "C-d q" #'toggle-debug-on-quit)
65 ;; C-h deletes backward - see https://idiomdrottning.org/bad-emacs-defaults 64 ;; C-h deletes backward - see https://idiomdrottning.org/bad-emacs-defaults
66 (global-set-key (kbd "C-h") 'delete-backward-char) 65 (global-set-key (kbd "C-h") 'delete-backward-char)
67 (keyboard-translate ?\C-h ?\C-?) 66 (keyboard-translate ?\C-h ?\C-?)
@@ -131,31 +130,6 @@
131 (global-goto-address-mode) 130 (global-goto-address-mode)
132 (add-hook 'after-change-major-mode-hook #'goto-address-mode))) 131 (add-hook 'after-change-major-mode-hook #'goto-address-mode)))
133 132
134(setup (:require hide-cursor-mode) ; In lisp/
135 (:hook-into view-mode
136 Info-mode
137 Man-mode
138 help-mode
139 helpful-mode
140 notmuch-show-mode
141 magit-log-mode
142 vc-log-mode
143 nov-mode
144 elfeed-show-mode
145 reading-mode)
146 (:bind-into (view
147 Info
148 help-mode
149 helpful
150 notmuch-show
151 magit-log
152 nov
153 elfeed-show
154 reading)
155 "<f7>" #'hide-cursor-mode)
156 (:with-mode Man-mode
157 (:bind "<f7>" #'hide-cursor-mode)))
158
159(setup (:require pulse) 133(setup (:require pulse)
160 (:also-load +pulse) 134 (:also-load +pulse)
161 (:option pulse-flag nil 135 (:option pulse-flag nil
@@ -258,7 +232,7 @@
258 (list 232 (list
259 (cons (rx bos (or "gemini:" "gopher:")) #'elpher-browse-url-elpher) 233 (cons (rx bos (or "gemini:" "gopher:")) #'elpher-browse-url-elpher)
260 (cons (rx ; images 234 (cons (rx ; images
261 "." (or "jpeg" "jpg" "png" "bmp") eos) 235 "." (or "jpeg" "jpg" "png" "bmp" "webp") eos)
262 (lambda (&rest args) 236 (lambda (&rest args)
263 (apply 237 (apply
264 (cond ((executable-find "mpv") #'+browse-image-with-mpv) 238 (cond ((executable-find "mpv") #'+browse-image-with-mpv)
@@ -513,7 +487,8 @@
513 (+kmacro-block-undo-mode +1))) 487 (+kmacro-block-undo-mode +1)))
514 488
515(setup midnight 489(setup midnight
516 (midnight-mode +1)) 490 (midnight-mode +1)
491 (add-hook 'midnight-hook #'recentf-cleanup))
517 492
518(setup minibuffer 493(setup minibuffer
519 (:require +minibuffer) 494 (:require +minibuffer)
diff --git a/lisp/+emacs.el b/lisp/+emacs.el index 322e8a9..b69d1a0 100644 --- a/lisp/+emacs.el +++ b/lisp/+emacs.el
@@ -222,6 +222,22 @@ Do this only if the buffer is not visiting a file."
222 222
223(add-hook 'find-file-not-found-functions #'+auto-create-missing-dirs) 223(add-hook 'find-file-not-found-functions #'+auto-create-missing-dirs)
224 224
225(defvar +save-some-buffers-debounce-time nil
226 "Last time `+save-some-buffers-debounce' was run.")
227
228(defcustom +save-some-buffers-debounce-timeout 5
229 "Number of seconds to wait before saving buffers again.")
230
231(defun +save-some-buffers-debounce (&rest _)
232 "Run `save-some-buffers', but only if it's been a while."
233 (unless (and +save-some-buffers-debounce-time
234 (< (- (time-convert nil 'integer) +save-some-buffers-debounce-time)
235 +save-some-buffers-debounce-timeout))
236 (save-some-buffers t)
237 (setq +save-some-buffers-debounce-time (time-convert nil 'integer))))
238
239(add-function :after after-focus-change-function #'+save-some-buffers-debounce)
240
225 241
226;;; Better-default functions ... 242;;; Better-default functions ...
227 243
@@ -320,16 +336,18 @@ It returns nil with remote files."
320 336
321;;; Bindings 337;;; Bindings
322 338
323(define-key (current-global-map) (kbd "C-x C-c") #'+save-buffers-quit) 339(global-set-key (kbd "C-x C-c") #'+save-buffers-quit)
324(define-key (current-global-map) (kbd "M-SPC") #'+cycle-spacing) 340(global-set-key (kbd "M-SPC") #'+cycle-spacing)
325(define-key (current-global-map) (kbd "M-/") #'hippie-expand) 341(global-set-key (kbd "M-/") #'hippie-expand)
326(define-key (current-global-map) (kbd "M-=") #'count-words) 342(global-set-key (kbd "M-=") #'count-words)
327(define-key (current-global-map) (kbd "C-x C-b") #'ibuffer) 343(global-set-key (kbd "C-x C-b") #'ibuffer)
328(define-key (current-global-map) (kbd "C-s") #'isearch-forward-regexp) 344(global-set-key (kbd "C-s") #'isearch-forward-regexp)
329(define-key (current-global-map) (kbd "C-r") #'isearch-backward-regexp) 345(global-set-key (kbd "C-r") #'isearch-backward-regexp)
330(define-key (current-global-map) (kbd "C-M-s") #'isearch-forward) 346(global-set-key (kbd "C-M-s") #'isearch-forward)
331(define-key (current-global-map) (kbd "C-M-r") #'isearch-backward) 347(global-set-key (kbd "C-M-r") #'isearch-backward)
332(define-key (current-global-map) (kbd "C-M--") #'+goto-matching-paren) 348(global-set-key (kbd "C-x 4 n") #'clone-buffer)
349;; https://christiantietze.de/posts/2022/07/shift-click-in-emacs-to-select/
350(global-set-key (kbd "S-<down-mouse-1>") #'mouse-set-mark)
333 351
334 352
335;;; Required libraries 353;;; Required libraries
diff --git a/lisp/acdw.el b/lisp/acdw.el index fdcca84..26d1494 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el
@@ -94,17 +94,19 @@ If body executes without errors, MESSAGE...Done will be displayed."
94 (:success (message "%s...done" ,msg)) 94 (:success (message "%s...done" ,msg))
95 (t (signal (car e) (cdr e))))))) 95 (t (signal (car e) (cdr e)))))))
96 96
97(defun +mapc-some-buffers (func &optional predicate) 97(defun +mapc-some-buffers (func &optional predicate-or-modes)
98 "Perform FUNC on all buffers satisfied by PREDICATE. 98 "Perform FUNC on all buffers satisfied by PREDICATE-OR-MODES.
99By default, act on all buffers. 99By default, act on all buffers.
100 100
101Both PREDICATE and FUNC are called with no arguments, but within 101Both PREDICATE-OR-MODES and FUNC are called with no arguments,
102a `with-current-buffer' form on the currently-active buffer. 102but within a `with-current-buffer' form on the currently-active
103buffer.
103 104
104As a special case, if PREDICATE is a list, it will be interpreted 105As a special case, if PREDICATE-OR-MODES is a list, it will be
105as a list of major modes. In this case, FUNC will only be called 106interpreted as a list of major modes. In this case, FUNC will
106on buffers derived from one of the modes in PREDICATE." 107only be called on buffers derived from one of the modes in
107 (let ((pred (or predicate t))) 108PREDICATE-OR-MODES."
109 (let ((pred (or predicate-or-modes t)))
108 (dolist (buf (buffer-list)) 110 (dolist (buf (buffer-list))
109 (with-current-buffer buf 111 (with-current-buffer buf
110 (when (cond ((functionp pred) 112 (when (cond ((functionp pred)