From: Glenn Morris <gmorris+news@ast.cam.ac.uk>
Subject: Re: searching in Diary
Date: Fri, 15 Apr 2005 20:50:10 +0100 [thread overview]
Message-ID: <8tr7hbizv1.fsf@xpc14.ast.cam.ac.uk> (raw)
In-Reply-To: mailman.1393.1113416568.2895.help-gnu-emacs@gnu.org
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))))
next parent reply other threads:[~2005-04-15 19:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.1393.1113416568.2895.help-gnu-emacs@gnu.org>
2005-04-15 19:50 ` Glenn Morris [this message]
2005-04-13 18:36 searching in Diary Raimund Kohl-Fuechsle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8tr7hbizv1.fsf@xpc14.ast.cam.ac.uk \
--to=gmorris+news@ast.cam.ac.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).