emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: No Wayman <iarchivedmywholelife@gmail.com>
To: No Wayman <iarchivedmywholelife@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Bug: org-archive-subtree-save-file-p logic [9.3.6 (release_9.3.6-399-ge6df03 @ /home/n/.emacs.d/straight/build/org/)]
Date: Tue, 07 Apr 2020 15:06:41 -0400	[thread overview]
Message-ID: <87y2r76rpa.fsf@gmail.com> (raw)
In-Reply-To: <874ktv86jk.fsf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 268 bytes --]


No Wayman <iarchivedmywholelife@gmail.com> writes:

> Attaching a proper patch with your suggested revisions here.

Sorry, I'm not used to submitting patches through email.
I see it inlined on my end, but it does not appear as if it was 
attached.
Trying once more:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: fix-org-archive-subtree-save-file-p --]
[-- Type: text/x-patch, Size: 2984 bytes --]

From 289d3ff93c9f7f56ee54d98fd7d6294c4472a37b Mon Sep 17 00:00:00 2001
From: Nicholas Vollmer <iarchivedmywholelife@gmail.com>
Date: Tue, 7 Apr 2020 14:39:29 -0400
Subject: [PATCH] org-archive.el: fix org-archive-subtree-save-file-p

Consider case of 'from-org setting in saving logic.
Improve docstring.
Remove dead code comment.
---
 lisp/org-archive.el | 31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/lisp/org-archive.el b/lisp/org-archive.el
index 10a5eb501..5e11c3743 100644
--- a/lisp/org-archive.el
+++ b/lisp/org-archive.el
@@ -92,14 +92,20 @@ 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
-	  (const :tag "Always save the archive buffer" t)
-	  (const :tag "Save target buffer when archiving from an agenda view" from-agenda)
-	  (const :tag "Save target buffer when archiving from an org buffer" from-org)
-	  (const :tag "Do not save the archive buffer")))
+         (const :tag "from-org"    from-org)
+         (const :tag "from-agenda" from-agenda)
+         (const :tag "t" t)
+         (const :tag "nil")))
 
 (defcustom org-archive-save-context-info '(time file olpath category todo itags)
   "Parts of context info that should be stored as properties when archiving.
@@ -373,14 +379,13 @@ direct children of this heading."
 		     value))))
 	      ;; Save and kill the buffer, if it is not the same
 	      ;; 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)))
-		  (save-buffer)))
-	      ;; (unless (or (not org-archive-subtree-save-file-p)
-	      ;; 		  (eq this-buffer buffer))
-	      ;; 	(save-buffer))
+              (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))
+                          (and (not (boundp 'org-archive-from-agenda))
+                               (eq org-archive-subtree-save-file-p 'from-org)))
+                  (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
-- 
2.26.0


  reply	other threads:[~2020-04-07 19:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-02 20:05 Bug: org-archive-subtree-save-file-p logic [9.3.6 (release_9.3.6-399-ge6df03 @ /home/n/.emacs.d/straight/build/org/)] No Wayman
2020-04-06  5:51 ` Kyle Meyer
2020-04-06 16:49   ` No Wayman
2020-04-07  0:37     ` Kyle Meyer
2020-04-07 19:00       ` No Wayman
2020-04-07 19:06         ` No Wayman [this message]
2020-04-08  2:58           ` Kyle Meyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y2r76rpa.fsf@gmail.com \
    --to=iarchivedmywholelife@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).