From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.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 SIRXLC1sDWdvQQAA62LTzQ:P1 (envelope-from ) for ; Mon, 14 Oct 2024 19:08:29 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id SIRXLC1sDWdvQQAA62LTzQ (envelope-from ) for ; Mon, 14 Oct 2024 21:08:29 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=smtpservice.net header.s=a1-4 header.b=r0jHWfFI; dkim=pass header.d=khan.ovh header.s=s844466 header.b=QPJfuNa8; dmarc=permerror reason="p tag has invalid value: non" header.from=khan.ovh (policy=permerror); 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=1728932909; a=rsa-sha256; cv=none; b=hTtc5N8gYyqlNIa2Q+eTEBe6mFU+6wIyCfDoJNiuw9tgS0F0CUATQsmS/2qdSwT0haHbnz y0MxXnaLZRpGf6QCoISwnhVyitbGy15ZVtgqaHGglqjem+SUkLtDe8tAFnl/EbUdm5Klb4 60/eRx9RhNBbBP+FaeaA/2NQuWJ35ugivpqkmqL02oM+NnmypB83MTZs+FTgcAeYX0K/8v KM4QVuoFgqe4Ahz3nepspDE507PB++kNUK9USzsauIRb4XmMHuzXzDst18dwxJsazPQ9Ce PhLHiWkIOAAZBcdwrO+mopZS7lO+OGvHsVSlvoZPJm9Gv1/wcnudg9dHC9RIIg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=smtpservice.net header.s=a1-4 header.b=r0jHWfFI; dkim=pass header.d=khan.ovh header.s=s844466 header.b=QPJfuNa8; dmarc=permerror reason="p tag has invalid value: non" header.from=khan.ovh (policy=permerror); 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=1728932909; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=tEB/5HFKfaWv5d3lJnw5F5CcKlxGArwY80phsdqcSq0=; b=VZaOfZi7rASaiXKrM6Ck22NMAiDeCa9ynPc7+wq7BhdndtkEEE6n39YGlXlLrRXELtvB3D IBqXHlQGEo4qHz2uI3vmFWcoQxZbpwwaLd8Biwr54+e+1bbjkyS1hJtYVmzU7H4cn9xzeJ +ZReffMnY/JsE+x5M71AXX+WSoXAGydhKxZKWT+1JyRo6onyqWwfAbG5WPOYl5+1sbE28v rxBRo61SQiodl8znML5SMVhxQcbiJFjcS7VWW7PbTNAVOPowWWcszDYEhUIWRhmjnQJ7/F dXcsLwwdFmFaNBWthvs9XCP96rJmtPN5izvd6WcSm5Mop3I834UhKrnS1vHBNA== 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 1CF4C73C3 for ; Mon, 14 Oct 2024 21:08:28 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t0QPi-0007aV-HY; Mon, 14 Oct 2024 15:07:30 -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 1t0QPf-0007aH-NL for emacs-orgmode@gnu.org; Mon, 14 Oct 2024 15:07:29 -0400 Received: from a1i517.smtp2go.com ([43.228.186.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t0QPa-0003KV-1L for emacs-orgmode@gnu.org; Mon, 14 Oct 2024 15:07:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=smtpservice.net; s=a1-4; h=X-Smtpcorp-Track:Feedback-ID:Date:Subject:To: From:Message-ID:Reply-To:Sender:List-Unsubscribe:List-Unsubscribe-Post; bh=tEB/5HFKfaWv5d3lJnw5F5CcKlxGArwY80phsdqcSq0=; b=r0jHWfFI6yhMyZZZ3wQU2uwpzX 4h7QesonTyf/WqvS7UkDmRbLfDslVKf0ZVHNb6JWYJ5+ETwHF8skXzT6cYcHWNDZuIim2tLQQPdop EoRjwxOItgvj04ijlcDhzoQ1ZjpGbWCG6NkpEpHnxRDmpdf7iahq/ER5foTh4Dae0xirQ9xrbswqx XAjd4haOyUMyU6FuVZNzEJFWputvZ/wOvyMxRlOvmnb6Vxn0K6XMvsD+iylt6Xvl67xywHSeb0JUa PIva1EAHCWDdNd92jb7rTPrQrgpYbI5k5mVl+rMe6ssVKDIU9sMOx6yUGbMriqCaHPIXWm8HahnFU hjOBOrIg==; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=khan.ovh; i=@khan.ovh; q=dns/txt; s=s844466; t=1728932829; h=from : subject : to : message-id : date; bh=tEB/5HFKfaWv5d3lJnw5F5CcKlxGArwY80phsdqcSq0=; b=QPJfuNa8mIxJozFHUccidBG3XVjpJ7fNN2Z9MWP3/+kJ5jF2boEGnzgMhV87SLwEV3s44 kg+qf8HpdS7Y44NjU37FJxN9G+aR22q+w2Jp9bzJ2dQ/0Nq5eF06rfxXl3HDrvIXePcK1NB ySvVY8n03H10ajDShEII16MxAoxU/e0QgbIWUUi17asxj/oo0S2LoRm/hN89bkCg7ntmPJI 1piZAGuUXke/4TnwpHVTmL78TrF5qv8LWm4cZwreAHymAaIAEbUNy9GfA4xCaKuDRHl4Hnb iJH7UcXw4WIfKjf4K+OvqaBiA6k1tZ3rJPEwV8xUkrW1CssINv9fKjPONAJA== Received: from [10.45.79.170] (helo=SmtpCorp) by smtpcorp.com with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94.2-S2G) (envelope-from ) id 1t0QPK-SH4i2j-Pc for emacs-orgmode@gnu.org; Mon, 14 Oct 2024 19:07:06 +0000 Received: from [10.57.244.36] (helo=localhost) by smtpcorp.com with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97.1-S2G) (envelope-from ) id 1t0QPJ-FnQW0hPrYAh-KZ99 for emacs-orgmode@gnu.org; Mon, 14 Oct 2024 19:07:06 +0000 Message-ID: <285d8923e769bbaadb990286c5b966f5@khan.ovh> From: Imran Khan To: emacs-orgmode@gnu.org Subject: [BUG] Writing table to a folded drawer unfolds it. [9.7.12 (release_9.7.12 @ /home/natrys/.emacs.d/elpa/org-mode/lisp/)] Date: Tue, 15 Oct 2024 01:07:02 +0600 MIME-Version: 1.0 Content-Type: text/plain X-Smtpcorp-Track: r3YlerFet7Ml.9MtPQ-5FBhca.fCL4QgvwEux Feedback-ID: 844466m:844466a-vIpdb:844466sfk7mJVyCl X-Report-Abuse: Please forward a copy of this message, including all headers, to X-Smtpcorp-Track: r3YlerFet7Ml.9MtPQ-5FBhca.fCL4QgvwEux Received-SPF: pass client-ip=43.228.186.5; envelope-from=bT.g28rokunjlrktm7=dk62pqzugp42=nuj55m7xaap3bv@em844466.khan.ovh; helo=a1i517.smtp2go.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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: 0.27 X-Spam-Score: 0.27 X-Migadu-Queue-Id: 1CF4C73C3 X-Migadu-Scanner: mx12.migadu.com X-TUID: 1jacNy/IZG2H Also any attempt to fold the drawer immediately afterwards (in same elisp thread of execution) does nothing. It seems to be specific to tables in my testing because writing anything else doesn't cause the drawer to unfold like that. For setup, given this simple org-mode file (test1.org): ``` * Headline :DRAWER: 00000000 :END: Content. ``` And a function that writes a table to current drawer at point: ``` (defun my-edit-drawer () (let* ((element (org-element-at-point)) (begin (org-element-property :contents-begin element)) (end (org-element-property :contents-end element))) (delete-region begin end) (goto-char begin) (insert "| time |\n") (insert "|-+|\n") (insert "| " (format "%f" (time-to-seconds)) " |\n") ;; problem happens without this align call too ;; so this is just for good visual (org-table-align))) ``` If we edit the test1.org with elisp: ``` (with-current-buffer "test1.org" ;; reset visibility (org-show-all) ;; make sure all the drawers are folded at first (org-fold-hide-drawer-all) (goto-char (point-min)) (search-forward ":DRAWER:") (beginning-of-line) ;; At the drawer now, let's write a table to it (when (org-at-drawer-p) (my-edit-drawer)) ;; Once done with writing, really make sure drawer is folded again (org-fold-hide-drawer-all)) ``` Not only had the originally folded drawer been unfolded, but that last `org-fold-hide-drawer-all` call that should have folded it back again, doesn't (but it works if I independently call it afterwards). ---- For some extra context, I arrived here because this causes really annoying visual glitches in org-fc (a package for flashcards and spaced repetition in org-mode). In org-fc, you can mark certain headlines as questions for flashcard with answers below, then org-fc lets you review those, and your performance data is stored in a table inside a drawer under that question. Let's say you have a top level headline, and then a few questions below it (test2.org): ``` * Subject ** Question 1 :DRAWER: 0000 :END: Content. ** Question 1 :DRAWER: 0000 :END: Content. ``` I am simplifying this but when you are reviewing a question, org-fc lets you see ancestor headlines (e.g. subject here) for extra context (but none of the siblings) with: `(org-fold-show-set-visibility 'ancestors)`. Let's say you just reviewed Question 1 (which wrote to table in its drawer), and moved on to Question 2: ``` (with-current-buffer "test2.org" ;; reset visibility (org-show-all) ;; make sure all the drawers are folded (org-fold-hide-drawer-all) (goto-char (point-min)) (search-forward ":DRAWER:") (beginning-of-line) ;; we review Question 1 and write to its drawer (when (org-at-drawer-p) (my-edit-drawer)) ;; really make sure drawer is folded after writing (org-fold-hide-drawer-all) ;;; and now we want to review Question 2 ;; but first fold everything (while (org-up-heading-safe)) (org-fold-subtree t) ;; now only show Question 2 with ancestor context (search-forward "Question 2") (org-fold-show-set-visibility 'ancestors) (org-fold-show-subtree)) ``` This should show Question 2, with only Subject headline above. But this issue causes the table in Question 1's drawer somehow bleed into the view: ``` * Top Level... | time | |-------------------| | 1728928902.770990 | :END:... ** Question 2 :DRAWER:... Content. ``` ---- Anyway, I am using Emacs from master branch, and latest release of org-mode (9.7.12). But I have checked that I can reproduce this with `emacs -Q` which loads bundled org-mode (9.7.11) with no other custom setting. But I can't reproduce this on Emacs 29.4 with its bundled org-mode (9.6.15). I am presuming this is an org-mode issue, rather than overlay rendering problem or something else in Emacs itself, but I am not sure. ---- Emacs : GNU Emacs 31.0.50 (build 1, x86_64-unknown-linux-gnu, cairo version 1.18.0) of 2024-10-14 Package: Org mode version 9.7.12 (release_9.7.12 @ /home/natyrs/.emacs.d/elpa/org-mode/lisp/)