diff options
Diffstat (limited to 'lisp/+emacs.el')
-rw-r--r-- | lisp/+emacs.el | 38 |
1 files changed, 28 insertions, 10 deletions
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 |