Avoid saving currently being edited org-mode buffer

master
Jacopo De Simoi 4 years ago
parent 08a15f6e46
commit 3110fa99bb
  1. 15
      global.org

@ -1131,9 +1131,20 @@
#+end_src
*** Automate saving
This will take care of most of the other stuff
Save all org buffers with the auto-save-hook. Avoid saving the
buffer that is currently being edited; doing so it removes
trailing whitespace, which is undesirable while writing.
#+begin_src emacs-lisp
(add-hook 'auto-save-hook 'org-save-all-org-buffers)
(defun org-save-all-org-buffers-except-current ()
"Save all Org buffers without user confirmation."
(interactive)
(message "Saving all Org buffers...")
(let ((buffer (current-buffer)))
(save-some-buffers t (lambda () (and (not (eq (current-buffer) buffer)) (derived-mode-p 'org-mode)))))
(when (featurep 'org-id) (org-id-locations-save))
(message "Saving all Org buffers... done"))
(add-hook 'auto-save-hook 'org-save-all-org-buffers-except-current)
#+end_src
*** Reverting stuff from orgzly
#+begin_src emacs-lisp

Loading…
Cancel
Save