From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id mErNDkxU4GOXRwEAbAwnHQ (envelope-from ) for ; Mon, 06 Feb 2023 02:13:48 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id 2GjoDUxU4GNBGwEAG6o9tA (envelope-from ) for ; Mon, 06 Feb 2023 02:13:48 +0100 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 B06263C095 for ; Mon, 6 Feb 2023 02:13:47 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pOq3q-0000zX-Ey; Sun, 05 Feb 2023 20:12:46 -0500 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 1pOq3o-0000xj-Hd for Emacs-orgmode@gnu.org; Sun, 05 Feb 2023 20:12:44 -0500 Received: from mail-vs1-xe2f.google.com ([2607:f8b0:4864:20::e2f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pOq3l-00008M-OW for Emacs-orgmode@gnu.org; Sun, 05 Feb 2023 20:12:44 -0500 Received: by mail-vs1-xe2f.google.com with SMTP id h19so11122561vsv.13 for ; Sun, 05 Feb 2023 17:12:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=known.net; s=google; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=8zgci257Xmy+jxvqI9Gg2ZTQ5O9GoWI908oweuDyPEQ=; b=ReoGxa423upVBNiQ7iZ270wHFtn9+g5jykN4CoYj2qaO98P+XRKY92btyZskeogSbn /Wni5qwJwXG3ch/jzF680WhJdECe8vIuyCJC1kawgkAimd5zIMJo/9QTuv1Dhd3TCl+C Y0FrYnCgLGPaMhvewnkZueF1cUsxSPmPBvNQo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=8zgci257Xmy+jxvqI9Gg2ZTQ5O9GoWI908oweuDyPEQ=; b=whO1yQEAsyfohMjVVU1LfoAKiEDvahUS3R+WljvmJF+ltxj20viW22y6Jd3CnLWXKB j5zvyQXb6SRE1XSiPZvaBtJqAyHgemG/a6AkjKH1YT144OAbXylY1nciQo7+6cNFrdd8 ldYouIebTSlWfy0cFhAxED2mTZHTBryC9PlcMoGPFG2Rtz3JqRVmzDQ2C8Ij0z79okxN bm6Vj36/Pw8kQnt0Aii5XfE/IbyuYY4/V+Dfdaikq4g1ahIkq1xBcuQdMPQrtfcIDV+v +Gd2S25QIFHIhs7FCRHjmQe0G+G6OQ6X1tvnZaAWbTYK+mXlt3WdiM1Znn6g1NE3HeRC U2yw== X-Gm-Message-State: AO0yUKWpcbH7TW8Tt0fne84OvUR4suxaGHEpocwuT9bi8kalXQq5cZvY E72147+1wqJfx3AV3XU5Be98N/KVU/PXpPt6d+I880Epfbk5toOwhac= X-Google-Smtp-Source: AK7set9lFJryXQ1V9/t6OIgildUFW3yIdkHUg9F996y7HngcxjNJVcd30cKFGqEeVKRdJ7vaJTwcm7GZusBlAR/Ermo= X-Received: by 2002:a05:6102:748:b0:3f4:eb91:4479 with SMTP id v8-20020a056102074800b003f4eb914479mr3037656vsg.16.1675645959242; Sun, 05 Feb 2023 17:12:39 -0800 (PST) MIME-Version: 1.0 From: Kevin Layer Date: Sun, 5 Feb 2023 17:12:28 -0800 Message-ID: Subject: Specialized sparse-tree via hook to show specific view in org mode To: Emacs-orgmode@gnu.org Content-Type: multipart/alternative; boundary="0000000000002ba4cb05f3fdba1c" Received-SPF: pass client-ip=2607:f8b0:4864:20::e2f; envelope-from=layer@known.net; helo=mail-vs1-xe2f.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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-Country: US X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1675646028; 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=8zgci257Xmy+jxvqI9Gg2ZTQ5O9GoWI908oweuDyPEQ=; b=T3zNYoBIyHd76lzvbouOVfeolbQEv/nLcIa/wWDifnldpFhlLhEDwwNV2izNIdBbYLN63d vTyoIq4oaezKlfNQKPPaN2RTb5bwp3+mNAJpsm/TlpSXQ8GfemOYKb2ZOvIRpJqhAZt3wp vWxA4LkwPXsgkoZVjpmfgmPoDd5W//1Du/vzUsQK5b1PqCmYvlWNnb/xpwLfUcahlhXtyf iXYF2PB5w2wJ3L3K7qtJJXceBWfi9P3TV+MBtAjuA9RdYxvxC8jI0g4sFVh/2dJSExz8kP ziQlsw0NI9K9W0zcbkeuDzkqUJmfn6KMqgBJLZuS/SQzIqYoJbrKi0KyHfCE2Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=known.net header.s=google header.b=ReoGxa42; 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"; dmarc=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1675646028; a=rsa-sha256; cv=none; b=LK86qTOpxSPgdJjdTQ+YL6+1DII7jR8qHCefxgUMM3y+clqXveEzBDlmVMehO6XqRwoIU8 DiSC/y2p3oLV4o+q+mBBkCDCcmnn+1K3H1PoyM4zn5D9kcJc6QyQNi8uRG8wvHl4PTu2AS MGyePe2VOrUxQDrky0HvvWzOiwOgReODYmhhh4Ls1RpamIbGsE5e/+Pr7KLtgFhj147Hoz LNDbiJnLEedf1zCONecPa/TlHAX3cG+VQJHeTiIutB1AlPjR54vJoqUQnhSbRf41ndxdIe oopNU0gfkgiDY1c/BxGlYavituibwzX3pACRN1pm4GYT24kYVJSf7dGvjEFCyQ== X-Migadu-Spam-Score: -3.59 X-Spam-Score: -3.59 X-Migadu-Queue-Id: B06263C095 X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=known.net header.s=google header.b=ReoGxa42; 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"; dmarc=none X-TUID: wJxL5lkBvRZa --0000000000002ba4cb05f3fdba1c Content-Type: text/plain; charset="UTF-8" Hi. I've been using Emacs since the 80's but I'm a new org mode user. What a fantastic piece of software. I had used my own todo mode, but org is orders of magnitude better. Thank you! My main todo file defines various TODO keywords and initial state like this: #+STARTUP: indent overview #+TODO: @NOW @NEXT @WIP @PENDING What I really want is to initially only see items noted with those TODO keywords and also due items. Everything else should be hidden. Since I didn't see an out-of-the-box way to do this, I hacked the following together. The purpose of this email is to see if this is the right way (or a good way). The hack starts with this at the end of the org file: * Local Variables ;; Local Variables: ;; eval: (save-window-excursion (my-org-show-sparse-todo-tree)) ;; End: That function is defined thus: (defun my-org-show-sparse-todo-tree () (interactive) (message "%d TODO entries found" (org-occur (concat "^" org-outline-regexp " *" "\\(" (mapconcat 'identity org-todo-keywords-1 "\\|") "\\)\\>"))) ;; events due before 2 weeks from now: (org-check-before-date (format-time-string "%Y-%m-%d" (time-add nil (* 3600 8 14))) t)) which relies on the redefined version of org-check-before-date, so keep-previous is passed to org-occur: (defun org-check-before-date (d &optional keep-previous) "Check if there are deadlines or scheduled entries before date D. Optional argument KEEP-PREVIOUS is passed directly to `org-occur'." (interactive (list (org-read-date))) (let* ((case-fold-search nil) (regexp (org-re-timestamp org-ts-type)) (ts-type org-ts-type) (callback (lambda () (let ((match (match-string 1))) (and (if (memq ts-type '(active inactive all)) (eq (org-element-type (save-excursion (backward-char) (org-element-context))) 'timestamp) (org-at-planning-p)) (time-less-p (org-time-string-to-time match) (org-time-string-to-time d))))))) (message "%d entries before %s" (org-occur regexp keep-previous callback) d))) I find this shows me exactly what I want to see when I finish a task and want to start something new. If this is the right way and the maintainer wants me to submit a patch, I would include these functions to get a new optional for keep-previous, since they could all plausibly be used for the same thing that org-check-before-date was: * org-show-todo-tree * org-check-deadlines * org-check-before-date * org-check-after-date * org-check-dates-range Thank you. Kevin --0000000000002ba4cb05f3fdba1c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi.=C2=A0 I've been using Emacs since the 80'= s but I'm a new org mode user.=C2=A0 What a fantastic piece of software= .=C2=A0 I had used my own todo mode, but org is orders of magnitude better.= Thank you!

My main todo file defines various TODO= keywords and initial state like this:

#+START= UP: indent overview
#+TODO: @NOW @NEXT @WIP @PENDING

What I really want is to initially only see items noted with those TO= DO keywords and also due items.=C2=A0 Everything else should be hidden.=C2= =A0

Since I didn't see an out-of-the-box = way to do this, I hacked the=20 following together.=C2=A0 The purpose of this email is to see if this is th= e=20 right way (or a good way).

The hack starts with th= is at the end of the org file:

* Local Variables=0C;; Local Variables:
;; eval: (save-window-excursion (my-org-show-sp= arse-todo-tree))
;; End:

That function is d= efined thus:

(defun my-org-show-sparse-todo-tree (= )
=C2=A0 (interactive)
=C2=A0 (message
=C2=A0 =C2=A0"%d TODO = entries found"
=C2=A0 =C2=A0(org-occur (concat "^" org-ou= tline-regexp " *"
=C2=A0 =C2=A0 =C2=A0"\\("
= =C2=A0 =C2=A0 =C2=A0(mapconcat 'identity org-todo-keywords-1 "\\|= ")
=C2=A0 =C2=A0 =C2=A0"\\)\\>")))

=C2=A0 ;;= events due before 2 weeks from now:
=C2=A0 (org-check-before-date
= =C2=A0 =C2=A0(format-time-string "%Y-%m-%d" (time-add nil (* 3600= 8 14)))
=C2=A0 =C2=A0t))

which relies on the r= edefined version of org-check-before-date, so keep-previous is passed to or= g-occur:

(defun org-check-before-date (d &opti= onal keep-previous)
=C2=A0 "Check if there are deadlines or schedul= ed entries before date D.

Optional argument KEEP-PREVIOUS is passed = directly to `org-occur'."
=C2=A0 (interactive (list (org-read-d= ate)))
=C2=A0 (let* ((case-fold-search nil)
(regexp (org-re-timesta= mp org-ts-type))
(ts-type org-ts-type)
(callback
=C2=A0(lamb= da ()
=C2=A0 =C2=A0(let ((match (match-string 1)))
=C2=A0 =C2=A0 = =C2=A0(and (if (memq ts-type '(active inactive all))
=C2=A0 =C2= =A0 =C2=A0 (eq (org-element-type (save-excursion
=C2=A0 =C2=A0 =C2= =A0 (backward-char)
=C2=A0 =C2=A0 =C2=A0 (org-element-context))) =C2=A0 'timestamp)
=C2=A0 =C2=A0 (org-at-planning-p))
= =C2=A0 (time-less-p
=C2=A0 =C2=A0(org-time-string-to-time match)
= =C2=A0 =C2=A0(org-time-string-to-time d)))))))
=C2=A0 =C2=A0 (message= "%d entries before %s"
=C2=A0 =C2=A0 (org-occur regexp keep= -previous callback)
=C2=A0 =C2=A0 d)))

I find= this shows me exactly what I want to see when I finish a task and want to = start something new.

If this is the right way and = the maintainer wants me to submit a patch, I would include these functions = to get a new optional for keep-previous, since they could all plausibly be = used for the same thing that org-check-before-date was:
* org= -show-todo-tree
* org-check-deadlines
* org-check-befor= e-date
* org-check-after-date
* org-check-dates-range

Thank you.

Kevin



--0000000000002ba4cb05f3fdba1c--