help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Searching an alist


From: David Chadd
Subject: Searching an alist
Date: Tue, 23 Dec 2003 22:35:14 +0000

I have an alist in the following form:

(defvar occasions
 '(
("14020200" "Purificatio Mariae" "Purification of Mary \(Candlemas\)" "February 
2")
("14020208" "Purificatio Mariae, infra octavas" "In week after Purification of 
Mary" "")
("14020300" "S. Blasii" "Blaise, Bishop of Sebastea, Martyr" "February 3")
("14020308" "S. Blasii, infra octavas" "In week after Blaise" "")
("14020500" "S. Agathae" "Agatha, Martyr" "February 5")
("14020508" "S. Agathae, infra octavas" "In week after Agatha" "")
 [and so on...]

(It's a list of medieval Christian liturgical feasts with serial
numbers -- over 1000 altogether.)

What I want to do is to be able to search it, with an input from the
minibuffer, so that all matching entries are displayed via
'with-output-to-temp-buffer'.  I can do this OK for the first matching
list (using 'find') if I supply the exact match for the whole of an
element.  But what I want is to be able to look for _part_ of an
element.  So, I want (e.g.) the minibuffer to take the input "Blaise",
and both the third and fourth lines above to be returned. (Basically,
what I want is to automate the looking-up of the serial numbers.)

So, there are two things I can't manage.  One is to search for part of
an element (I can if necessary have this restricted to the cadr or
caddr of the list, which is what I have been doing already with :key
#'caddr).  The other is to display _all_ the lists which match.  I
have a feeling that 'assoc-default' might be the clue to the first of
these, but frankly I find both the docstring and manual entry for this
func beyond my feeble understanding of lisp :-(

Any help gratefully received.

DC
-- 
--------------------------
Professor David Chadd
University of East Anglia
Norwich NR4 7TJ, UK
net: <d.chadd@uea.ac.uk>
web: www.uea.ac.uk/~q506/
fax: +44 (0)1263 250454
--------------------------





reply via email to

[Prev in Thread] Current Thread [Next in Thread]