From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 21 14:09:06 2025 Received: (at submit) by debbugs.gnu.org; 21 Aug 2025 18:09:06 +0000 Received: from localhost ([127.0.0.1]:32909 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1up9ij-0003w8-Pz for submit@debbugs.gnu.org; Thu, 21 Aug 2025 14:09:06 -0400 Received: from lists.gnu.org ([2001:470:142::17]:57892) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1up9ig-0003vZ-PD for submit@debbugs.gnu.org; Thu, 21 Aug 2025 14:09:03 -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 1up9ia-0000Gk-Re for bug-gnu-emacs@gnu.org; Thu, 21 Aug 2025 14:08:56 -0400 Received: from cyan.elm.relay.mailchannels.net ([23.83.212.47]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1up9iY-0005yB-Ue for bug-gnu-emacs@gnu.org; Thu, 21 Aug 2025 14:08:56 -0400 X-Sender-Id: dreamhost|x-authsender|contact@jamescherti.com Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id B6E86323D56 for ; Thu, 21 Aug 2025 18:08:50 +0000 (UTC) Received: from pdx1-sub0-mail-a205.dreamhost.com (100-96-10-226.trex-nlb.outbound.svc.cluster.local [100.96.10.226]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 46F49324394 for ; Thu, 21 Aug 2025 18:08:50 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1755799730; a=rsa-sha256; cv=none; b=bbF6qxoEkz1pAd/l9ZumEEcV1Y73rdgZldrl8Q9vW3qvyMoPMIq6AJwe/tumlm21ScPr7C p3vAQuDckHVCnQxb+XoDfACTP2R9YeZTEr+1CLZEHjxY8izlS6N2nWBaiwpaoMDxp0zj82 bqrapEQ5ezT1o+PzH8+bgY5jFRYMosNS7SYnPsixe7bruPwE5EEQgQ0+FnKRY5DoDrfAzW 5aoDGko/HnNGo+NjbZtZqI7wswB/fQxLMd51mmem5/ZcTvLGNoyDDhZpb71uc1IkgoEmEL xc5ZkuTTSomJc2QoMG/kmJ3w3s3Kk799ON5fhA1YDuA3mlNYoDhYkaMRNh37eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1755799730; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding:dkim-signature; bh=lcJiISHIeMKM4UDubua4aVvPTcXpBn5KYX4TJXNkbZo=; b=GxPBU9k3UP/RuHa+B3Ch6z6YOlWQZELvs/FqN9s8wcKlgquvY0NOS5iJdjlURyz1rly/Jm GHS+KeagoH+/YXliNd8/twJxPWJxvXNS4q1J9v299T0sblVNFe185sBm0UgPXrxU2JWnbW yDTSu9rGqTeyCIbKy4RWX9sT3TAtWhqxuANZ2knUnw/rT9E9exTqW+7suqxejZtcNg08cm k4P7Pmr3I9FSsSTVQZHE43DXKaGg/KJldkKyADVnySLSlUuDCyfNP+kBE+HpH7m6i4DZHg 5oMOfeKFxUqW+b1oH3sQ+Gx3qNzTZcziitalf/W0I9xa/T61QgNKIYFer7IOYQ== ARC-Authentication-Results: i=1; rspamd-544b6f689c-wv9tc; auth=pass smtp.auth=dreamhost smtp.mailfrom=contact@jamescherti.com X-Sender-Id: dreamhost|x-authsender|contact@jamescherti.com X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|contact@jamescherti.com X-MailChannels-Auth-Id: dreamhost X-Trouble-Grain: 1597f3e871aab072_1755799730540_1938385134 X-MC-Loop-Signature: 1755799730540:1593008148 X-MC-Ingress-Time: 1755799730540 Received: from pdx1-sub0-mail-a205.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.96.10.226 (trex/7.1.3); Thu, 21 Aug 2025 18:08:50 +0000 Received: from [192.168.5.23] (24-212-139-93.cable.teksavvy.com [24.212.139.93]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: contact@jamescherti.com) by pdx1-sub0-mail-a205.dreamhost.com (Postfix) with ESMTPSA id 4c7BCQ0CQqzQh for ; Thu, 21 Aug 2025 11:08:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jamescherti.com; s=dreamhost; t=1755799730; bh=lcJiISHIeMKM4UDubua4aVvPTcXpBn5KYX4TJXNkbZo=; h=Date:To:From:Subject:Content-Type:Content-Transfer-Encoding; b=oBeqfNjxys1qe0OX9oUAVIgkwYKGEU9vhTL73bRG9wSLzW6HPjCEx/nThBp3shhrZ 9VQcnmJS2OqMBy2TOJ6scg60ySQJbRPIiNFCMQV3RSE4HCYTf8cRbOy4LEt+M525R+ 8+68V6JMCGNvgWP1OCB5YDgct0mwlDBZFSNRHLdL5Anl88De2IIrtmQPlJSMrrXo43 hIscEjZkvEjtAjq7DQt45TxQYSCTOuYm+j1tdVKoTXxC20sObA/HfTzDUunq1VG17G PzBzK9f3vdZQCWxXC006awNichR4Xoq648EozEkLhNhDAv2ptDJtjzdb3uR8xX1beP lun3kZlMMNcAg== Message-ID: Date: Thu, 21 Aug 2025 14:08:49 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: bug-gnu-emacs@gnu.org From: James Cherti Subject: outline-mode: attempting to open folded sections does not work as expected inside a deeply nested header Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=23.83.212.47; envelope-from=contact@jamescherti.com; helo=cyan.elm.relay.mailchannels.net 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=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-Spam-Score: 0.9 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) When using outline-mode or outline-minor-mode, attempting to open folded sections (outline-show-entry) does not work as expected when the cursor is positioned inside a deeply nested header. Steps to Reproduce: ------------------- 1. Open an outline-mode buffer with multiple nested headers, for example: --8<---------------cut here---------------start------------->8--- Level 1 ** Level 2 *** Level 3 **** Level 4: A Some content here Some content here Some content here Some content here **** Level 4: B Some content here Some content here Some content here Some content here **** Level 4: C Some content here Some content here< PUT THE CURSOR HERE Some content here Some content here **** Level 4: D Some content here Some content here Some content here Some content here Some content here **** Level 4: E Some content here Some content here Some content here --8<---------------cut here---------------start------------->8--- 2. Put the cursor before `< PUT THE CURSOR HERE` 3. Collapse all folds with: (hide-sublevels 1) 6. Show entry: (outline-show-entry) The folds fail to expand fully in nested hierarchies, leaving all content hidden except for `level 4: C`. Screenshot: https://github.com/user-attachments/assets/2ea6c3bd-0284-40a7-90e5-1619bdf3acc5 Expected Behavior: ------------------ The expected behavior is that only the heading at point (and its associated content) should be expanded, while all ancestor headings remain collapsed. (Similar to other editors.) Actual Behavior: ---------------- Only the heading at point expands, while other headings remain invisible, which is confusing. In some cases, these hidden headings cannot be revealed until the parent heading is first collapsed and then expanded again. Environment: ------------ * Emacs version: 30.2 and master branch (ade6608e2587452c8ea565ce3057879379ebd0b5) -- James Cherti GitHub: https://github.com/jamescherti Website: https://www.jamescherti.com/ From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 21 14:34:46 2025 Received: (at 79286) by debbugs.gnu.org; 21 Aug 2025 18:34:46 +0000 Received: from localhost ([127.0.0.1]:32961 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1upA7Z-00058N-KS for submit@debbugs.gnu.org; Thu, 21 Aug 2025 14:34:46 -0400 Received: from mout-p-102.mailbox.org ([80.241.56.152]:49138) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1upA7V-00057z-8N for 79286@debbugs.gnu.org; Thu, 21 Aug 2025 14:34:43 -0400 Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4c7Bn26qbVz9thy; Thu, 21 Aug 2025 20:34:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1755801271; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=mzd3LHlRop53ap2xgYbgPYsEKVRQ6uQym/nA8sr+hlw=; b=Uo/7EZ43ADW/XY1ChnV9oublXIbbC+SHLu7JYXjbEVkfyCTnP/y8yy+IXWeoc3JKbPE6Rv o74zGdzRQsb4IfOc20uKu0FYa32lXnMnVwKxRsNzuQSp8fIQicm5RW/5Pt3Xiso9eQIbPw sJDu/Hwp8Sd/TiYWzJyzLTo6qhn9/f/CgLVrs8W3/R8unwV+kxsD/2vxEGKciqlDXafgys 4ReKIkILvMuqWA+TDnBx+jq9KDBIunRjLxkoq1cbtYYihZFN1Bu4369Uwg5lCVgc/JFW1c aVXtCbMfGgsNx83qnJ7u3wf+seTZIWknGE56MR9ElZ2u3dOt86Y52xyZZLQtUg== From: Rahguzar To: James Cherti Subject: Re: bug#79286: outline-mode: attempting to open folded sections does not work as expected inside a deeply nested header Date: Thu, 21 Aug 2025 23:34:27 +0500 Message-ID: <87a53smslo.fsf@mailbox.org> MIME-Version: 1.0 Content-Type: text/plain X-MBO-RS-ID: c3e5c90cf0c82899ad5 X-MBO-RS-META: p4bwe8h7da6jjysd6u7ebdgpk53hjpge X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 79286 Cc: 79286@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi James, James Cherti writes: > When using outline-mode or outline-minor-mode, attempting to > open folded sections (outline-show-entry) does not work as > expected when the cursor is positioned inside a deeply > nested header. > > Steps to Reproduce: > ------------------- > 1. Open an outline-mode buffer with multiple > nested headers, for example: > > Level 1 > ** Level 2 > *** Level 3 > **** Level 4: A > Some content here > Some content here > Some content here > Some content here > **** Level 4: B > Some content here > Some content here > Some content here > Some content here > **** Level 4: C > Some content here > Some content here< PUT THE CURSOR HERE > Some content here > Some content here > **** Level 4: D > Some content here > Some content here > Some content here > Some content here > Some content here > **** Level 4: E > Some content here > Some content here > Some content here > > 2. Put the cursor before `< PUT THE CURSOR HERE` > > 3. Collapse all folds with: (hide-sublevels 1) > > 6. Show entry: (outline-show-entry) > > The folds fail to expand fully in nested hierarchies, leaving all > content hidden except for `level 4: C`. > > Screenshot: > https://github.com/user-attachments/assets/2ea6c3bd-0284-40a7-90e5-1619bdf3acc5 > > Expected Behavior: > ------------------ > The expected behavior is that only the heading at point (and > its associated content) should be expanded, while all > ancestor headings remain collapsed. (Similar to other editors.) > > Actual Behavior: > ---------------- > Only the heading at point expands, while other headings > remain invisible, which is confusing. In some cases, these > hidden headings cannot be revealed until the parent heading > is first collapsed and then expanded again. I have encountered this with isearch and was able to fix this with in my init file. ```emacs-lisp (defun +outline-reveal (pos) (let ((heading-pos nil)) (while (not (eq heading-pos (progn (outline-back-to-heading) (point)))) (setq heading-pos (point)) (outline-show-children) (goto-char pos)) (outline-show-entry) (goto-char pos))) (defun +outline-invsible-open (&optional _) (when (and outline-minor-mode (outline-invisible-p)) (+outline-reveal (point)))) (setq outline-isearch-open-invisible-function #'+outline-invsible-open) ``` With an interactive spec the function +outline-reveal can be used as an alternative to outline-show-entry without this problem but I can't imagine a scenario where that might be needed. > Environment: > ------------ > * Emacs version: 30.2 and master branch > (ade6608e2587452c8ea565ce3057879379ebd0b5) > > -- > James Cherti > GitHub: https://github.com/jamescherti > Website: https://www.jamescherti.com/ Rahguzar From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 21 15:09:28 2025 Received: (at 79286) by debbugs.gnu.org; 21 Aug 2025 19:09:28 +0000 Received: from localhost ([127.0.0.1]:33035 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1upAf9-0006kU-G8 for submit@debbugs.gnu.org; Thu, 21 Aug 2025 15:09:28 -0400 Received: from bisque.elm.relay.mailchannels.net ([23.83.212.18]:48257) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1upAf5-0006kG-VY for 79286@debbugs.gnu.org; Thu, 21 Aug 2025 15:09:25 -0400 X-Sender-Id: dreamhost|x-authsender|contact@jamescherti.com Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 98485785496; Thu, 21 Aug 2025 19:09:21 +0000 (UTC) Received: from pdx1-sub0-mail-a230.dreamhost.com (100-96-19-76.trex-nlb.outbound.svc.cluster.local [100.96.19.76]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 416617851F6; Thu, 21 Aug 2025 19:09:21 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1755803361; a=rsa-sha256; cv=none; b=PawUumF5MDRGB4gztbCfLoUMsBYCkmXTukvGTACzyL/U0eFLZ4AjWzZais1NsNxs0/WrF6 RSTMwcxvcf+w6s1IXdiywNswZB8ndia+xCcNjsInSqbwS73286bIkJWeoJarDbO5Kud+14 FTvyemzWSqERjitlTYT6EtPJB/mvWZKLob6Da/SVUY/vvYvtcHRQxyfssk+Q1Jf4AIYv+O rDimjweLhATFSi8d8OS6Y0pw+JUz5MECwN2MpnT6ItQv+q2uRwl67ygXwMo+Uc06JaaoXi LaATt0VD86v25py1T5fKBDp4e8V51/R3x0a4b9n4VMtWiA8sWaJBIr5XAG3Bjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1755803361; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=h9pKw14GNq+rU/QGS8vqSQsZnUir1aGsLcDhqHpvJts=; b=KghR3Cwhqy9IBiYVSD7tQbzLGxQgAgAyqrlFRt+XXrYDSCZ/vnko7HKy0YXviqz2+IMaX3 HDJi9SgF/StKZ2sHnxhLv8QTMUzdGP5ZdXO+MY26U1yV+EbIyeKamgl/mBKbSONL+yshFY ERpAJujnm/mRqVoIkF6Idrg2vN3KR9nAo+uvz8JHa/zjourIF/+ItkVlPqT9U8WDdKC5Dc WfPX8pJ83j7ukxgm6DIxg7r5VdxoC635ss0U+ltVQRu2qcmc8VdSVjsRmMDYTDvVAUg+vQ ScQNt8M91i7Z+RFx7l+j6EyCFFzwnlneEIIk8UoQII8yIG6dsSdABaFOR1KHlw== ARC-Authentication-Results: i=1; rspamd-544b6f689c-tjvn6; auth=pass smtp.auth=dreamhost smtp.mailfrom=contact@jamescherti.com X-Sender-Id: dreamhost|x-authsender|contact@jamescherti.com X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|contact@jamescherti.com X-MailChannels-Auth-Id: dreamhost X-Coil-Share: 3cd38132110e0089_1755803361473_1089391641 X-MC-Loop-Signature: 1755803361473:59234271 X-MC-Ingress-Time: 1755803361472 Received: from pdx1-sub0-mail-a230.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.96.19.76 (trex/7.1.3); Thu, 21 Aug 2025 19:09:21 +0000 Received: from [192.168.5.23] (24-212-139-93.cable.teksavvy.com [24.212.139.93]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: contact@jamescherti.com) by pdx1-sub0-mail-a230.dreamhost.com (Postfix) with ESMTPSA id 4c7CYD6dcGzDg; Thu, 21 Aug 2025 12:09:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jamescherti.com; s=dreamhost; t=1755803361; bh=h9pKw14GNq+rU/QGS8vqSQsZnUir1aGsLcDhqHpvJts=; h=Date:Subject:To:Cc:From:Content-Type:Content-Transfer-Encoding; b=Svyr7SiNHhtSbUwGFa+vl5Agp/Sl55jMGJoF3i3NkWudMGoXQH4M7RI9Kp51kdpDw 4UsmwhaWJqRZtufHDyARkYIrFVj4n7AMJPZSAp20BaRptjllK7i2pHAGiha468UoZd m9H723Z8Q7vfWPhp+oKotrIpiPyam8Ftmd4S5kv/gCojuiKLvlB611Q3nH6364312K XnZSdtQO/N/QiCOhdB/DRARv2lu6ggO+vyxxfPQTHwVKl2BnuIM2QaDXJ8fxYBC3wD yDH3xWpWuG+vP5VHfZ+OvYRELWDwh7zpMXBiYIylI1nFp357jzBQJwnwOmkKODnWPA UUkALWasug87Q== Message-ID: Date: Thu, 21 Aug 2025 15:09:19 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#79286: outline-mode: attempting to open folded sections does not work as expected inside a deeply nested header To: Rahguzar References: <87a53smslo.fsf@mailbox.org> Content-Language: en-US From: James Cherti In-Reply-To: <87a53smslo.fsf@mailbox.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79286 Cc: 79286@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 2025-08-21 14:34, Rahguzar wrote: > Hi James, Hi Rahguzar, > James Cherti writes: > >> When using outline-mode or outline-minor-mode, attempting to >> open folded sections (outline-show-entry) does not work as >> expected when the cursor is positioned inside a deeply >> nested header. >> >> Steps to Reproduce: >> ------------------- >> 1. Open an outline-mode buffer with multiple >> nested headers, for example: >> >> Level 1 >> ** Level 2 >> *** Level 3 >> **** Level 4: A >> Some content here >> Some content here >> Some content here >> Some content here >> **** Level 4: B >> Some content here >> Some content here >> Some content here >> Some content here >> **** Level 4: C >> Some content here >> Some content here< PUT THE CURSOR HERE >> Some content here >> Some content here >> **** Level 4: D >> Some content here >> Some content here >> Some content here >> Some content here >> Some content here >> **** Level 4: E >> Some content here >> Some content here >> Some content here >> >> 2. Put the cursor before `< PUT THE CURSOR HERE` >> >> 3. Collapse all folds with: (hide-sublevels 1) >> >> 6. Show entry: (outline-show-entry) >> >> The folds fail to expand fully in nested hierarchies, leaving all >> content hidden except for `level 4: C`. >> >> Screenshot: >> https://github.com/user-attachments/assets/2ea6c3bd-0284-40a7-90e5-1619bdf3acc5 >> >> Expected Behavior: >> ------------------ >> The expected behavior is that only the heading at point (and >> its associated content) should be expanded, while all >> ancestor headings remain collapsed. (Similar to other editors.) >> >> Actual Behavior: >> ---------------- >> Only the heading at point expands, while other headings >> remain invisible, which is confusing. In some cases, these >> hidden headings cannot be revealed until the parent heading >> is first collapsed and then expanded again. > > I have encountered this with isearch and was able to fix this > with in my init file. > > ```emacs-lisp > (defun +outline-reveal (pos) > (let ((heading-pos nil)) > (while (not (eq heading-pos (progn (outline-back-to-heading) (point)))) > (setq heading-pos (point)) > (outline-show-children) > (goto-char pos)) > (outline-show-entry) > (goto-char pos))) > > (defun +outline-invsible-open (&optional _) > (when (and outline-minor-mode > (outline-invisible-p)) > (+outline-reveal (point)))) > > (setq outline-isearch-open-invisible-function #'+outline-invsible-open) > ``` > With an interactive spec the function +outline-reveal can be used as an > alternative to outline-show-entry without this problem but I can't > imagine a scenario where that might be needed. > Unfortunately, neither `+outline-reveal` nor `+outline-invisible-open` resolves this issue. I wrote the following Elisp code to fix this issue: --8<---------------cut here---------------start------------->8--- ;; Author James Cherti ;; GitHub: https://github.com/jamescherti (defun my-outline-show-entry () "Show the body directly following this heading. Show the heading too, if it is currently invisible." (interactive) ;; Show previous headers (unless (derived-mode-p 'outline-indent-minor-mode) (save-excursion (let ((func-invisible-p (cond ((and (derived-mode-p 'org-mode) (fboundp 'org-invisible-p)) 'org-invisible-p) ((and (or (derived-mode-p 'outline-mode) (derived-mode-p 'outline-minor-mode)) (fboundp 'outline-invisible-p)) 'outline-invisible-p) (t 'invisible-p))) (initial-point (point)) (visual-point nil) (visual-init-point nil)) ;; Unfolding loop (while (and ;; Folded? (save-excursion (end-of-line) (funcall func-invisible-p (point))) ;; When the real point differs from the visual point, it indicates ;; that the cursor is still located within a hidden header. ;; ;; This prevents infinite loops if the unfolding stops changing ;; the cursor position. (or (not visual-init-point) (not visual-point) (/= visual-init-point visual-point))) (save-excursion (outline-back-to-heading) (beginning-of-line) (setq visual-point (point)) (with-no-warnings (show-children)) ;; Go back to point (goto-char initial-point) (outline-back-to-heading) (beginning-of-line) (setq visual-init-point (point)))) ;; Previous version of `outline-show-entry' (save-excursion (outline-back-to-heading t) (outline-flag-region (1- (point)) (progn (outline-next-preface) (if (= 1 (- (point-max) (point))) (point-max) (point))) nil)))))) (advice-add 'outline-show-entry :override #'my-outline-show-entry) --8<---------------cut here---------------start------------->8--- This could likely be simplified using built-in functions. I welcome any suggestions for improvement. >> Environment: >> ------------ >> * Emacs version: 30.2 and master branch >> (ade6608e2587452c8ea565ce3057879379ebd0b5) >> >> -- >> James Cherti >> GitHub: https://github.com/jamescherti >> Website: https://www.jamescherti.com/ > > Rahguzar -- James Cherti GitHub: https://github.com/jamescherti Website: https://www.jamescherti.com/ From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 22 10:47:30 2025 Received: (at 79286) by debbugs.gnu.org; 22 Aug 2025 14:47:31 +0000 Received: from localhost ([127.0.0.1]:37019 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1upT3C-0005OD-3N for submit@debbugs.gnu.org; Fri, 22 Aug 2025 10:47:30 -0400 Received: from toucan.tulip.relay.mailchannels.net ([23.83.218.254]:51387) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1upT34-0005Nl-1u for 79286@debbugs.gnu.org; Fri, 22 Aug 2025 10:47:26 -0400 X-Sender-Id: dreamhost|x-authsender|contact@jamescherti.com Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 6565424D6E; Fri, 22 Aug 2025 14:47:19 +0000 (UTC) Received: from pdx1-sub0-mail-a237.dreamhost.com (100-96-24-5.trex-nlb.outbound.svc.cluster.local [100.96.24.5]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 02FAC24C60; Fri, 22 Aug 2025 14:47:19 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1755874039; a=rsa-sha256; cv=none; b=eDDTvsZE6FFTWkPjUfyFOOHuAgtYAhlgS7EFc8Pb7X0SYb+Oz88VsdTDH1ss1hKQp0jvui 1573yG84erfcnbuisifpHqbCBNOGSZWRzjSvV5xZuJIKdPAjoecHhjZMe5vzLR3oyf4H1O 3ZYrU+c8OvlgKy/iSrUxC3p589S9axpNK0Z4XVJGccaEC3+n/9KGPab++c/M8R6ivZiewL VJrweSMBrqWaATldt/4xSDY4OPjvXK+eO5sl06c7CMLxxBEytjb7/G+YEck9CbYnwG+qmR r7C2fwIcvLHp/CdAv6bL8o/LNiwD9j17BTEtr9Z9nhVuCjcWA5QOGNJ7qDLN3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1755874039; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=TIoLie8122R6alTouPYkW8adnYZdCJj97rX/OW1HGpw=; b=iVpZ7delGLTZTyHqwmjvEThrY/+yq38CVlxDlD+nHczdGQWyLw3JmsF+Tk0PxnS6GWI85i JuvxsN6o6KwX9RxMX+Gzt4LUjYulk5uNsleIOegmK+LFmVTz1bzmzgBNx5+232Bo8O+CLq ZzN0b0SvSkOb7LUJVGG2p/bI93oDEUkHb9QVB7c1hgBnKBZ07DClsqG//LAK4f5EQQU6MN ++lzK3poT2BThpnWGEAwIYm97h8xgFAIIjx2Tn/tuy1O6FE+KNBv+iByw5GClDK8rw04wa DzI9jGOV2UhlX8UESYuwjRz4+BM+IJbgaLITvOPn4/CTcvNSiPWtUMdlGoryvQ== ARC-Authentication-Results: i=1; rspamd-b597879cf-4vnp7; auth=pass smtp.auth=dreamhost smtp.mailfrom=contact@jamescherti.com X-Sender-Id: dreamhost|x-authsender|contact@jamescherti.com X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|contact@jamescherti.com X-MailChannels-Auth-Id: dreamhost X-Trouble-Interest: 1b2d8b085c26b058_1755874039225_476225006 X-MC-Loop-Signature: 1755874039225:236776431 X-MC-Ingress-Time: 1755874039225 Received: from pdx1-sub0-mail-a237.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.96.24.5 (trex/7.1.3); Fri, 22 Aug 2025 14:47:19 +0000 Received: from [192.168.5.23] (24-212-139-93.cable.teksavvy.com [24.212.139.93]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: contact@jamescherti.com) by pdx1-sub0-mail-a237.dreamhost.com (Postfix) with ESMTPSA id 4c7jhQ23ppz9s; Fri, 22 Aug 2025 07:47:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jamescherti.com; s=dreamhost; t=1755874038; bh=TIoLie8122R6alTouPYkW8adnYZdCJj97rX/OW1HGpw=; h=Date:Subject:From:To:Cc:Content-Type:Content-Transfer-Encoding; b=IGAvjm27SHNpFPK3a75biVjiOjDNu9gH/mM1X+ZbiejqprvfMVfIWJRxk4QArCByH BDxaWrPJJ1uZ1qOar/vMt+4/TKSn8fR/hxN7qm0vqQeLWoYslWfCdrV067Y0Eh88Qh 7J1Vi9T9bLpwWVl1B5vD+GeUz30S5wCvQTBIgaHCLXLDQB752j1Rxas+fE1HSzdCJK IRHl8hAumHgYicvZ4WdJGBjsoJ7y6IuAQ/aQqeMEJq4qKtZnpuYKyAhwiASMWotiMr +26T2sXtqp7mHcWlKFADXM+7eus/GP2nCONOJplEI3LhMMImAiw2yCy9+8ssRCwZOn z9ejoDZYb4Mgw== Message-ID: <022fc6e9-80a0-4b76-920f-7f6573c12a19@jamescherti.com> Date: Fri, 22 Aug 2025 10:47:15 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#79286: outline-mode: attempting to open folded sections does not work as expected inside a deeply nested header From: James Cherti To: Rahguzar References: <87a53smslo.fsf@mailbox.org> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79286 Cc: 79286@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Here is an improved version of my-outline-show-entry that I am currently using to address this issue in my configuration. I would greatly appreciate any comments or suggestions prior to finalizing the patch. --8<---------------cut here---------------start------------->8--- ;; Author James Cherti ;; GitHub: https://github.com/jamescherti (defun my-outline-legacy-show-entry () "Show the body directly following this heading. Show the heading too, if it is currently invisible. (This is the Emacs version of `outline-show-entry'.)" (interactive) (save-excursion (outline-back-to-heading t) (outline-flag-region (1- (point)) (progn (outline-next-preface) (if (= 1 (- (point-max) (point))) (point-max) (point))) nil))) (defun my-outline-heading-folded-p () "Return non-nil if the body following the current heading is folded." (save-excursion (end-of-line) (outline-invisible-p (point)))) (defun my-outline-show-entry () "Ensure the current heading and body are fully visible. Repeatedly reveal children and body until the entry is no longer folded." (interactive) (save-excursion ;; Repeatedly reveal children and body until the entry is no longer folded (while (my-outline-heading-folded-p) (save-excursion (outline-back-to-heading) (outline-show-children) (my-outline-legacy-show-entry))) ;; Final pass to guarantee the heading under the cursor and its body are ;; visible (my-outline-legacy-show-entry))) ;; Advice (advice-add 'outline-show-entry :override #'my-outline-show-entry) --8<---------------cut here---------------start------------->8--- -- James Cherti GitHub: https://github.com/jamescherti Website: https://www.jamescherti.com/ On 2025-08-21 15:09, James Cherti wrote: > On 2025-08-21 14:34, Rahguzar wrote: >> Hi James, > > Hi Rahguzar, > >> James Cherti writes: >> >>> When using outline-mode or outline-minor-mode, attempting to >>> open folded sections (outline-show-entry) does not work as >>> expected when the cursor is positioned inside a deeply >>> nested header. >>> >>> Steps to Reproduce: >>> ------------------- >>> 1. Open an outline-mode buffer with multiple >>>      nested headers, for example: >>> >>> Level 1 >>> ** Level 2 >>> *** Level 3 >>> **** Level 4: A >>> Some content here >>> Some content here >>> Some content here >>> Some content here >>> **** Level 4: B >>> Some content here >>> Some content here >>> Some content here >>> Some content here >>> **** Level 4: C >>> Some content here >>> Some content here< PUT THE CURSOR HERE >>> Some content here >>> Some content here >>> **** Level 4: D >>> Some content here >>> Some content here >>> Some content here >>> Some content here >>> Some content here >>> **** Level 4: E >>> Some content here >>> Some content here >>> Some content here >>> >>> 2. Put the cursor before `< PUT THE CURSOR HERE` >>> >>> 3. Collapse all folds with: (hide-sublevels 1) >>> >>> 6. Show entry: (outline-show-entry) >>> >>> The folds fail to expand fully in nested hierarchies, leaving all >>> content hidden except for `level 4: C`. >>> >>> Screenshot: >>> https://github.com/user-attachments/ >>> assets/2ea6c3bd-0284-40a7-90e5-1619bdf3acc5 >>> >>> Expected Behavior: >>> ------------------ >>> The expected behavior is that only the heading at point (and >>> its associated content) should be expanded, while all >>> ancestor headings remain collapsed. (Similar to other editors.) >>> >>> Actual Behavior: >>> ---------------- >>> Only the heading at point expands, while other headings >>> remain invisible, which is confusing. In some cases, these >>> hidden headings cannot be revealed until the parent heading >>> is first collapsed and then expanded again. >> >> I have encountered this with isearch and was able to fix this >> with in my init file. >> >> ```emacs-lisp >>    (defun +outline-reveal (pos) >>      (let ((heading-pos nil)) >>        (while (not (eq heading-pos (progn (outline-back-to-heading) >> (point)))) >>          (setq heading-pos (point)) >>          (outline-show-children) >>          (goto-char pos)) >>        (outline-show-entry) >>        (goto-char pos))) >> >>    (defun +outline-invsible-open (&optional _) >>      (when (and outline-minor-mode >>                 (outline-invisible-p)) >>        (+outline-reveal (point)))) >> >>    (setq outline-isearch-open-invisible-function #'+outline-invsible- >> open) >> ``` >> With an interactive spec the function +outline-reveal can be used as an >> alternative to outline-show-entry without this problem but I can't >> imagine a scenario where that might be needed. >> > > Unfortunately, neither `+outline-reveal` nor `+outline-invisible-open` > resolves this issue. > > I wrote the following Elisp code to fix this issue: > --8<---------------cut here---------------start------------->8--- > ;; Author James Cherti > ;; GitHub: https://github.com/jamescherti > (defun my-outline-show-entry () >   "Show the body directly following this heading. > Show the heading too, if it is currently invisible." >   (interactive) > >   ;; Show previous headers >   (unless (derived-mode-p 'outline-indent-minor-mode) >     (save-excursion >       (let ((func-invisible-p >              (cond >               ((and (derived-mode-p 'org-mode) >                     (fboundp 'org-invisible-p)) >                'org-invisible-p) > >               ((and (or (derived-mode-p 'outline-mode) >                         (derived-mode-p 'outline-minor-mode)) >                     (fboundp 'outline-invisible-p)) >                'outline-invisible-p) > >               (t >                'invisible-p))) >             (initial-point (point)) >             (visual-point nil) >             (visual-init-point nil)) >         ;; Unfolding loop >         (while (and >                 ;; Folded? >                 (save-excursion >                   (end-of-line) >                   (funcall func-invisible-p (point))) >                 ;; When the real point differs from the visual point, > it indicates >                 ;; that the cursor is still located within a hidden > header. >                 ;; >                 ;; This prevents infinite loops if the unfolding stops > changing >                 ;; the cursor position. >                 (or >                  (not visual-init-point) >                  (not visual-point) >                  (/= visual-init-point visual-point))) > >           (save-excursion >             (outline-back-to-heading) >             (beginning-of-line) >             (setq visual-point (point)) >             (with-no-warnings >               (show-children)) > >             ;; Go back to point >             (goto-char initial-point) >             (outline-back-to-heading) >             (beginning-of-line) >             (setq visual-init-point (point)))) > >         ;; Previous version of `outline-show-entry' >         (save-excursion >           (outline-back-to-heading t) >           (outline-flag-region (1- (point)) >                                (progn >                                  (outline-next-preface) >                                  (if (= 1 (- (point-max) (point))) >                                      (point-max) >                                    (point))) >                                nil)))))) > > (advice-add 'outline-show-entry :override #'my-outline-show-entry) > --8<---------------cut here---------------start------------->8--- > > This could likely be simplified using built-in functions. > I welcome any suggestions for improvement. > >>> Environment: >>> ------------ >>> * Emacs version: 30.2 and master branch >>> (ade6608e2587452c8ea565ce3057879379ebd0b5) >>> >>> -- >>> James Cherti >>> GitHub: https://github.com/jamescherti >>> Website: https://www.jamescherti.com/ >> >> Rahguzar > > -- > James Cherti > GitHub: https://github.com/jamescherti > Website: https://www.jamescherti.com/ > > >