From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id wPNiKuNefmLTwgAAbAwnHQ (envelope-from ) for ; Fri, 13 May 2022 15:36:35 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id CGR+KeNefmJsOQAAG6o9tA (envelope-from ) for ; Fri, 13 May 2022 15:36:35 +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 1B516347D3 for ; Fri, 13 May 2022 15:36:35 +0200 (CEST) Received: from localhost ([::1]:58018 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1npVT8-0005rE-8G for larch@yhetil.org; Fri, 13 May 2022 09:36:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43264) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1npVRW-0005Zp-T3 for emacs-orgmode@gnu.org; Fri, 13 May 2022 09:34:55 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]:38419) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1npVRU-00035l-Mv for emacs-orgmode@gnu.org; Fri, 13 May 2022 09:34:54 -0400 Received: by mail-pl1-x636.google.com with SMTP id n18so7958024plg.5 for ; Fri, 13 May 2022 06:34:52 -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=hQKA2j0+fSnkEcEeHguMzORhwrfHuJ4hJqMBH3fksGI=; b=PbXPmqdac8OPyRvIBflKu0/O8Nup3JLQkh0GQshcnjrdAGNe8g2bM+MXE4WmJXKsmy kljtmcmp+Y66OzO9CGmsaNzKszcGJI/Su1W+FEHCfJiPR8lIHzomKvsKebYjtJltJe9O Dr7JPjUYb3tIIt/zBmvSGNAqA4eeJCqAct1NNiH8TlpF8fEyPqEFWW+9uqvQCuJRvFJD afjPFzcfXhNpfJAhb1ZGqLGvUNR30FU8h7zHSfaV9AzPRccOFdubGKuXtQB++3LxrHYX Ra5Mt2q/hxlMAdCvpbrH25zbjzwoMqytHCLNlmQ/OMrhJQTG59jsm78S915d49zOBAgF VLfg== 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=hQKA2j0+fSnkEcEeHguMzORhwrfHuJ4hJqMBH3fksGI=; b=Nq6EAxy1nR0q2bantrTutTpgdOxzwb7yre+pev6rwN4pN1FN9C+jzeBce8u2MHyT/K iqOaTG9NTXmZSlf52QAzzZlOGg8R1IXj/ZGsTO0FuO2PZZqebIkQeWD9c0PWFOHGowiz 3Tf5DMZQ6Pb9f4vjePuXxC84imenK6xI5cDDW2DHVU0oCawjZ25vgI6s58vz2Wxjtm2W gV7wV8Gcu+E2B2Drd37hqbCRU+ElcdrqHnAxdezIYjLlcMAkP9rwpZu3qLT01oWazPNc cxFYpYILpq1wDrLpWEpTUzyoSW6Rh/sZuQM+mrsqRVF6FIFcpMJALAS6VY97oEVUj8pS GiAA== X-Gm-Message-State: AOAM532HtGr9eCTlR5bcoEjoowTh1rijOZFXtoITn63DJ0EH4/EWxSXJ RqTRncX+5GrDsG1GnfLCy34= X-Google-Smtp-Source: ABdhPJz8VtlzddGoM0jsKtxlR7l9aemJLEZH+PeBp61yAeaM/Y1xhMOnz9IKpE8pHBhaxWKvyHyJ+w== X-Received: by 2002:a17:90b:4b01:b0:1dc:7405:dd62 with SMTP id lx1-20020a17090b4b0100b001dc7405dd62mr5038639pjb.160.1652448891342; Fri, 13 May 2022 06:34:51 -0700 (PDT) Received: from localhost ([37.120.210.2]) by smtp.gmail.com with ESMTPSA id w20-20020a170902ca1400b0015f391f56b7sm1739224pld.305.2022.05.13.06.34.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 06:34:50 -0700 (PDT) From: Ihor Radchenko To: John Kitchin Cc: Richard Stanton , emacs-orgmode@gnu.org Subject: [PATCH] Re: How to stop results being hidden when using ":results drawer"? In-Reply-To: References: <21F026ED-1504-4F33-B596-769CD294AC4A@berkeley.edu> <877d6rhxcf.fsf@localhost> <8735hdr5ss.fsf@localhost> Date: Fri, 13 May 2022 21:35:34 +0800 Message-ID: <87tu9tpnbt.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=yantar92@gmail.com; helo=mail-pl1-x636.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=1652448995; 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=hQKA2j0+fSnkEcEeHguMzORhwrfHuJ4hJqMBH3fksGI=; b=fgjTWZ1eKFMXHKdOQOxn8dCnBz4nBO8ERgunqom5w0nRYIH9yOfcJcoFgRUkAKrWfYLkVj KogprR6EbZ0WPIOBtzmSqli+V5dqXvHWrxx1NhBGABeyKat28NwZL9kHFZTSKPyf9LURiR TcIERrMoNS8zdi1rDb6Cgr8Qai4NZrlzTA5bZA3epTl0cnICV9ox7XNvYPBpiV3v4oQkr7 D4VZLDn/zP8edlmQh5Zbi9o10FNw/1YWw08fTzi+UbtE3teni+TFQvL43iG6uGYdG2y5Ub YdrP9vk21p39egKCoOTAGqxmr4wT23wi1uN9WuUPxoB1GB/07glUiUA9EX9Hnw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1652448995; a=rsa-sha256; cv=none; b=g+P+ffnuRrFD2kWgeadK2ycAm+KdpPbZVfuf/LDxCkQpJ29RQUT2Wz0pRWCIgolf3BNAbO wiUMODRBdxyURHPAesLzxK6MKo/A7DMFIZEPXoT3VWiocpNhngveSEQmdBQUuOoj/UWtvR jdsZKs3I1Ackd0r6ggT2HHZsW2/HzDhc9YENKSSEqnxNaW2SrqX248s/4+K/c4iBpVAUXg umbXfd2aBC3DghCWHsk5qF+cnA9lRom7HNJb6V8TWDp/LWuNV4BN8p6RvtcX72TQnRDJeA gx+8F6P/8DPcxWvXfNl2MNZxLynBaj996fUw21i3cDM4PONiNHM9UZUFuGvAIA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=PbXPmqda; 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: -2.52 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=PbXPmqda; 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: 1B516347D3 X-Spam-Score: -2.52 X-Migadu-Scanner: scn1.migadu.com X-TUID: Lkg+oG+Hf9Nd --=-=-= Content-Type: text/plain John Kitchin writes: > This issue is specific to using a scimax function > `scimax-ob-execute-and-next-block` that executes the current block then > moves to the next or creates a new block if needed. This is a UI feature > from jupyter notebooks that I like to use. > > That function uses `(org-babel-next-src-block)`, which uses > org-next-block, which calls org-show-context, which uses > org-show-set-visibility, which calls org-show-entry, which hides the > drawers. > > It isn't an org-core issue perhaps, other than it is not obvious why > org-show-entry has a hard-coded line to hide drawers in it. I'd say that it is org-core issue. The current behaviour does not really follow what org-fold-show-entry docstring promises: >> Show the body directly following its heading. >> Show the heading too, if it is currently invisible. In fact, forcefully folding the drawers is relatively recent addition by Nicolas in 1027e0256903bc2. I am attaching the patch making drawer folding controllable via optional argument. WDYT? Best, Ihor --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-org-fold-show-entry-Do-not-fold-drawers-unless-reque.patch >From bd3c7ac6162d64a19eff370b7b22ba233f8480ad Mon Sep 17 00:00:00 2001 Message-Id: From: Ihor Radchenko Date: Fri, 13 May 2022 21:30:46 +0800 Subject: [PATCH] org-fold-show-entry: Do not fold drawers unless requested * lisp/org-fold.el (org-fold-show-entry): Do not fold drawers in the unfolded entry unless the new optional argument is non-nil. Folding the drawers was introduced in 1027e0256903bc2, but does not follow the function docstring. Moreover, folding drawers creates unexpected behaviour in some cases. See https://orgmode.org/list/m2a6bl4mmr.fsf@andrew.cmu.edu * etc/ORG-NEWS (~org-fold-show-entry~ does not fold drawers by default anymore): Document the change. * lisp/org-agenda.el (org-agenda-show): (org-agenda-show-and-scroll-up): (org-agenda-show-1): * lisp/org-clock.el (org-clock-goto): * lisp/org-compat.el (outline-toggle-children): * lisp/org-timer.el (org-timer--get-timer-title): * lisp/org.el (org-move-subtree-down): (org-return): Explicitly request folding drawers inside the revealed entry in the places where it appears to make sense. --- etc/ORG-NEWS | 7 +++++++ lisp/org-agenda.el | 6 +++--- lisp/org-clock.el | 2 +- lisp/org-compat.el | 2 +- lisp/org-fold.el | 4 ++-- lisp/org-timer.el | 2 +- lisp/org.el | 4 ++-- 7 files changed, 17 insertions(+), 10 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 582816534..15986c935 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -190,6 +190,13 @@ installed. It uses Emacs' font-lock information, and so tends to produce results superior to Minted or Listings. ** New functions and changes in function arguments +*** ~org-fold-show-entry~ does not fold drawers by default anymore + +~org-fold-show-entry~ now accepts an optional argument HIDE-DRAWERS. +When the argument is non-nil, the function folds all the drawers +inside entry. This was the default previously. + +Now, ~org-fold-show-entry~ does not fold drawers by default. *** New function ~org-element-cache-map~ for quick mapping across Org elements diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 0479a0e1f..6fd0e4498 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -9701,7 +9701,7 @@ (defun org-agenda-show (&optional full-entry) (interactive "P") (let ((win (selected-window))) (org-agenda-goto t) - (when full-entry (org-fold-show-entry)) + (when full-entry (org-fold-show-entry 'hide-drawers)) (select-window win))) (defvar org-agenda-show-window nil) @@ -9720,7 +9720,7 @@ (defun org-agenda-show-and-scroll-up (&optional arg) (select-window org-agenda-show-window) (ignore-errors (scroll-up))) (org-agenda-goto t) - (org-fold-show-entry) + (org-fold-show-entry 'hide-drawers) (if arg (org-cycle-hide-drawers 'children) (org-with-wide-buffer (narrow-to-region (org-entry-beginning-position) @@ -9764,7 +9764,7 @@ (defun org-agenda-show-1 (&optional more) ((and (called-interactively-p 'any) (= more 1)) (message "Remote: show with default settings")) ((= more 2) - (org-fold-show-entry) + (org-fold-show-entry 'hide-drawers) (org-fold-show-children) (save-excursion (org-back-to-heading) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index ec87aaf8a..c04a8fdcf 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -1849,7 +1849,7 @@ (defun org-clock-goto (&optional select) (pop-to-buffer-same-window (marker-buffer m)) (if (or (< m (point-min)) (> m (point-max))) (widen)) (goto-char m) - (org-fold-show-entry) + (org-fold-show-entry 'hide-drawers) (org-back-to-heading t) (recenter org-clock-goto-before-context) (org-fold-reveal) diff --git a/lisp/org-compat.el b/lisp/org-compat.el index 704197645..8553500d6 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -1400,7 +1400,7 @@ (defadvice outline-toggle-children (around outline-toggle-children@fix-for-org-f (if (not (org-fold-folded-p (line-end-position))) (org-fold-hide-subtree) (org-fold-show-children) - (org-fold-show-entry)))) + (org-fold-show-entry 'hide-drawers)))) ad-do-it)) ;; TODO: outline-headers-as-kill diff --git a/lisp/org-fold.el b/lisp/org-fold.el index acf7c0761..482b5772b 100644 --- a/lisp/org-fold.el +++ b/lisp/org-fold.el @@ -514,7 +514,7 @@ (defun org-fold-hide-sublevels (levels) (if (and (bolp) (not (bobp)) (outline-invisible-p (1- (point)))) (org-fold-region (max (point-min) (1- (point))) (point) nil))))) -(defun org-fold-show-entry () +(defun org-fold-show-entry (&optional hide-drawers) "Show the body directly following its heading. Show the heading too, if it is currently invisible." (interactive) @@ -529,7 +529,7 @@ (defun org-fold-show-entry () (point-max))) nil 'outline) - (org-cycle-hide-drawers 'children))) + (when hide-drawers (org-cycle-hide-drawers 'children)))) (defalias 'org-fold-show-hidden-entry #'org-fold-show-entry "Show an entry where even the heading is hidden.") diff --git a/lisp/org-timer.el b/lisp/org-timer.el index 0c9350e76..f8e753edf 100644 --- a/lisp/org-timer.el +++ b/lisp/org-timer.el @@ -478,7 +478,7 @@ (defun org-timer--get-timer-title () (with-current-buffer (marker-buffer marker) (org-with-wide-buffer (goto-char hdmarker) - (org-fold-show-entry) + (org-fold-show-entry 'hide-drawers) (or (ignore-errors (org-get-heading)) (buffer-name (buffer-base-buffer)))))))) ((derived-mode-p 'org-mode) diff --git a/lisp/org.el b/lisp/org.el index 47a16e94b..0f761e475 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -6765,7 +6765,7 @@ (defun org-move-subtree-down (&optional arg) (move-marker ins-point nil) (if folded (org-fold-subtree t) - (org-fold-show-entry) + (org-fold-show-entry 'hide-drawers) (org-fold-show-children)) (org-clean-visibility-after-subtree-move) ;; move back to the initial column we were at @@ -17261,7 +17261,7 @@ (defun org-return (&optional indent arg interactive) (org-auto-align-tags (org-align-tags)) (t (org--align-tags-here tags-column))) ;preserve tags column (end-of-line) - (org-fold-show-entry) + (org-fold-show-entry 'hide-drawers) (org--newline indent arg interactive) (when string (save-excursion (insert (org-trim string)))))) ;; In a list, make sure indenting keeps trailing text within. -- 2.35.1 --=-=-=--