emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: No Wayman <iarchivedmywholelife@gmail.com>
To: emacs-orgmode@gnu.org
Subject: 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: Mon, 02 Mar 2020 15:05:51 -0500	[thread overview]
Message-ID: <87zhcybjz5.fsf@gmail.com> (raw)

The logic for saving the archive buffer in org-archive-subtree 
does not consider the (default) value  of 'from-org for 

#+begin_src emacs-lisp
;; 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 

While patching this, I realized I'm not sure I understand the 
intended logic of each value for org-archive-subtree-save-file-p.
When setting it to 't', the defcustom :tag string claims "Always 
save the archive buffer".
This is not the case if archiving from within the current buffer. 
Perhaps a clearer :tag string?

#+begin_src emacs-lisp
(defcustom org-archive-subtree-save-file-p 'from-org
  (const :tag "Save the archive buffer unless it is the current 
  buffer" t)

The value 'from-org also still saves the archive buffer when 
archiving from a buffer that is not in Org mode.
I'm not entirely sure of its purpose. If the intent is to allow an 
option that prevents saving only when archiving from the agenda,
I suggest a single option excluding that case and saving for 
other, non-nil values:

#+begin_src emacs-lisp
(defcustom org-archive-subtree-save-file-p 'unless-agenda
  "Conditionally save the archive file after archiving a subtree.
The value 'unless-agenda prevents saving from the agenda-view.
Other non-nil values save the archive buffer unless it is the 
current buffer."
  :group 'org-archive
  :package-version '(Org . "9.4")
  :type '(choice
          (const :tag "Do not save archive buffer when archiving 
          from an agenda view" unless-agenda)
          (const :tag "Save the archive buffer unless it is the 
          current buffer" t)
          (const :tag "Do not save the archive buffer")))

Then the saving logic in org-archive-subtree becomes:

#+begin_src emacs-lisp
(when org-archive-subtree-save-file-p
  (unless (or (eq buffer this-buffer)
              (and (eq org-archive-subtree-save-file-p 
                   ;;bound when called from org-agenda.el
                   (boundp 'org-archive-from-agenda)))

If this is the intended logic, I think it could be cleaned up even 
more so that it reads better and I'm happy to submit a patch.
If not, I'm interested to hear the actual case.


Emacs  : GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, X 
toolkit, cairo version 1.17.3, Xaw3d scroll bars)
 of 2020-02-23
Package: Org mode version 9.3.6 (release_9.3.6-399-ge6df03 @ 

             reply	other threads:[~2020-03-02 20:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-02 20:05 No Wayman [this message]
2020-04-06  5:51 ` Bug: org-archive-subtree-save-file-p logic [9.3.6 (release_9.3.6-399-ge6df03 @ /home/n/.emacs.d/straight/build/org/)] 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
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:

  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=87zhcybjz5.fsf@gmail.com \
    --to=iarchivedmywholelife@gmail.com \
    --cc=emacs-orgmode@gnu.org \


* 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


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).