From fb01aa47283a42eb5799ff009541d8b01e6c0b34 Mon Sep 17 00:00:00 2001 From: Howard Abrams Date: Thu, 10 Feb 2022 11:25:03 -0800 Subject: [PATCH] Save all buffers when Emacs looses focus. --- ha-config.org | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ha-config.org b/ha-config.org index abda19c..a4b7315 100644 --- a/ha-config.org +++ b/ha-config.org @@ -71,6 +71,16 @@ More settings: debug-on-error t) #+END_SRC +Save the file whenever I move away from Emacs (see [[https://irreal.org/blog/?p=10314][this essay]]): +#+BEGIN_SRC emacs-lisp + (defun save-all-buffers () + "Saves all buffers, because, why not?" + (interactive) + (save-some-buffers t)) + + (add-hook 'focus-out-hook 'save-all-buffers) +#+END_SRC + And some Mac-specific settings: #+BEGIN_SRC emacs-lisp (when (ha-running-on-macos?)