* Can I get match count?
@ 2011-04-25 14:43 Osamu OKANO
2011-04-27 2:50 ` Matt Lundin
0 siblings, 1 reply; 3+ messages in thread
From: Osamu OKANO @ 2011-04-25 14:43 UTC (permalink / raw)
To: org-mode
Hi.
I' like to know a count of search results.
(message
"You have %s habits which are out of date."
(org-agenda-match-count
(tags-todo "STYLE=\"habit\"+SCHEDULED<=\"<now>\"")))
Is there any way?
Regards.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Can I get match count?
2011-04-25 14:43 Can I get match count? Osamu OKANO
@ 2011-04-27 2:50 ` Matt Lundin
2011-04-27 14:40 ` Osamu OKANO
0 siblings, 1 reply; 3+ messages in thread
From: Matt Lundin @ 2011-04-27 2:50 UTC (permalink / raw)
To: Osamu OKANO; +Cc: org-mode
Osamu OKANO <okano.osamu@gmail.com> writes:
> I' like to know a count of search results.
> (message
> "You have %s habits which are out of date."
> (org-agenda-match-count
> (tags-todo "STYLE=\"habit\"+SCHEDULED<=\"<now>\"")))
> Is there any way?
>
You could use org-map-entries to count the number of occurrences:
(length
(org-map-entries t "STYLE=\"habit\"+SCHEDULED<=\"<now>\"" 'agenda))
Best,
Matt
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Can I get match count?
2011-04-27 2:50 ` Matt Lundin
@ 2011-04-27 14:40 ` Osamu OKANO
0 siblings, 0 replies; 3+ messages in thread
From: Osamu OKANO @ 2011-04-27 14:40 UTC (permalink / raw)
To: Matt Lundin; +Cc: org-mode
Hi!
Thank you for your advice.
I made a growl script and set to crontab.
It works correctly.
#+BEGIN_SRC sh
m=`emacsclient -e '(org-agenda-match-count
"TODO=\"TODO\"STYLE=\"habit\"+SCHEDULED<=\"<now>\"")'`
if [ "0" -ne $m ]
then
growlnotify \
/t:"org habit" \
/s:true \
/silent:true \
"$m habits left."
fi
#+END_SRC
#+BEGIN_SRC emacs-lisp
(defun org-agenda-match-count (str)
(length
(org-map-entries t str 'agenda)))
#+END_SRC
Regards.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-04-27 14:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-25 14:43 Can I get match count? Osamu OKANO
2011-04-27 2:50 ` Matt Lundin
2011-04-27 14:40 ` Osamu OKANO
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.