all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* searching in Diary
@ 2005-04-13 18:36 Raimund Kohl-Fuechsle
  0 siblings, 0 replies; 2+ messages in thread
From: Raimund Kohl-Fuechsle @ 2005-04-13 18:36 UTC (permalink / raw)


Hello there,

is there a way to search the diary and have the result shown in a
fancy-diary-buffer?  E.g. I have several diary entries like 

2005.01.01 Leadership Training
2005.02.15 Leadership Training
2005.04.21 Leadership Training

My idea was to search for "Leadership Training" and the output would be
a buffer that shows the entries like above ...

Is there something existing or am I on my own here?

ray

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

* Re: searching in Diary
       [not found] <mailman.1393.1113416568.2895.help-gnu-emacs@gnu.org>
@ 2005-04-15 19:50 ` Glenn Morris
  0 siblings, 0 replies; 2+ messages in thread
From: Glenn Morris @ 2005-04-15 19:50 UTC (permalink / raw)


Raimund Kohl-Fuechsle wrote:

> is there a way to search the diary and have the result shown in a
> fancy-diary-buffer?

I just wrote the following, FWIW. Cons:

1) it's really slow (but everything in my Emacs seems to be slow at
the moment...).

2) the search is anchored from a specific date (ie "search the N day
   period after such-and-such a date").


(defvar diary-grep-ndays 30
  "Default number of days for `diary-grep' to search.")

(defun diary-grep (regexp &optional ndays)
  "Generate a fancy diary buffer with entries matching REGEXP.
Searches diary entries over the next NDAYS (default
`diary-grep-ndays') from either the current date, or the date
indicated by the cursor position in the calendar (if called from
the calendar buffer)."
  (interactive (list (read-string "Enter regexp: ")))
  (let ((diary-display-hook 'diary-grep-display)
        (diary-grep-re regexp))
    (list-diary-entries
     (if (string-equal (buffer-name) calendar-buffer)
         (save-excursion
           (calendar-cursor-to-nearest-date))
       (calendar-current-date))
     (if current-prefix-arg
         (prefix-numeric-value current-prefix-arg)
       diary-grep-ndays))))

(defun diary-grep-display ()
  "Generate a fancy diary buffer with entries matching `diary-grep-re'."
  (let ((dlist diary-entries-list)
        diary-entries-list holidays-in-diary-buffer)
    (dolist (entry dlist)
      (if (string-match diary-grep-re (cadr entry))
          (setq diary-entries-list
                (append diary-entries-list (list entry)))))
    (if diary-entries-list
        (fancy-diary-display)
      (error "No diary entries match `%s'" diary-grep-re))))

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

end of thread, other threads:[~2005-04-15 19:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-13 18:36 searching in Diary Raimund Kohl-Fuechsle
     [not found] <mailman.1393.1113416568.2895.help-gnu-emacs@gnu.org>
2005-04-15 19:50 ` Glenn Morris

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.