From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1 with LMTPS id eJGHGQvOjF6iagAAk0OIDg (envelope-from ) for ; Tue, 07 Apr 2020 19:01:31 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id mENwNgnOjF6JeAAA1q6Kng (envelope-from ) for ; Tue, 07 Apr 2020 19:01:29 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B843B947F77 for ; Tue, 7 Apr 2020 19:01:27 +0000 (UTC) Received: from localhost ([::1]:52094 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLtTQ-00062Q-IS for larch@yhetil.org; Tue, 07 Apr 2020 15:01:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44374) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLtSu-00061v-By for emacs-orgmode@gnu.org; Tue, 07 Apr 2020 15:00:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jLtSs-0003r7-Oo for emacs-orgmode@gnu.org; Tue, 07 Apr 2020 15:00:52 -0400 Received: from mail-qk1-x744.google.com ([2607:f8b0:4864:20::744]:42956) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jLtSs-0003qr-IS for emacs-orgmode@gnu.org; Tue, 07 Apr 2020 15:00:50 -0400 Received: by mail-qk1-x744.google.com with SMTP id x66so127588qkd.9 for ; Tue, 07 Apr 2020 12:00:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:in-reply-to:message-id :date:mime-version; bh=pqomUmrtPHwI7ref5EdYCm5Lx39HNCpEThf6NmrsRMQ=; b=mqmAE0aequAWYwFicSren2WRlJFTgbnBp4wizeZ6fyBSri7wsEIh9Vsi3W9bx73Rgs DmgeF4f7M0GEoB9Dojap/oQrXdPi8ICa6qCHwTSEAm2BqPpZGzNvKp4vK1Zxys0FrtaD zOmXW63HzHTEhtzgCPGBhE5gNMRivNGNATxhZ4zrZxvCZq9rVy4rQbrOKw+Fi4tx4277 qJpnAagXTF1DT6jc5A/Oxq+SguMnMf7ohq4v/1OAZe+M2C6kO7wXHbHi5xY6MFbOl7pJ Df+Fjo/pnRDZjJwNyQa36joVTwWVtD+XXyli3kpRZKn9lNuwwxx2bhrdCuX7Ua7JMXDe ldzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:message-id:date:mime-version; bh=pqomUmrtPHwI7ref5EdYCm5Lx39HNCpEThf6NmrsRMQ=; b=LqO3y+xWEMePsLqGiX9AZJtRpon2u/etu6mj8Kix0c8pD/TncGUrQ9PD2ihDQXs+kQ u9B+/9vRh3qglW5oGkfZhyln0BnAveqX8xqA9yhy+kSq8Gn17yHdH4fFt2NpvwxX/FCY 8b/+zXyCOxwEoFA1NbFtw8dpb4c3QSwlIpkYTLp663E6tRJeVTIbiij4oArvB3eagHaR XR2O3hs4wuWMCKMYe9jgV1wXg+b4YePNQkQVmd9vKvWQU3QNaUGSUAAO59B8H82rjY1f oksyWJfEhn45KuIboCxEcTLIVnz4pPvppASYQCX1ynSpv3eY/MLtD3lh2KOIP/9JJUzJ h/XA== X-Gm-Message-State: AGi0PuZCsGU38kKwQoReSU9lMtU9NLgv7QihDvbzVezsLHARsk2OZewI 6bOvmNAk8YVtzxeBLvpo20rUYG5O X-Google-Smtp-Source: APiQypJ+3u1UjcFUphASBzWQFF5s13hQUtagzVgnH8GHUD+WAB0amD/x3A+mKBjhuwqLacVdTnMBJQ== X-Received: by 2002:a05:620a:16b0:: with SMTP id s16mr2441907qkj.204.1586286049246; Tue, 07 Apr 2020 12:00:49 -0700 (PDT) Received: from arch (c-69-141-147-3.hsd1.nj.comcast.net. [69.141.147.3]) by smtp.gmail.com with ESMTPSA id a136sm12864935qkc.75.2020.04.07.12.00.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Apr 2020 12:00:48 -0700 (PDT) References: <87zhcybjz5.fsf@gmail.com> <87lfn917rx.fsf@kyleam.com> <87zhbov9sw.fsf@gmail.com> <878sj8167w.fsf@kyleam.com> User-agent: mu4e 1.3.10; emacs 28.0.50 From: No Wayman To: Kyle Meyer 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/)] In-reply-to: <878sj8167w.fsf@kyleam.com> Message-ID: <874ktv86jk.fsf@gmail.com> Date: Tue, 07 Apr 2020 15:00:47 -0400 MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::744 X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org, No Wayman Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=default; t=1586286088; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=pqomUmrtPHwI7ref5EdYCm5Lx39HNCpEThf6NmrsRMQ=; b=ccJ/8JSbS2oilw0BAVftF0W7ubNYtX6hugr3pYg10PS+5gtac587UH92ScMuRwriGSaJgC 1gbf4Yva6b0YfxlT1LpUPiLYX20UUGffESDGwAGnmJijdvg8OSMY8xeWTK0R1/7bKKzBU2 C03d8+BAseYzpx9DRwKqG5N08k9U+MY= ARC-Seal: i=1; s=default; d=yhetil.org; t=1586286088; a=rsa-sha256; cv=none; b=B7f4+ALoGqH5OgCDOSU6DH7UObXGoyvO42bc2BbvK+aNoKwCDG8ReaLw/znAgJth/w6lIv kkWkWAdYpGwcbB5lgqVyKkwdWL5LeVP0uo/Yu0a3pAI6oCPAW6oNvUdmVksC4LPWXm4TEF 5JgUQP9PSX6iCbEFhcC4Q73u4T4U9xE= ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=gmail.com header.s=20161025 header.b=mqmAE0ae; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Scanner: scn0 X-Spam-Score: 0.09 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=gmail.com header.s=20161025 header.b=mqmAE0ae; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Scan-Result: default: False [0.09 / 13.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; GENERIC_REPUTATION(0.00)[-0.58225310524965]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.51.188.0/24:c]; R_DKIM_REJECT(1.00)[gmail.com:s=20161025]; FREEMAIL_FROM(0.00)[gmail.com]; ARC_SIGNED(0.00)[i=1]; IP_REPUTATION_HAM(0.00)[asn: 22989(0.32), country: US(-0.01), ip: 209.51.188.17(-0.58)]; DKIM_TRACE(0.00)[gmail.com:-]; MX_GOOD(-0.50)[cached: eggs.gnu.org]; MAILLIST(-0.20)[mailman]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:22989, ipnet:209.51.188.0/24, country:US]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[larch=yhetil.org]; ARC_NA(0.00)[]; FROM_NEQ_ENVFROM(0.00)[iarchivedmywholelife@gmail.com,emacs-orgmode-bounces@gnu.org]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[emacs-orgmode@gnu.org]; HAS_LIST_UNSUB(-0.01)[]; FREEMAIL_CC(0.00)[gnu.org,gmail.com]; RCVD_COUNT_SEVEN(0.00)[7]; FORGED_SENDER_MAILLIST(0.00)[]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : SPF not aligned (relaxed),none] X-TUID: QS7TuNJlIfo7 Kyle Meyer writes: > Thanks for the suggestion. The code is somewhat oddly > formatted, at > least on my end. Could you send a proper git-format-patch > output to > this thread (either via git-send-email or as an attachment)? Apologies, I pasted that from an Org buffer without reformatting. Attaching a proper patch with your suggested revisions here. > I suppose the main argument against from-org is that it's not > clear > from the name alone that it's referring to a non-agenda Org > buffer > because "org" is of course a bit overloaded. Considered > alongside > from-agenda, I don't think it's too bad though. > I agree. 'from-org is pretty vague. That, combined with the old saving logic was part of the reason for my initial confusion. I don't mind keeping it if you feel it's satisfactory, though. I'm more after the proper functionality. > This current buffer bit also applies to unless-agenda/from-org. > Perhaps > it'd make sense to just mention the current buffer behavior in > the main > docstring, given it applies to all options (even though for > only-agenda/from-agenda, it's never the case that the archive > buffer is > the current buffer). I've dropped the mention of the current-buffer case in the docstring altogether. > In summary > > * I'd prefer to make a more minimal change on top of > 3d0282ef8, > keeping the names chosen there. Functionally that comes > down to > adjusting the condition that guards the save-buffer call to > consider > from-org. > > * I think it'd be good to expand the docstring (along the > lines of > what you suggested) as well as trim and clarify the tag text > a bit. Took a look at `org-archive-save-context-info' as you suggested. The new docstring is similar to that. ===File /home/n/.emacs.d/straight/repos/org/0001-org-archive.el-fix-org-archive-subtree-save-file-p.patch=== >From 289d3ff93c9f7f56ee54d98fd7d6294c4472a37b Mon Sep 17 00:00:00 2001 From: Nicholas Vollmer 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 ============================================================