From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id EOHZKvVDmGO5zgAAbAwnHQ (envelope-from ) for ; Tue, 13 Dec 2022 10:20:53 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id MBHlKfVDmGOyOwEAG6o9tA (envelope-from ) for ; Tue, 13 Dec 2022 10:20:53 +0100 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 7B0C12E730 for ; Tue, 13 Dec 2022 10:20:53 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p51RU-0004TW-KE; Tue, 13 Dec 2022 04:19:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p51RS-0004S1-O7 for emacs-orgmode@gnu.org; Tue, 13 Dec 2022 04:19:14 -0500 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p51RQ-0002w2-0Q for emacs-orgmode@gnu.org; Tue, 13 Dec 2022 04:19:13 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 30BBA240103 for ; Tue, 13 Dec 2022 10:19:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1670923150; bh=sGnIBSIADeb6rITQoPAR2XDFRY5ksYOlVZuN+9duBE4=; h=From:To:Cc:Subject:Date:From; b=nDQB9jEswUhxkqp3e33vHuTEJtIq2rRTfBkw6nflp71dcweVjNG5EBVUipXBoTLVH EHKrN/OMO52yiK+FPnWELmuTjRxxMxI08fkvkZeaOrePOzB+guqjpO39AHCJvw41Lf 0MCYhdG28SejOLP/jLPl6UF3pKjgQNxBPALToFhCFTdUGWjo2swLYK4s8/LCtv0VOA KsK0UboqXcN8lOx3OVQOOosbkZJhopslKh8bXrNqOhrKXEjtm18a7cZVvCEHawytAZ iZKtdkj2ck4nBcMluxloeaBKnNbbIRtIL2CBfiZG8C2STbQNBpjOtYwPPmdmjUL7g8 5SYgSgQu6UqeA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4NWXxR2TlZz9rxG; Tue, 13 Dec 2022 10:19:07 +0100 (CET) From: Ihor Radchenko To: hugo@heagren.com Cc: "Thomas S. Dye" , emacs-orgmode@gnu.org Subject: Re: [PATCH 1] lisp/org-fold.el: Fold header lines in blocks (was: Proposal: folding stacked `#+header:' lines in src blocks) In-Reply-To: <32864528822dfa0bc8efe3bcf112cbea@heagren.com> References: <754970738d6c5abc27c61180d356cd4f@heagren.com> <87v8mndluw.fsf@tsdye.online> <32864528822dfa0bc8efe3bcf112cbea@heagren.com> Date: Tue, 13 Dec 2022 09:19:05 +0000 Message-ID: <87edt3ek52.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1670923253; 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=EUA+/A++j+BIu09tdLeZnCvvYKuj9ROwzUlC+8CuC2g=; b=OZ/FBCHwj87VHY1wVjnZG96dxmUekn3tzBSi53YAuSqQrP/yeGoUI4ttWVTxsYWQ1FrQmE +DtRkdcLUpxkMYVrCy0ZUWUi8/2JkF3QFKX2G9E6RVvd/j9UxNesTS9OsY14WWHxzEjgYg N3+Uy9if40vpIKqTEcVyn3f7CMfFXHPDxbd6FEaLiRyqxniPC2h9WYgKl25BNt+oCZ3cgD iSlpDdCFIcNdpl9l24ydt2BwolkeH1K+ofvTEtUwzwdpE7cLIB1IvpzzP2AkSUEqfYWGPy bp5+A2Hjfek8EnyKMcXy3IQqFFfDapR90phO6IvDqU7jFmSYXXczAxaftvZugQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=nDQB9jEs; 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"; dmarc=pass (policy=none) header.from=posteo.net ARC-Seal: i=1; s=key1; d=yhetil.org; t=1670923253; a=rsa-sha256; cv=none; b=rGnMOHsXjjT2jqi5WTeC06g0F/p/gwOM5ecfRGWMBHFIq15fKYzsy28PlZBZERHcdzpLA4 gOk714xFU2PyT7b3xj8y/6f4pYLfap19WKeySSHF6thkSQ3EflEo7uQiPe47Ak8kLrRzmq dmjcx6uXhooZOTGQENltTQWUt1d9993X/WEYrM1Bi7e+x5Ab5NNRyp2gWNluRfNL8xx8OP sIrdLefUuR4Na7qD30HR4rBWruh+F+mcllINgoBozBVKOmTP6XQpOeNHeuaEclZcFu3LqS X5y4YHNm8QJ8P/5/BmXY0TvlIMbHkUeQEmWIuYm9FBhnpo8HPcAHBLGPWXqMVA== X-Migadu-Spam-Score: -4.36 X-Spam-Score: -4.36 X-Migadu-Queue-Id: 7B0C12E730 X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=nDQB9jEs; 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"; dmarc=pass (policy=none) header.from=posteo.net X-TUID: /qBl60OJRpwZ hugo@heagren.com writes: > Great! I've worked up a patch (well, two patches), attached. > > Some details of the implementation: > - folding blocks now cycles: > - everything folded (only top header line visible if present, > otherwise only `#+begin' line visible). > - all content visible, (header stack folded, top header visible, > `#+begin' and `#+end' lines visible). > - everything visible > - (the second and third are treated as equivalent unless there is > more than one header line.) This logic does not really belong to org-fold.el. Rather to org-cycle.el(org-cycle). Ideally, we need to split `org-cycle' into smaller functions. Also, changing default toggle behaviour may break third-party usage. People now expect flipping between folded/unfolded. Your patch will change that. > - renames `org-fold--hide-wrapper-toggle' to > `org-fold--hide-wrapper-cycle', which seemed more appropriate under > the circumstances. Please, no. As I said above, we need to move the cycling logic to org-cycle. `org-fold--hide-wrapper-toggle' may only be modified to accept a new value of FORCE other than 'off. > Some less-than-perfections: > - I'm not sure what to do about default block folding (as in, how > blocks are folded when a file is first visited). First, I don't have > a complete list of things (variables, startup options, etc.) which > affect it. Secondly, I'm not sure what the behaviour should be now > that blocks can be in up to three folding states. Advice would be > appreciated. We may define default folding state at startup via defcustom. > - I'm not sure what other documentation I should add. Once this patch > is stable and people approve of it, I can add a news entry. Should I > update the manual at all? Yes. For example, 2.8 Blocks section of the manual. But let's decide about implementation first. Manual if the last thing to do. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at