Last active
September 4, 2018 22:56
-
-
Save lawlist/303d3000eeb25d4885963ba5514e57d9 to your computer and use it in GitHub Desktop.
Save an org-archive buffer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'org) | |
(setq org-archive-location "~/Dropbox/logs/archive.org::") | |
(defun org-archive-save-buffer () | |
(let ((afile (org-extract-archive-file (org-get-local-archive-location)))) | |
(if (file-exists-p afile) | |
(let ((buffer (find-file-noselect afile))) | |
(if (y-or-n-p (format "Save (%s)" buffer)) | |
(with-current-buffer buffer | |
(save-buffer)) | |
(message "You expressly chose _not_ to save (%s)." buffer))) | |
(message "Ooops ... (%s) does not exist." afile)))) | |
(add-hook 'org-archive-hook 'org-archive-save-buffer) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment