From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id aMpYM7SvDmeAhwAAe85BDQ:P1 (envelope-from ) for ; Tue, 15 Oct 2024 18:08:53 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id aMpYM7SvDmeAhwAAe85BDQ (envelope-from ) for ; Tue, 15 Oct 2024 20:08:52 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=BIbSad+O; dmarc=pass (policy=none) header.from=posteo.net; 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" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1729015732; a=rsa-sha256; cv=none; b=eGkYOIgNebjnu0Xc+bAi6qpbajyUdzfEdWrY3a5qSNCVrqFFZ1WCWyIemNNn59IrIgRAid SLhhVEknx+QWxDTQPGuOn3h9qiuOSEXkrZcXqfS3+I8qytL5ke/rLUZOpgY1R2fuyPjKtr ze9dXWwv0YD3EkDmxddZaCc9e3EwlhA/XmLHmAjB00L9VzorhfzdmJw/jwSkbQOGnaj/b1 I5U6NKyX0Uq6yVQsqfS5lf3ogJ/0W/Oh9U3jKBnIqiuqm4MsEq4psliAAPINL4VKx0PF/O Vlig07PVGw4LUWQMK4+vy4Y5aB3WGpHf/Jme+AL8dRUkuwIKyNm620Flzg8NPw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=BIbSad+O; dmarc=pass (policy=none) header.from=posteo.net; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1729015732; 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=Q4QR4p24l6luCFduryGGxamxd2FdUNqn61H1VSjY+gk=; b=RoROi70xYZXbcNh5HKIXNjExWixBnPzo9kmNelQ8d1jtzxDNv9a7zFNeYF9N+BAXGvvCn6 sDyY1RYvsyir3DzsjAjUpko7lP7S0Hw0mgSJWkrV7TZaOQcxzBYH6eylUiY6OOKZndDr99 0f3iEYaNn9uTc0nlDznz7EUUfiBb9QTsqcCv+BZ1aBWRAlzBlDD7WV7283xzzxXwGl/ggO YtAveNm5oEGJvWyw5zXHaLGkwZQurZuKeeBRoDdV6UTz5FuJDneCprfXVxvk98R2w+v1Zm cgXkdKAfTk4aGsJicMpdhTLWNhRfTUlO3c0pNUZsjXEN9jxYFrdYajnOTXdkqQ== 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 493ED647CB for ; Tue, 15 Oct 2024 20:08:52 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t0lxo-0007hG-VE; Tue, 15 Oct 2024 14:08:08 -0400 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 1t0lxm-0007ge-Uz for emacs-orgmode@gnu.org; Tue, 15 Oct 2024 14:08:07 -0400 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t0lxk-000204-Uq for emacs-orgmode@gnu.org; Tue, 15 Oct 2024 14:08:06 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 08CF0240027 for ; Tue, 15 Oct 2024 20:08:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1729015682; bh=sfwGVnfBgsS4FgOOQbcbfm7sf4hib3g5/t9lgJY1fLA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=BIbSad+OzzzisPgfQ3RQS5BcigVC6vZLBMy4yw8WtoeO9T3u6FfAYhMdqLD/qBzpp KANmevS/cVgJYyN8C3jUBO7mT1M7X3q1EaaNcEN7Nj1ek/GHcSkpy4UpQZjo5ztuaG lc0GMuK7qdLa9BX6oWnh5NGNYKNQZ8899Zmz79ZSwbmrTzQz3NjUhevQ1Fjqz1me6g wwtARr1wDy8Ap9zxBXyYBkXRmY4PwYZ+wCK9zhzIPkbVShPBxESgUUr8HgfRkRPiiP 1oQpYj5U6D+dUHNPkMxHODUS1pEArPKrBIgW1f/3ezQAMzSM1OSBqi3g7dVkLRdwD2 g4lwRIIdik3nQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4XShsY2FcRz6tw1; Tue, 15 Oct 2024 20:08:01 +0200 (CEST) From: Ihor Radchenko To: Imran Khan Cc: emacs-orgmode@gnu.org Subject: Re: [BUG] Writing table to a folded drawer unfolds it. [9.7.12 (release_9.7.12 @ /home/natrys/.emacs.d/elpa/org-mode/lisp/)] In-Reply-To: <285d8923e769bbaadb990286c5b966f5@khan.ovh> References: <285d8923e769bbaadb990286c5b966f5@khan.ovh> Date: Tue, 15 Oct 2024 18:09:50 +0000 Message-ID: <8734kxfdap.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=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-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -1.23 X-Spam-Score: -1.23 X-Migadu-Queue-Id: 493ED647CB X-Migadu-Scanner: mx12.migadu.com X-TUID: oZwZn4TnsyFd Imran Khan writes: > ... Writing table to a folded drawer unfolds it > ... > (insert "| " (format "%f" (time-to-seconds)) " |\n") This is expected. In the middle of the editing, you are breaking the drawer structure, transiently having something like :DRAWER: ... | :END: So, Org mode unfolds the drawer to avoid having a fold that cannot be unfolded by normal means. > Also any attempt to fold the drawer immediately afterwards (in same > elisp thread of execution) does nothing. This one is a bit tricky. The above unfolding does not happen immediately after the edit - we cannot reliably do it from inside after-change-functions. So, the unfolding of drawers is delayed until `post-command-hook' is evaluated. Since your attempt to fold the drawer happens _before_ `post-command-hook', your folding is effectively undone shortly after. To work around the problem, you can use `org-fold-core-ignore-fragility-checks' macro around your code modifying the drawer contents; as long as you know that you are not actually breaking the drawer structure. P.S. The above is all quite tricky and should be eventually simplified by using track-changes.el library (will be a part of Emacs 30). But not yet, and not until we drop Emacs 29 support. Wontfix. Canceled. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at