From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id kM4yFFaDkV5ZBQAA0tVLHw (envelope-from ) for ; Sat, 11 Apr 2020 08:44:06 +0000 Received: from aspmx2.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 8K1QDFiDkV7IMAAAbx9fmQ (envelope-from ) for ; Sat, 11 Apr 2020 08:44:08 +0000 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 aspmx2.migadu.com (Postfix) with ESMTPS id 4CF67682CEB for ; Sat, 11 Apr 2020 08:44:05 +0000 (UTC) Received: from localhost ([::1]:49950 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jNBkC-0007n5-G7 for larch@yhetil.org; Sat, 11 Apr 2020 04:44:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36424) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jNBjp-0007mt-Us for emacs-orgmode@gnu.org; Sat, 11 Apr 2020 04:43:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jNBjo-0006hC-FC for emacs-orgmode@gnu.org; Sat, 11 Apr 2020 04:43:41 -0400 Received: from [183.249.128.92] (port=9714 helo=dark.localdomain) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jNBjo-0006Yd-02 for emacs-orgmode@gnu.org; Sat, 11 Apr 2020 04:43:40 -0400 Received: by dark.localdomain (Postfix, from userid 1000) id 5850E2420F6; Sat, 11 Apr 2020 16:43:11 +0800 (HKT) User-agent: mu4e 1.3.8; emacs 28.0.50 From: stardiviner To: emacs-orgmode@gnu.org Subject: [PATCH] Show hidden drawers when org-cycle on headlines Date: Sat, 11 Apr 2020 16:43:11 +0800 Message-ID: <87ftdact0g.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 183.249.128.92 X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: numbchild@gmail.com Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=default; t=1586594645; h=from:from:sender:sender:reply-to: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; bh=k8w34sG3aCorVhuRI0yW3CGuq5OEb0aMIJPnMevTle4=; b=mHZCljN+3qdu5lK0x2IcajMeA1tfGQ2ctdzxSXdU2KROhQuZg8hnvSC6zKHuco11yC2KzE fG7EKjlGUCQ2ansrJwk3ZecLsZEWrp71UbYxYryLvQAhsz4ytFQkgHeT1C5SJ1IXPDNFQU clkXZ/8P4nFh27KNj7PrpirNlvqkHmA= ARC-Seal: i=1; s=default; d=yhetil.org; t=1586594645; a=rsa-sha256; cv=none; b=nIS4mmBuwYLZN5DbBgyq8TAdltIKWRnKxSA5qUz/MD9dW3jRTM4U9Y6soyB8SBHsOqGStp FLF2gib7TKg7tPNjNdtqLcsmcw1kFIpGFjY92jiaeM04J9alBcALIJ9aZmVAtW0bLwz696 a/L4JbCBczSYdDe5ePcy6/Sx/BCtBmI= ARC-Authentication-Results: i=1; aspmx2.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); spf=pass (aspmx2.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Scanner: scn0 X-Spam-Score: -0.51 Authentication-Results: aspmx2.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); spf=pass (aspmx2.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Scan-Result: default: False [-0.51 / 13.00]; HAS_REPLYTO(0.00)[numbchild@gmail.com]; GENERIC_REPUTATION(0.00)[-0.57948511155309]; R_SPF_ALLOW(-0.20)[+ip4:209.51.188.0/24:c]; FREEMAIL_FROM(0.00)[gmail.com]; HAS_ATTACHMENT(0.00)[]; REPLYTO_ADDR_EQ_FROM(0.00)[]; TO_DN_NONE(0.00)[]; R_MISSING_CHARSET(2.50)[]; ARC_SIGNED(0.00)[i=1]; IP_REPUTATION_HAM(0.00)[asn: 22989(0.30), country: US(-0.01), ip: 209.51.188.17(-0.58)]; MX_GOOD(-0.50)[cached: eggs.gnu.org]; MAILLIST(-0.20)[mailman]; SIGNED_PGP(-2.00)[]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; RCVD_TLS_LAST(0.00)[]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:22989, ipnet:209.51.188.0/24, country:US]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[larch=yhetil.org]; ARC_NA(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; FROM_NEQ_ENVFROM(0.00)[numbchild@gmail.com,emacs-orgmode-bounces@gnu.org]; FROM_HAS_DN(0.00)[]; MIME_GOOD(-0.20)[multipart/signed,multipart/mixed,text/plain,text/x-patch]; FREEMAIL_REPLYTO(0.00)[gmail.com]; HAS_LIST_UNSUB(-0.01)[]; RCPT_COUNT_ONE(0.00)[1]; MIME_TRACE(0.00)[0:+,1:+,2:+,3:+,4:~]; FORGED_SENDER_MAILLIST(0.00)[]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : SPF not aligned (relaxed), No valid DKIM,none] X-TUID: FqrHdlu/Er9x --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable I think the hidden drawers info is useful for users, this should be shown when org-cycle on headlines. Here is the patch. =2D-=20 [ stardiviner ] I try to make every word tell the meaning what I want to express. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 =20=20=20=20=20=20 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-org.el-Rename-org-cycle-hide-drawers-to-org-cycle-to.patch Content-Transfer-Encoding: quoted-printable From=2098e3ece4d2bd6f7c7ccd0ecf70dc327a01bff8bd Mon Sep 17 00:00:00 2001 From: stardiviner Date: Sat, 11 Apr 2020 13:16:02 +0800 Subject: [PATCH] org.el: Rename org-cycle-hide-drawers to org-cycle-toggle-drawers * lisp/org.el (org-cycle-toggle-drawers): Make function toggle show/hide drawers. * lisp/org-agenda.el (org-cycle-toggle-drawers): updated renamed functions. * etc/ORG-NEWS: mention incompatible changes. =2D-- etc/ORG-NEWS | 9 +++++++++ lisp/org-agenda.el | 4 ++-- lisp/org.el | 26 +++++++++++++++++++++----- 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index e90ac60e3..244c30be4 100644 =2D-- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -80,6 +80,11 @@ resulting
will be ~
~. You may want to check whether your HTML files are rendered differently after this change. =20 +*** Renamed ~org-cycle-hide-drawers~ to ~org-cycle-toggle-drawers~ + +Rename function after added a third optional argument changed function +meaning. Now drawers will be expanded when ~org-cycle~ on headlines. + ** New default settings for some options =20 These options now defaults to =3Dt=3D: @@ -294,6 +299,10 @@ HTML. =20 Functions in this hook are run after ~org-agenda-filter~ is called. =20 +*** New option ~org-show-drawer-on-cycle~ + +Option to control whether expand hidden drawer when ~org-cycle~ on headlin= es. + ** Removed or renamed functions and variables *** Removed ~org-maybe-keyword-time-regexp~ =20 diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index ffb892b0c..e3dca49af 100644 =2D-- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -9104,7 +9104,7 @@ (defun org-agenda-show-and-scroll-up (&optional arg) (ignore-errors (scroll-up))) (org-agenda-goto t) (org-show-entry) =2D (if arg (org-cycle-hide-drawers 'children) + (if arg (org-cycle-toggle-drawers 'children nil t) (org-with-wide-buffer (narrow-to-region (org-entry-beginning-position) (org-entry-end-position)) @@ -9164,7 +9164,7 @@ (defun org-agenda-show-1 (&optional more) (outline-show-subtree) (save-excursion (org-back-to-heading) =2D (org-cycle-hide-drawers 'subtree '("LOGBOOK"))) + (org-cycle-toggle-drawers 'subtree '("LOGBOOK") t)) (message "Remote: SUBTREE AND LOGBOOK")) ((> more 4) (outline-show-subtree) diff --git a/lisp/org.el b/lisp/org.el index 57682fd16..5d5e54574 100644 =2D-- a/lisp/org.el +++ b/lisp/org.el @@ -6012,7 +6012,23 @@ (defun org-hide-block-all () =20 ;;;; Drawers visibility =20 =2D(defun org-cycle-hide-drawers (state &optional exceptions) +(defcustom org-show-drawer-on-cycle nil + "Whether auto expand hidden drawers when `org-cycle' headlines." + :type 'boolean + :safe #'booleanp + :group 'org) + +(defun org-cycle-expand-drawer (state) + "Show hidden drawer of headline." + (org-cycle-toggle-drawers 'children)) + +(defun org-enable-cycle-expand-drawer () + (when org-show-drawer-on-cycle + (add-hook 'org-cycle-hook #'org-cycle-expand-drawer))) + +(add-hook 'org-mode-hook #'org-enable-cycle-expand-drawer) + +(defun org-cycle-toggle-drawers (state &optional exceptions flag) "Re-hide all drawers after a visibility state change. STATE should be one of the symbols listed in the docstring of `org-cycle-hook'. When non-nil, optional argument EXCEPTIONS is @@ -6031,7 +6047,7 @@ (defun org-cycle-hide-drawers (state &optional except= ions) (unless (member-ignore-case (match-string 1) exceptions) (let ((drawer (org-element-at-point))) (when (memq (org-element-type drawer) '(drawer property-drawer)) =2D (org-flag-drawer t drawer) + (org-flag-drawer flag drawer) ;; Make sure to skip drawer entirely or we might flag ;; it another time when matching its ending line with ;; `org-drawer-regexp'. @@ -6427,7 +6443,7 @@ (defun org-set-startup-visibility () (when org-hide-block-startup (org-hide-block-all)) (org-set-visibility-according-to-property) (org-cycle-hide-archived-subtrees 'all) =2D (org-cycle-hide-drawers 'all) + (org-cycle-toggle-drawers 'all nil t) (org-cycle-show-empty-lines t))) =20 (defun org-set-visibility-according-to-property () @@ -6532,7 +6548,7 @@ (defun org-clean-visibility-after-subtree-move () (when (and (not (org-invisible-p)) (org-invisible-p (line-end-position))) (outline-hide-entry)))) =2D (org-cycle-hide-drawers 'all) + (org-cycle-toggle-drawers 'all nil t) (org-cycle-show-empty-lines 'overview))))) =20 (defun org-cycle-show-empty-lines (state) @@ -8076,7 +8092,7 @@ (defun org-sort-entries "(empty for default `sort-subr' predicate): ") 'allow-empty)))) ((member dcst '(?p ?t ?s ?d ?c ?k)) '<)))) =2D (org-cycle-hide-drawers 'all) + (org-cycle-toggle-drawers 'all nil t) (when restore-clock? (move-marker org-clock-marker (1+ (next-single-property-change =2D-=20 2.26.0 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl6Rgx8UHG51bWJjaGls ZEBnbWFpbC5jb20ACgkQG13xyVromsMPSQf7Bc3qjVh7ukTcPJyMQty1P7FxO516 qnGU0CTLpZYMa8x72KsoQx6QfFS4TvQLVidMT9qSwxR70T+dPm1e+biis0fQlBEj 1GzWMX0q8S+GvZsXQfwbNLVkxHDimHEq9xvvdr3wYbBl13TpWn9oecIbAS59unnq Erulc6srUHvpW3ep4u2gc2sJsonLB32X5DWwaTjDXeNXenpD1+45wKI1RJXmaVES /cURpskHOhwCn+BRZprba8yVW+uNvXrnLDp3YP5y/C0HPGpmNLe+G/a5pQRmzDKV m1VFA3YUIuZnFmlW4CaChlxgBfWRklrfc0mO0UyyV9i6jAkOaumPLwNwWQ== =9bJz -----END PGP SIGNATURE----- --==-=-=--