From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms98 with LMTPS id MA+7N89di15kXgAAGDD2mg (envelope-from ) for ; Mon, 06 Apr 2020 16:50:23 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id yEVGGs9di15hKwAAbx9fmQ (envelope-from ) for ; Mon, 06 Apr 2020 16:50:23 +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 3C882945C54 for ; Mon, 6 Apr 2020 16:50:21 +0000 (UTC) Received: from localhost ([::1]:35170 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLUx0-0007nA-JN for larch@yhetil.org; Mon, 06 Apr 2020 12:50:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54117) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLUwO-0007lJ-2L for emacs-orgmode@gnu.org; Mon, 06 Apr 2020 12:49:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jLUwM-00048a-NG for emacs-orgmode@gnu.org; Mon, 06 Apr 2020 12:49:39 -0400 Received: from mail-qk1-x731.google.com ([2607:f8b0:4864:20::731]:44923) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jLUwM-00047s-H1 for emacs-orgmode@gnu.org; Mon, 06 Apr 2020 12:49:38 -0400 Received: by mail-qk1-x731.google.com with SMTP id j4so16815491qkc.11 for ; Mon, 06 Apr 2020 09:49:38 -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=SAtesU0OdE/ZS+6LlpnMQNt1e7UVfmNWRCYxm1113EI=; b=KOTVbOEPfpp5ONy/IlLoKBvwpZP2ZeALEQDY71nqReFZybxZH68hYxd3+6fOQHlgex X5lHgJU751F9jC6iH0Nj7CSCSYChTBNH73iApzzA7q2ra383+20IrgCWSznO8/vbWX2b TZj/kthIWXbK4Ox4ha4b7Dm60k5BuN1PSxc+BVZwbnPFn5GxxvVlsa6LMKJbX80ZNTVq N9Qu4EdsKrQ5OmQwuLYLlnRGtFJLBF9QLBltUf3KwfWzpOqzWIApkP4w2w3vCErLPU6w YcnxyzUCsAYBr6Sye5lNYIDb8+chUihWsb2oLq+0lRQHXGeFmKOms59grzTH/XGGRrbv YZ8w== 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=SAtesU0OdE/ZS+6LlpnMQNt1e7UVfmNWRCYxm1113EI=; b=kqzhKIUic7Zhn9+l3zomoIbLP1JYq6Exqk2hqzdQkUO2VPWe/It5H6utiMqd67dbQi OZELEKUzvrDdHKTfoFBrlu1t0tnFKeUpoyYmRyPzvMkpqVqyQ2d08ueYbcapb0HFIskE iFJ6ColBpFaZCLRSREySaKQY9fMjM+oIJgtEoVX5l7N7GMAw5bcH+v4JhjnH5n2X52kU aHIbs7Hz9kt0HeVQ+OlqeOOgWhrj6FgljK679WbqDsiBNlTO3T9ODe0QdCJs7D250EGJ NkuLMCtnk+GWFgK8o22RVsWbL8wqra+KxXIYEodkSk18MExYO2r1iCublSY12EK52b1n aTgg== X-Gm-Message-State: AGi0PuafZy684C0tEcrfolb6VaYUC2p+BP3zX06EaE8pOuCma3s2lxUL QAiiP7I2OLpqfTsDcmN/Vrqp7OyK X-Google-Smtp-Source: APiQypJZY+cqmAJkGWDBPJxYX08hGlFAkAKhaxlpy/x1HY88XtjpIaKfZ2lTAQ3TUWq56n3CVUd23Q== X-Received: by 2002:a05:620a:1185:: with SMTP id b5mr21188036qkk.25.1586191777374; Mon, 06 Apr 2020 09:49:37 -0700 (PDT) Received: from arch ([2601:8b:c300:1024:1266:d0ff:1635:f964]) by smtp.gmail.com with ESMTPSA id h9sm11410500qtj.3.2020.04.06.09.49.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Apr 2020 09:49:36 -0700 (PDT) References: <87zhcybjz5.fsf@gmail.com> <87lfn917rx.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: <87lfn917rx.fsf@kyleam.com> Message-ID: <87zhbov9sw.fsf@gmail.com> Date: Mon, 06 Apr 2020 12:49:36 -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::731 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 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=1586191821; 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=SAtesU0OdE/ZS+6LlpnMQNt1e7UVfmNWRCYxm1113EI=; b=L2n0MK7CI32NQzsNcQ/ntw7H8kbSPETX0mNhn7DphXQ34kgDGNwaJ7JysKuBUGOqGoX3zd EwAkLvUmuDQoSHFg1WvjzQRzk5kpmV3IE6yGJDToTFLe+BZ1kK9Bm5qHQuz5dGcfM/oyPc PvQ9pob6T+ckuw1d62EQCJ/4OMRyepM= ARC-Seal: i=1; s=default; d=yhetil.org; t=1586191821; a=rsa-sha256; cv=none; b=hnUHkBziWmh2Td35jEghp4vFc7tHXCIubts15MPGF2rOtLSCRxFle9PmyriufUJIBgEZ6u 2QzB8J9ko28HZ+dU5YS+W0K3QHNmjnfXMNjbkNnlmfxRHk7sw/d+F+5q72G0gOaChEC+Wh cU+3q9m8KVlx2TgJ5FzuI0pksip8uKc= ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=KOTVbOEP; dmarc=pass (policy=none) header.from=gmail.com; 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: -1.71 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=KOTVbOEP; dmarc=pass (policy=none) header.from=gmail.com; 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 [-1.71 / 13.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; GENERIC_REPUTATION(0.00)[-0.58370773409311]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.51.188.0/24:c]; FREEMAIL_FROM(0.00)[gmail.com]; IP_REPUTATION_HAM(0.00)[asn: 22989(0.33), country: US(-0.01), ip: 209.51.188.17(-0.58)]; ARC_SIGNED(0.00)[i=1]; DKIM_TRACE(0.00)[gmail.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; 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)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_NEQ_ENVFROM(0.00)[iarchivedmywholelife@gmail.com,emacs-orgmode-bounces@gnu.org]; FROM_HAS_DN(0.00)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[emacs-orgmode@gnu.org]; HAS_LIST_UNSUB(-0.01)[]; RCVD_COUNT_SEVEN(0.00)[7]; FORGED_SENDER_MAILLIST(0.00)[] X-TUID: VK6kJ810k3/d Kyle Meyer writes: > Based on the history above, I believe the main purpose is to > give users > a way to reverse the "no saving" behavior made in 63f6e851b (Do > not save > target buffer after archiving subtree, 2017-11-25). I'm > _guessing_ > that, on top of that, the idea adding a from-agenda value was > that some > users may want to save only when archiving from the agenda, > because in > that case they're a bit removed from the buffer and might not > think to > save it, or something along those lines. > Assuming what I said above is true, I think what you propose > here loses > the ability to save only when archiving from the agenda. And > more > importantly, users would not be able to give a blanket "don't > save" in > order to retain the behavior introduced by 63f6e851b (Do not > save target > buffer after archiving subtree, 2017-11-25). Thanks for the explanation, Kyle. I understand the intent of the variable better now. What do you think of something like this? #+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. The value 'only-agenda saves only when the archive is initiated from the agenda-view. The value t saves in all cases where the archive target buffer is not the current buffer. The value nil prevents saving in all cases." :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 "Only save archive buffer when archiving from an agenda view" only-agenda) (const :tag "Save the archive buffer unless it is the current buffer" t) (const :tag "Do not save the archive buffer"))) #+end_src #+begin_src emacs-lisp ;;don't save when target buffer is current buffer (unless (eq buffer this-buffer) ;;t always saves (when (or (eq org-archive-subtree-save-file-p t) ;;'unless-agenda saves unless archive initiated from agenda (and (eq org-archive-subtree-save-file-p 'unless-agenda) (not (boundp 'org-archive-from-agenda))) ;;'only-agenda saves iff archive initiated from agenda (and (eq org-archive-subtree-save-file-p 'only-agenda) (boundp 'org-archive-from-agenda))) (save-buffer))) #+end_src This should result in the following scenarios: | org-archive-subtree-save-file-p | called-from-agenda? | buffer saved? | |---------------------------------+---------------------+---------------| | t | nil | t | | t | t | t | | only-agenda | nil | nil | | only-agenda | t | t | | unless-agenda | nil | t | | unless-agenda | t | nil | | nil | nil | nil | | nil | t | nil |