From 6e63df36574cc0172a775ba4b6fe6e2a8821180c Mon Sep 17 00:00:00 2001 From: Jacopo De Simoi Date: Wed, 12 Apr 2023 11:10:53 -0400 Subject: [PATCH] Add function for delayed save --- global.org | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/global.org b/global.org index bddd18a..4860fb0 100644 --- a/global.org +++ b/global.org @@ -124,6 +124,18 @@ (face-list)) (set-face-font 'default "-xos4-hackminus-medium-r-normal--20-200-72-72-c-100-ISO10646-1")) #+end_src + This function saves the current buffer after the specified amount + of idle time, unless something calls it again and then the timer + restarts + #+begin_src emacs-lisp + (defun save--buffer-buf (buf) + (with-current-buffer buf (save-buffer))) + (defun save-buffer-with-timer (secs) + (when (and (boundp 'save-timer) save-timer) + (cancel-timer save-timer)) + (setq-local save-timer (run-with-idle-timer secs nil + #'save--buffer-buf (current-buffer)))) + #+end_src ** Cosmetics Prefer a minimal appearance: no menu, toolbar or scroll-bars; no splash screens or messages