emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Do not show a TODO item in the global TODO list until certain date?
@ 2022-09-14  9:28 Angel de Vicente
  2022-09-14  9:38 ` Rohit Patnaik
  0 siblings, 1 reply; 11+ messages in thread
From: Angel de Vicente @ 2022-09-14  9:28 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

I'm wondering if it is possible to have a TODO item, but to not show it
in the global TODO list until certain date?

For example: I need to get a new insurance for my motor bike, but
insurance companies will not give me a quote until October 16, so I
would like to create a TODO entry (not a scheduled one, since I don't
need to do it on a particular date), but to hide it from view until
October 16, since there is no point on trying to do it before that, and
it clutters my TODO list.

I checked the Org manual and didn't see anything obvious, but maybe
there is some way?

Thanks,
-- 
Ángel de Vicente
 Research Software Engineer (Supercomputing and BigData)
 Instituto de Astrofísica de Canarias (https://www.iac.es/en)



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Do not show a TODO item in the global TODO list until certain date?
  2022-09-14  9:28 Do not show a TODO item in the global TODO list until certain date? Angel de Vicente
@ 2022-09-14  9:38 ` Rohit Patnaik
  2022-09-14 10:44   ` Angel de Vicente
  0 siblings, 1 reply; 11+ messages in thread
From: Rohit Patnaik @ 2022-09-14  9:38 UTC (permalink / raw)
  To: Angel de Vicente; +Cc: emacs-orgmode

> (not a scheduled one, since I don't need to do it on a particular date)

The `SCHEDULED' property is in fact the correct way to indicate that you wish to
hide the task from the global to-do list until a particular date. `SCHEDULED'
indicates the day upon which you wish to start working on the task. If there's a
particular date by which the task has to be completed, the `DEADLINE' property
is appropriate.

The relevant org-mode manual page is:
https://orgmode.org/manual/Deadlines-and-Scheduling.html I believe.

-- Rohit


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Do not show a TODO item in the global TODO list until certain date?
  2022-09-14  9:38 ` Rohit Patnaik
@ 2022-09-14 10:44   ` Angel de Vicente
  2022-09-14 12:36     ` Ihor Radchenko
  2022-09-22 15:26     ` Bastien
  0 siblings, 2 replies; 11+ messages in thread
From: Angel de Vicente @ 2022-09-14 10:44 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

"Rohit Patnaik" <quanticle@quanticle.net> writes:

>> (not a scheduled one, since I don't need to do it on a particular date)
>
> The `SCHEDULED' property is in fact the correct way to indicate that you wish to
> hide the task from the global to-do list until a particular date. `SCHEDULED'
> indicates the day upon which you wish to start working on the task. If there's a
> particular date by which the task has to be completed, the `DEADLINE' property
> is appropriate.

Thanks for the pointer, but maybe I use SCHEDULED items a bit different,
since I want only a few items in my agenda view, only those that I
really intend to start working on the given date.

As per the example I was giving, I don't want that entry to be scheduled
for October 16 (and thus clutter my agenda view), I just want it to be
visible in my Global TODO list from that date, so then, depending on how
busy I'm around that date, then I can decide when to schedule it for.

I hope it makes sense (and there is some way to accomplish it).

Cheers,
-- 
Ángel de Vicente
 Research Software Engineer (Supercomputing and BigData)
 Instituto de Astrofísica de Canarias (https://www.iac.es/en)



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Do not show a TODO item in the global TODO list until certain date?
  2022-09-14 10:44   ` Angel de Vicente
@ 2022-09-14 12:36     ` Ihor Radchenko
  2022-09-15  5:37       ` Angel de Vicente
  2022-09-15 11:11       ` Angel de Vicente
  2022-09-22 15:26     ` Bastien
  1 sibling, 2 replies; 11+ messages in thread
From: Ihor Radchenko @ 2022-09-14 12:36 UTC (permalink / raw)
  To: Angel de Vicente; +Cc: emacs-orgmode

Angel de Vicente <angel.vicente.garrido@gmail.com> writes:

> As per the example I was giving, I don't want that entry to be scheduled
> for October 16 (and thus clutter my agenda view), I just want it to be
> visible in my Global TODO list from that date, so then, depending on how
> busy I'm around that date, then I can decide when to schedule it for.
>
> I hope it makes sense (and there is some way to accomplish it).

Check out org-agenda-skip-function (see A.7 Special Agenda Views section
of the manual).

Also, I am doing something similar in my personal config using
SHOWFROMDATE property. See
https://github.com/yantar92/emacs-config/blob/master/config.org#properties
for inspiration.

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Do not show a TODO item in the global TODO list until certain date?
  2022-09-14 12:36     ` Ihor Radchenko
@ 2022-09-15  5:37       ` Angel de Vicente
  2022-09-15 11:11       ` Angel de Vicente
  1 sibling, 0 replies; 11+ messages in thread
From: Angel de Vicente @ 2022-09-15  5:37 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

Ihor Radchenko <yantar92@gmail.com> writes:

> Check out org-agenda-skip-function (see A.7 Special Agenda Views section
> of the manual).
>
> Also, I am doing something similar in my personal config using
> SHOWFROMDATE property. See
> https://github.com/yantar92/emacs-config/blob/master/config.org#properties
> for inspiration.

thanks for the pointers. I will check both alternatives and see which
one suits me best.
-- 
Ángel de Vicente
 Research Software Engineer (Supercomputing and BigData)
 Instituto de Astrofísica de Canarias (https://www.iac.es/en)



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Do not show a TODO item in the global TODO list until certain date?
  2022-09-14 12:36     ` Ihor Radchenko
  2022-09-15  5:37       ` Angel de Vicente
@ 2022-09-15 11:11       ` Angel de Vicente
  2022-10-12 11:26         ` Ihor Radchenko
  1 sibling, 1 reply; 11+ messages in thread
From: Angel de Vicente @ 2022-09-15 11:11 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

Ihor Radchenko <yantar92@gmail.com> writes:

> Also, I am doing something similar in my personal config using
> SHOWFROMDATE property. See
> https://github.com/yantar92/emacs-config/blob/master/config.org#properties
> for inspiration.

I tried the following but without success... my Emacs Lisp lack of
knowledge is showing here...

I copied your code from
https://github.com/yantar92/emacs-config/blob/master/config.org#properties
into my .emacs and eval-ed it.
,----
| (add-to-list 'org-default-properties "SHOWFROMDATE")
| (bind-key "C-c C-f" #'org-command-set-SHOWFROMDATE-property org-mode-map)
| (bind-key "C-c C-f" #'org-command-set-SHOWFROMDATE-property org-agenda-mode-map)
| (add-to-list 'org-agenda-bulk-custom-functions '(?F org-command-set-SHOWFROMDATE-property))
| 
| (defun org-command-set-SHOWFROMDATE-property (&optional arg)
|   "Command to set :SHOWFROMDATE property for the org entry at point.
| 	 If NOT-IN-AGENDA is not nil, do not check whether we are in agenda now."
|   (interactive "P")
|   (if (equal major-mode 'org-agenda-mode)
|       (progn
| 	(org-agenda-check-no-diary)
| 	(let* ((marker (or (org-get-at-bol 'org-marker)
| 			   (org-agenda-error)))
| 	       (buffer (marker-buffer marker))
| 	       (pos (marker-position marker))
| 	       (inhibit-read-only t)
| 	       ts)
| 	  (org-with-remote-undo buffer
| 	    (with-current-buffer buffer
| 	      (widen)
| 	      (goto-char pos)
| 	      ;; (org-fold-show-context 'agenda)
| 	      (funcall-interactively 'org-command-set-SHOWFROMDATE-property arg)
| 	      (setq ts (org-entry-get (point) "SHOWFROMDATE")))
| 	    (org-agenda-show-new-time marker ts " P"))))
|     (let ((property "SHOWFROMDATE"))
|       (if (equal arg '(4))
| 	  (org-entry-delete (point) property)
| 	(let ((value (org-read-property-value property))
| 	      (fn (cdr (assoc-string property org-properties-postprocess-alist t))))
| 	  (setq org-last-set-property property)
| 	  (setq org-last-set-property-value (concat property ": " value))
| 	  ;; Possibly postprocess the inserted value:
| 	  (when fn (setq value (funcall fn value)))
| 	  (unless (equal (org-entry-get nil property) value)
| 	    (org-entry-put nil property value)))))))
| 
| (defun org-set-SHOWFROMDATE-property (PROMPT &rest args)
|   "Read :SHOWFROMDATE: property."
|   (org-read-date nil nil nil PROMPT))
| 
| (add-to-list 'org-property-set-functions-alist '("SHOWFROMDATE" . org-set-SHOWFROMDATE-property))
| 
| (defun org-agenda-skip-before-SHOWFROMDATE-property ()
|   "Skip agenda item if :SHOWFROMDATE: property is set and the day is before it"
|   (when-let* ((showfromdate (if (bound-and-true-p org-ql--current-element)
|                                 (org-element-property :SHOWFROMDATE (org-element-lineage org-ql--current-element '(headline) t))
|                               (org-entry-get (point) "SHOWFROMDATE")))
|               (showfromdate (unless (seq-empty-p showfromdate) (ts-parse-org showfromdate)))
| 	      (currenttime (ts-now)))
|     (ts< currenttime showfromdate)))
`----


Then, I defined a test custom command:
,----
| (setq org-agenda-custom-commands
|       '(("h" "Agenda and tasks"
| 	 ((agenda "" ((org-agenda-skip-function 'org-agenda-skip-before-SHOWFROMDATE-property)))
|           (alltodo "" ((org-agenda-skip-function 'org-agenda-skip-before-SHOWFROMDATE-property)))))))
`----

together with a test TODO item:

,----
| ** TODO test                                                       :personal:
| 
|    :PROPERTIES:
|    :SHOWFROMDATE: 2022-10-16
|    :END:
`----

But the "test" still shows in the TODO list. Am I missing something
basic here?

Thanks for your help. Cheers,
-- 
Ángel de Vicente
 Research Software Engineer (Supercomputing and BigData)
 Instituto de Astrofísica de Canarias (https://www.iac.es/en)



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Do not show a TODO item in the global TODO list until certain date?
  2022-09-14 10:44   ` Angel de Vicente
  2022-09-14 12:36     ` Ihor Radchenko
@ 2022-09-22 15:26     ` Bastien
  2022-09-22 16:58       ` Angel de Vicente
  1 sibling, 1 reply; 11+ messages in thread
From: Bastien @ 2022-09-22 15:26 UTC (permalink / raw)
  To: Angel de Vicente; +Cc: emacs-orgmode

Hi Angel,

Angel de Vicente <angel.vicente.garrido@gmail.com> writes:

> As per the example I was giving, I don't want that entry to be scheduled
> for October 16 (and thus clutter my agenda view), I just want it to be
> visible in my Global TODO list from that date, so then, depending on how
> busy I'm around that date, then I can decide when to schedule it for.

Another option is to define an agenda view that only shows TODO items
for today, with `org-agenda-span' set to 1 --- something like this:

(setq org-agenda-custom-commands
  '(("A" "Today's tasks" agenda "Tasks for today"
    ((org-agenda-span 1)
     (org-agenda-files '("~/org/bzg.org"))
     (org-deadline-warning-days 0)
     (org-agenda-sorting-strategy
       '(deadline-up todo-state-up priority-down))))))

HTH,

-- 
 Bastien


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Do not show a TODO item in the global TODO list until certain date?
  2022-09-22 15:26     ` Bastien
@ 2022-09-22 16:58       ` Angel de Vicente
  0 siblings, 0 replies; 11+ messages in thread
From: Angel de Vicente @ 2022-09-22 16:58 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

Hello,

Bastien <bzg@gnu.org> writes:

>> As per the example I was giving, I don't want that entry to be scheduled
>> for October 16 (and thus clutter my agenda view), I just want it to be
>> visible in my Global TODO list from that date, so then, depending on how
>> busy I'm around that date, then I can decide when to schedule it for.
>
> Another option is to define an agenda view that only shows TODO items
> for today, with `org-agenda-span' set to 1 --- something like this:

thanks. I tried, but that doesn't seem to be what I was looking for (or
perhaps I missed something). In my case I have many TODO items without a
date, and I don't want to assign a specific date to them. I simply want
that they are hidden from the Global TODO list until a specific date.

[I can assign a date to them, but then it will look like I have to do
them on that date. Ideally I would like them to be without a date, so
they don't show up in the agenda, only in the global TODO list, but have
a field =skip_until= or similar, so they will be hidden until then]

Thanks,
-- 
Ángel de Vicente
 Research Software Engineer (Supercomputing and BigData)
 Tel.: +34 922-605-747
 Web.: http://research.iac.es/proyecto/polmag/
---------------------------------------------------------------------------------------------
AVISO LEGAL: Este mensaje puede contener información confidencial y/o privilegiada. Si usted no es el destinatario final del mismo o lo ha recibido por error, por favor notifíquelo al remitente inmediatamente. Cualquier uso no autorizadas del contenido de este mensaje está estrictamente prohibida. Más información en: https://www.iac.es/es/responsabilidad-legal
DISCLAIMER: This message may contain confidential and / or privileged information. If you are not the final recipient or have received it in error, please notify the sender immediately. Any unauthorized use of the content of this message is strictly prohibited. More information:  https://www.iac.es/en/disclaimer


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Do not show a TODO item in the global TODO list until certain date?
  2022-09-15 11:11       ` Angel de Vicente
@ 2022-10-12 11:26         ` Ihor Radchenko
  2022-10-21 19:35           ` Angel de Vicente
  0 siblings, 1 reply; 11+ messages in thread
From: Ihor Radchenko @ 2022-10-12 11:26 UTC (permalink / raw)
  To: Angel de Vicente; +Cc: emacs-orgmode

Angel de Vicente <angel.vicente.garrido@gmail.com> writes:

> I copied your code from
> https://github.com/yantar92/emacs-config/blob/master/config.org#properties
> into my .emacs and eval-ed it.
> ...
> But the "test" still shows in the TODO list. Am I missing something
> basic here?

Not really. I just use a different system for skip functions.

Try the following adjusted version:

(defun org-agenda-skip-before-SHOWFROMDATE-property ()
  "Skip agenda item if :SHOWFROMDATE: property is set and the day is before it"
  (when-let* ((showfromdate (if (bound-and-true-p org-ql--current-element)
                                (org-element-property :SHOWFROMDATE (org-element-lineage org-ql--current-element '(headline) t))
                              (org-entry-get (point) "SHOWFROMDATE")))
              (showfromdate (unless (seq-empty-p showfromdate) (ts-parse-org showfromdate)))
	      (currenttime (ts-now)))
    (when (ts< currenttime showfromdate)
      (or (outline-next-heading) (point-max)))))

(Note that the code requires ts library installed).

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Do not show a TODO item in the global TODO list until certain date?
  2022-10-12 11:26         ` Ihor Radchenko
@ 2022-10-21 19:35           ` Angel de Vicente
  2022-10-21 23:07             ` Ihor Radchenko
  0 siblings, 1 reply; 11+ messages in thread
From: Angel de Vicente @ 2022-10-21 19:35 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

Hello, 

Ihor Radchenko <yantar92@gmail.com> writes:

> Try the following adjusted version:
>
> (defun org-agenda-skip-before-SHOWFROMDATE-property ()
>   "Skip agenda item if :SHOWFROMDATE: property is set and the day is before it"
>   (when-let* ((showfromdate (if (bound-and-true-p org-ql--current-element)
>                                 (org-element-property :SHOWFROMDATE (org-element-lineage org-ql--current-element '(headline) t))
>                               (org-entry-get (point) "SHOWFROMDATE")))
>               (showfromdate (unless (seq-empty-p showfromdate) (ts-parse-org showfromdate)))
> 	      (currenttime (ts-now)))
>     (when (ts< currenttime showfromdate)
>       (or (outline-next-heading) (point-max)))))

Fantastic. It does work now beautifully.

[I was about to tell you that it was still not working, because I was
still trying with the following TODO item:

,----
| ** TODO test                                                       :personal:
| 
|    :PROPERTIES:
|    :SHOWFROMDATE: 2022-10-16
|    :END:
`----

and then I realized that the empty line before :PROPERTIES: was breaking
it. With no empty line it works fine (I should've used
org-command-set-SHOWFROMDATE-property from the beginning, which sets the
PROPERTIES in the right format).

,----
| ** TODO test                                                       :personal:
|    :PROPERTIES:
|    :SHOWFROMDATE: 2022-10-16
|    :END:
`----

Many thanks for your help. My TODO list is going to become a lot cleaner
from now!

Cheers,
-- 
Ángel de Vicente
 Research Software Engineer (Supercomputing and BigData)
 Tel.: +34 922-605-747
 Web.: http://research.iac.es/proyecto/polmag/
---------------------------------------------------------------------------------------------
AVISO LEGAL: Este mensaje puede contener información confidencial y/o privilegiada. Si usted no es el destinatario final del mismo o lo ha recibido por error, por favor notifíquelo al remitente inmediatamente. Cualquier uso no autorizadas del contenido de este mensaje está estrictamente prohibida. Más información en: https://www.iac.es/es/responsabilidad-legal
DISCLAIMER: This message may contain confidential and / or privileged information. If you are not the final recipient or have received it in error, please notify the sender immediately. Any unauthorized use of the content of this message is strictly prohibited. More information:  https://www.iac.es/en/disclaimer


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Do not show a TODO item in the global TODO list until certain date?
  2022-10-21 19:35           ` Angel de Vicente
@ 2022-10-21 23:07             ` Ihor Radchenko
  0 siblings, 0 replies; 11+ messages in thread
From: Ihor Radchenko @ 2022-10-21 23:07 UTC (permalink / raw)
  To: Angel de Vicente; +Cc: Ihor Radchenko, emacs-orgmode

Angel de Vicente <angel.de.vicente@iac.es> writes:

> [I was about to tell you that it was still not working, because I was
> still trying with the following TODO item:
>
> ,----
> | ** TODO test                                                       :personal:
> | 
> |    :PROPERTIES:
> |    :SHOWFROMDATE: 2022-10-16
> |    :END:
> `----
>
> and then I realized that the empty line before :PROPERTIES: was breaking
> it. With no empty line it works fine (I should've used
> org-command-set-SHOWFROMDATE-property from the beginning, which sets the
> PROPERTIES in the right format).

Note M-x org-lint. It tries to check for Org syntax issues like this.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-10-22  0:13 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-14  9:28 Do not show a TODO item in the global TODO list until certain date? Angel de Vicente
2022-09-14  9:38 ` Rohit Patnaik
2022-09-14 10:44   ` Angel de Vicente
2022-09-14 12:36     ` Ihor Radchenko
2022-09-15  5:37       ` Angel de Vicente
2022-09-15 11:11       ` Angel de Vicente
2022-10-12 11:26         ` Ihor Radchenko
2022-10-21 19:35           ` Angel de Vicente
2022-10-21 23:07             ` Ihor Radchenko
2022-09-22 15:26     ` Bastien
2022-09-22 16:58       ` Angel de Vicente

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).