From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:bcc0::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 6EdIANqTeWC92QAAgWs5BA (envelope-from ) for ; Fri, 16 Apr 2021 15:40:42 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id +KXUN9mTeWD1TgAA1q6Kng (envelope-from ) for ; Fri, 16 Apr 2021 13:40:41 +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 aspmx1.migadu.com (Postfix) with ESMTPS id 3836718C2C for ; Fri, 16 Apr 2021 15:40:39 +0200 (CEST) Received: from localhost ([::1]:52352 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lXOi4-0003yV-UO for larch@yhetil.org; Fri, 16 Apr 2021 09:40:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34016) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lXOh8-0003yK-Mn for emacs-orgmode@gnu.org; Fri, 16 Apr 2021 09:39:38 -0400 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:54927) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lXOh6-0003KG-H8 for emacs-orgmode@gnu.org; Fri, 16 Apr 2021 09:39:38 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 786F01B2F; Fri, 16 Apr 2021 09:39:33 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 16 Apr 2021 09:39:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yiufung.net; h= from:to:subject:date:message-id:mime-version:content-type; s= fm3; bh=/jCPqBOs7GtyhQtUd1Ws0ShXpXuSmsfGJ8xb/FI/FMU=; b=jgtaYfEN YuXUVnHkh6gmK7ZiHMXmDqRdaOKQjSNRmGN2/XaVcGMMy6mb7HidfxlQH9qOEZqp dX/V9ZufvxNvO8Dz8xL18432W+IpHe6MB7gx08f3NFQEw3LQ26YnsxybC5BDT4Y4 SWKmXlDVYmsZNCJ1oORddqxtjM5VYUcbBEBsnpe3rVboGui6dovI06xyc/O7AfoM ZRxauOuUnL5MMkBUjjn5rvdIv3ca+/K1Hqnghi2AVyTqplRgVpkKUeVHgXYT8+1U cMVsWfpDsvJPAHij4cbO/kXmJK146hjSGHgmWMlH3jq8FzA7RFEx5rB5oSE47ZZJ PWQr/nhXNxy5kA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id :mime-version:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=/jCPqBOs7GtyhQtUd1Ws0ShXpXuSm sfGJ8xb/FI/FMU=; b=ISB1IU/zhX3RBMtx4qY6zZc+pdauVh0zm+C8wLrgXkbM0 Op78KHvKWw36miwhElKFRT8i1jnfgpWuYBENKGLYkS7R1TRjg15sUHuh7wf7fbs+ 8kUqoN0xvm5Hq4nTKC51pgCQSXU7AtmxYMHexYFDcVCIGFs5rsvqKnmWW6Ieo918 7GWTiW7PMuPPFIwhrXjzCMlUbo+/evH4BDC9QSfqwIzBTxXTTTiGADYM1FZjm5q3 2NGbvL8hLHi7qvplTFr64iYw2/bJN4Yi8uwZ+FaYRWkc08TNcwVvOa7esfpXv/gg mCsYiuT12CDl7/Avf+kmwBE6ukERcxGa/3k3M/YEQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudelhedgieelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkgggtsehmtderredttd dtnecuhfhrohhmpeevhhgvohhnghcujghiuhcuhfhunhhguceomhgrihhlseihihhufhhu nhhgrdhnvghtqeenucggtffrrghtthgvrhhnpedtueehgfehveefgffhveekhedtgeelhf ehieevtdeftedufedvtdfgkedvueeigfenucfkphepudekfedrudejkedrudekledrgeeh necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhgrih hlseihihhufhhunhhgrdhnvght X-ME-Proxy: Received: from localhost (183178189045.ctinets.com [183.178.189.45]) by mail.messagingengine.com (Postfix) with ESMTPA id 48BC624005D for ; Fri, 16 Apr 2021 09:39:32 -0400 (EDT) From: Cheong Yiu Fung To: emacs-orgmode@gnu.org Subject: [PATCH] org.el (org-show-context-detail): add option 'ancestors-with-entry Date: Fri, 16 Apr 2021 21:39:29 +0800 Message-ID: <878s5inyb2.fsf@yiufung.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=64.147.123.21; envelope-from=mail@yiufung.net; helo=wout5-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=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.23 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1618580441; 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=/jCPqBOs7GtyhQtUd1Ws0ShXpXuSmsfGJ8xb/FI/FMU=; b=PCadt+NubiEdrlncn+kf0iYjLxYzgiFjH40Oe9z+6VYboFZKKPIqHVNq5wc9prr2DHOjbG McucFIixepcMlxGEPFKnDMkV42i2kDVoshQbvYxi8Ybg03gk6KHb5BYSrhwq9QUs9emO8b AuqJRKADfgKXGwWmEP4xMZaCs8PdZvEcg33fint3cQ6nA/9Mjwq7oFdvQYv5RJElBnJ3Jk Hj5EhvhBkpvPDJwyTCwKgTjX5hIQpTPPlqDQlKB3QYJ2eEAuGOb2T6GmEKVAmKLkVwnDoK drYseo9qc7qB6AxDkNjdkMV0G5phDJTQ4V+vdUmtDWfNHBpIM1LtU1sY7+SEhg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1618580441; a=rsa-sha256; cv=none; b=mdtCYsIQPaqhboPZaen4Aps2TTrgcMFXxjGaHPGxTDPbxINvlFxCEA9JV0iBmQuCmsB6KC KZ8SY9sMbMfBzA5MPuZzWcqRLXvZiYPjD+lL1/1pajt/8V+yySjLubQmv+gQHTwOGTjES4 a2mXLFjQqKh1ljxxggQUbFVOjpEua7gY2LYXysulCCasY0Ixvbd17XQWmM0N7Ax+x8V1qK TdYUrawt87ebyHDJnFtrA5ekuh+I00/8EIePFAm6Twv63pe51tGhX3aE9HGOH+Cpws8ggJ tlC8ZVkLkkVE+Rt/dWoa1zQYbfQsy3mQqykR8WG27bGSCsGoWE7RilqYds067w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=yiufung.net header.s=fm3 header.b=jgtaYfEN; dkim=pass header.d=messagingengine.com header.s=fm2 header.b="ISB1IU/z"; dmarc=none; spf=pass (aspmx1.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-Migadu-Spam-Score: -2.64 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=yiufung.net header.s=fm3 header.b=jgtaYfEN; dkim=pass header.d=messagingengine.com header.s=fm2 header.b="ISB1IU/z"; dmarc=none; spf=pass (aspmx1.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-Migadu-Queue-Id: 3836718C2C X-Spam-Score: -2.64 X-Migadu-Scanner: scn0.migadu.com X-TUID: xeqTuIhfjRvI --=-=-= Content-Type: text/plain Hi, I'm proposing a new option in `org-show-context-detail', which shows current headline, its ancestors, *and the entry itself*. This is useful when export matched subtrees and their contents quickly with least manual intervention. Consider when working on different aspects of a project and taking notes as we go: * Project A project tree ** Task1 ** Task2 *** ASK Something to align Something for discussion ** Task3 ** Task4 *** ASK Something else to align Something else. At some point, we may wish to export only certain contents. For example, to export headings with TODO keyword of "ASK", along with the task context (ancestors TASK heading name), and their own content for discussion with colleagues. Ideally, this can be done by org-sparse-tree, followed by org-export with visible-only + subtree-only option. Expected output: * Project ** Task2 *** ASK Something to align Something for discussion ** Task4 *** ASK Something else to align Something else. Current options, though, either require manual expansion to show both ancestors AND entry, which becomes tedious soon; * Project ** Task2 *** ASK Something to align ** Task4 *** ASK Something else to align or it shows extra contents (`local' will include the *next* heading, in this example, the non-related Task3) * Project *** ASK Something to align Something for discussion ** Task3 *** ASK Something else to align Something else. `ancestor-with-entries' is a long name that pose some difficulties to updating documentations, so I wish to have some feedbacks before moving on. Is there better way to achieve this effect? Am I overlooking something? Yiufung --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-org.el-org-show-context-detail-add-option-ancestors-.patch >From 38703eace6062ec4e4ccdf1912a641b266efbf61 Mon Sep 17 00:00:00 2001 From: Cheong Yiu Fung Date: Fri, 16 Apr 2021 18:35:17 +0800 Subject: [PATCH] org.el (org-show-context-detail): add option 'ancestors-with-entry * lisp/org.el: Add option 'ancestors-with-entry to `org-show-context-detail', which shows current headline, entry, and its direct ancestors. --- lisp/org.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 675a614e2..0e625d9ed 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -1240,6 +1240,7 @@ more context." (const minimal) (const local) (const ancestors) + (const ancestors-with-entry) (const lineage) (const tree) (const canonical)))))) @@ -6763,7 +6764,7 @@ DETAIL is either nil, `minimal', `local', `ancestors', `lineage', information." ;; Show current heading and possibly its entry, following headline ;; or all children. - (if (and (org-at-heading-p) (not (eq detail 'local))) + (if (and (org-at-heading-p) (not (memq detail '(local ancestors-with-entry)))) (org-flag-heading nil) (org-show-entry) ;; If point is hidden within a drawer or a block, make sure to @@ -6775,14 +6776,14 @@ information." (org-with-limited-levels (cl-case detail ((tree canonical t) (org-show-children)) - ((nil minimal ancestors)) + ((nil minimal ancestors ancestors-with-entry)) (t (save-excursion (outline-next-heading) (org-flag-heading nil))))))) ;; Show all siblings. (when (eq detail 'lineage) (org-show-siblings)) ;; Show ancestors, possibly with their children. - (when (memq detail '(ancestors lineage tree canonical t)) + (when (memq detail '(ancestors ancestors-with-entry lineage tree canonical t)) (save-excursion (while (org-up-heading-safe) (org-flag-heading nil) -- 2.31.0 --=-=-=--