Re: Do not show a TODO item in the global TODO list until certain date?

2022-10-21 Thread Angel de Vicente
Hello, 

Ihor Radchenko  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



Re: Do not show a TODO item in the global TODO list until certain date?

2022-10-21 Thread Ihor Radchenko
Angel de Vicente  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 .
Support Org development at ,
or support my work at 



Re: Do not show a TODO item in the global TODO list until certain date?

2022-10-12 Thread Ihor Radchenko
Angel de Vicente  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 .
Support Org development at ,
or support my work at 



Re: Do not show a TODO item in the global TODO list until certain date?

2022-09-23 Thread Angel de Vicente
Hello,

Bastien  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



Re: Do not show a TODO item in the global TODO list until certain date?

2022-09-22 Thread Bastien
Hi Angel,

Angel de Vicente  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



Re: Do not show a TODO item in the global TODO list until certain date?

2022-09-15 Thread Angel de Vicente
Hello,

Ihor Radchenko  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 ( 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  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)




Re: Do not show a TODO item in the global TODO list until certain date?

2022-09-14 Thread Angel de Vicente
Hello,

Ihor Radchenko  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)




Re: Do not show a TODO item in the global TODO list until certain date?

2022-09-14 Thread Ihor Radchenko
Angel de Vicente  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



Re: Do not show a TODO item in the global TODO list until certain date?

2022-09-14 Thread Angel de Vicente
Hello,

"Rohit Patnaik"  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)




Re: Do not show a TODO item in the global TODO list until certain date?

2022-09-14 Thread Rohit Patnaik
> (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