summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Vollmer <iarchivedmywholelife@gmail.com>2020-04-07 14:39:29 -0400
committerKyle Meyer <kyle@kyleam.com>2020-04-07 22:48:06 -0400
commit374cb4b4153fe353ce21310bbfada3697e0868c0 (patch)
tree235170af4ab4ad322c087273cd85ec65ae92de09
parentb2aa7e99f2d7742a033509f73bb26b2a6a170d04 (diff)
downloadorg-mode-374cb4b4153fe353ce21310bbfada3697e0868c0.tar.gz
org-archive.el: Fix org-archive-subtree-save-file-p
* lisp/org-archive.el (org-archive-subtree-save-file-p): Consider case of `from-org' setting in saving logic, improve docstring, and remove dead code comment. Fixes 3d0282ef8 (New option `org-archive-subtree-save-file-p', 2020-01-31). Modified-by: Kyle Meyer <kyle@kyleam.com> Dropped whitespace noise in surrounding code, simplified condition, and kept :tag text (to be tweaked in following commit). TINYCHANGE
-rw-r--r--lisp/org-archive.el17
1 files changed, 11 insertions, 6 deletions
diff --git a/lisp/org-archive.el b/lisp/org-archive.el
index 10a5eb5..3246b2b 100644
--- a/lisp/org-archive.el
+++ b/lisp/org-archive.el
@@ -92,7 +92,13 @@ When a string, a %s formatter will be replaced by the file name."
(const :tag "Always" t)))
(defcustom org-archive-subtree-save-file-p 'from-org
- "Non-nil means save the archive file after archiving a subtree."
+ "Conditionally save the archive file after archiving a subtree.
+This variable can be any of the following symbols:
+
+t saves in all cases.
+`from-org' prevents saving from an agenda-view.
+`from-agenda' saves only when the archive is initiated from an agenda-view.
+nil prevents saving in all cases."
:group 'org-archive
:package-version '(Org . "9.4")
:type '(choice
@@ -375,12 +381,11 @@ direct children of this heading."
;; buffer and depending on `org-archive-subtree-save-file-p'
(unless (eq this-buffer buffer)
(when (or (eq org-archive-subtree-save-file-p t)
- (and (boundp 'org-archive-from-agenda)
- (eq org-archive-subtree-save-file-p 'from-agenda)))
+ (eq org-archive-subtree-save-file-p
+ (if (boundp 'org-archive-from-agenda)
+ 'from-agenda
+ 'from-org)))
(save-buffer)))
- ;; (unless (or (not org-archive-subtree-save-file-p)
- ;; (eq this-buffer buffer))
- ;; (save-buffer))
(widen))))
;; Here we are back in the original buffer. Everything seems
;; to have worked. So now run hooks, cut the tree and finish