Re: [O] Can I get match count?

2011-04-27 Thread Osamu OKANO
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<=\"\"")'`
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.



Re: [O] Can I get match count?

2011-04-26 Thread Matt Lundin
Osamu OKANO  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<=\"\"")))
> Is there any way?
>

You could use org-map-entries to count the number of occurrences:

(length 
 (org-map-entries t "STYLE=\"habit\"+SCHEDULED<=\"\"" 'agenda))

Best,
Matt




[O] Can I get match count?

2011-04-25 Thread Osamu OKANO
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<=\"\"")))
Is there any way?

Regards.