From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id SJQxJJyXkWLwtgAAbAwnHQ (envelope-from ) for ; Sat, 28 May 2022 05:31:40 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id EOsrJJyXkWLDWQEA9RJhRA (envelope-from ) for ; Sat, 28 May 2022 05:31:40 +0200 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 24E6D1FF21 for ; Sat, 28 May 2022 05:31:40 +0200 (CEST) Received: from localhost ([::1]:50566 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nunAw-0003Fk-G5 for larch@yhetil.org; Fri, 27 May 2022 23:31:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34708) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nunAP-0003FL-Hz for emacs-orgmode@gnu.org; Fri, 27 May 2022 23:31:05 -0400 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]:46657) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nunAN-0003Z3-UL for emacs-orgmode@gnu.org; Fri, 27 May 2022 23:31:05 -0400 Received: by mail-pg1-x52f.google.com with SMTP id j21so5441398pga.13 for ; Fri, 27 May 2022 20:31:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=9H6i1CRXGXx4YpgUKINWB1RBIjPVO0qUPUvpMW0PAL0=; b=LFhVprObz8WSWHBI/bAfqtHBySJeFLPRjKLb01RUCK5HDE7WwEMELdM9NYb2YbKq0B MTCA4b7lvI1mDna9lrPRfMlU7z0JMe5vEFH06YVdyrrONmKw8RolD2DuqI6dHjTZG0/y WHG8xeTkSLjrZA0kYn/gS/RXwqE3tnbue/LWO/azEdew3vZ9KOzJId6SbRYEmRwmkbcm Q/ocBjQs5LxBnuJfGlYv8/G7rARwDg8C325JiGx73gtGHLZ6EQGduhEaOlktT5DwSYpT r04XEx88SRNhFy0hVFnqNHtIMBLPWkTMqzvpxjSSdDBH9bdUJ401D9V3IvTVPVQ9K2a2 9sxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=9H6i1CRXGXx4YpgUKINWB1RBIjPVO0qUPUvpMW0PAL0=; b=R09qAftqDCI4+fi3Gnurrxc3jF5KzpeS2z5aRN3u85DJ2IArdRA/3cuaVTyPz4WRx+ SEytIq09jlQgCwrWJ+VEAZFCSeizJDAtksVIQaXVHA05ziVMOnn3LimK7bJaBA24BmYN POeTWfLXeM/6LivxRSTbvkXhCCkRH2hn7iUkVz1FBPLXU0J3HiVovnET6RmnY+XHLz7c L37RHU90J8Wkrw4PSAUtd/AeD9F3r1VQ7xz8B7wtmcy4ABI8jsCPB8zw55KY73iDA+PC Ui2urDDeViqcTKTSvqcazM8kQeyjdcbpCT3i/9cg2o68Fi/vedsMZ1uMselysrWuPVVx 56pA== X-Gm-Message-State: AOAM5317eVymyxOEwVSZVl5vr96FDttjeF2JPV8YQTMHUM0Z6HNB7dvE 7yzGkyeTIeNjbKCDS+eGKBa2uXlVFwQJpv8D X-Google-Smtp-Source: ABdhPJw0/52v7aWRIUsA2A3RUFF60Yt7tODekhTVG1VpRcLfpRvB3quia7Q4GS1quKt45f193QixrA== X-Received: by 2002:a05:6a00:24c1:b0:518:c52f:f5 with SMTP id d1-20020a056a0024c100b00518c52f00f5mr22180882pfv.15.1653708662243; Fri, 27 May 2022 20:31:02 -0700 (PDT) Received: from localhost ([64.32.23.62]) by smtp.gmail.com with ESMTPSA id m65-20020a625844000000b0050dc76281d9sm1652967pfb.179.2022.05.27.20.31.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 May 2022 20:31:01 -0700 (PDT) From: Ihor Radchenko To: Tor Kringeland Cc: "emacs-orgmode@gnu.org" Subject: Re: [PATCH] Re: Change in `org-cycle-hook' breaks behavior In-Reply-To: References: <87a6b3zc02.fsf@localhost> Date: Sat, 28 May 2022 11:31:42 +0800 Message-ID: <87sfoucoyp.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::52f; envelope-from=yantar92@gmail.com; helo=mail-pg1-x52f.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1653708700; 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=9H6i1CRXGXx4YpgUKINWB1RBIjPVO0qUPUvpMW0PAL0=; b=nL83m/Kv1QO6qk1rLUPZmjpK9x3jailaHupVjf7uDEYoK1s5OSnipv5S6tvUti4ct7C/p0 eRlZ3VosEq+IwXeCx9TrW5T+p4etOQS9JYs741VP8Dw0oIFKRzp6RO2wZF4VS+/7TWCXiR IKVyOWzrfiRJsbVutp3dVn0EKU7vTf1dxkenTQvLJC1ls0I3wKi5HRnOqyh40wHT6nZgl3 m7fTQEUrsxAHKUkBvLaJlGaZqnNMBF7rg3zzjBFLfS9GgieuPpwqn2lme6mGYMxyHFujuR XRkrQrotUQo/VdhUze1UB9uuVEb2x7JxqGS8AJEzhFlp5h3r7C3k4cCTUVM3IA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1653708700; a=rsa-sha256; cv=none; b=bISNgw1t7HDMSe7ap95G2fpS7AeaoBxr9BQdOt0R42dXwx8Jujy4Xxq6EH04QvGrQn5g+0 gIjimz0FtxvDaf8PUK5HPzLIdjdrxtSuPQEvHJpWHfTL2P6slrVv5bTXnhuxxqv14OFLlE t0pTq9KRCSfu8ke4aW4q1FUlRXyuEjr2qe71sWSmZOHPFNnl7BhsPxVEQwhiXYC7cHhCOK zJoHkG7vQgq/h3QhBA5fA/OERm3rOgJ8JmM/24DKAHFFeTYlzC3vWbDv1FZRvxgaAQB5iV iznwTb3/ycC08thnZGBai0hN8wGax04tyZX/kpixCvTT84VxNjnDVLhQzNsnwg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=LFhVprOb; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -7.34 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=LFhVprOb; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 24E6D1FF21 X-Spam-Score: -7.34 X-Migadu-Scanner: scn0.migadu.com X-TUID: mo+s5e/OFFM/ Tor Kringeland writes: >> A more efficient way could be introducing a new customization similar to >> org-cycle-hide-block-startup. Say, it can be >> org-cycle-hide-drawer-startup. See the attached patch. > > I can always hide the > drawers by adding `org-cycle-hide-drawers' to `org-cycle-hook' when I > call my custom function, but I cannot replicate the behavior of > `org-cycle' without `org-cycle-hide-drawers' in the hook, which would > uncoditionally open all the drawers (AFAIK).) Sure. Now, you need to call a different function to open all the drawers unconditionally. That function is: (let* ((headline (save-excursion (org-back-to-heading) (org-element-at-point))) (section (org-element-lineage (org-element-at-point (org-element-property :contents-begin headline)) '(section)))) (when section (org-fold-region (org-element-property :begin section) (org-element-property :end section) nil 'drawer))) Though we might also modify org-fold-show-entry to allow what you wish. I am not sure here. Best, Ihor