Re: TODO, //TODO or @todo

Len Trigg <[email protected]> Fri, 25 Aug 2006 07:21:30 +1200
Newsgroups gmane.emacs.jdee
Organization Reel Two Ltd.
Message-ID <hbwt8ylz2d.wl%[email protected]>
Benda Lukas wrote:
> But I want show all undone tasks on one place (in separate window, or
> in separate html page). I cannot search this function in mine XEmacs.

I use grep-find (I've bound it to M-s) for this type of thing.  The
grep-find output gets handled the same way as compilation errors,
allowing you to jump to next/previous hit etc.  And since I use java
primarily, I've got this in my custom.el:

  '(grep-find-command "find . -name \"*.java\" | xargs grep --color=none -n ")

Although it's probably possible to set it upon entering jde-mode so
that it only overrides the default for java files.  You can make it
auto-close if there are no matches with something like this:

(defun my-grep-finish-function (buf str)
  "Removes the grep results window after a few seconds if there
are no errors or warnings."
  (save-excursion
    (set-buffer buf)
    (if (null (or (string-match ".*matches found.*" (buffer-string))
                  (string-match ".*[a-zA-Z]:[0-9]\+:.*" (buffer-string))))
        ;;no matches, make the window go away in a second
        (progn
          (run-at-time "1 sec" nil 'jde-compile-kill-buffer buf)
          (message "No messages"))
      ;;there were matches, so jump to the first match
      (next-error))))

;; Patch grep-find to use my-grep-finish-function
(defadvice grep-find (before set-grep-find-finish-function activate)
"Sets the compilation finish function for grep-find"
  (setq compilation-finish-function
        (lambda (buf msg) 
          (my-grep-finish-function buf msg)
          (setq compilation-finish-function nil))))


Cheers,
Len.