[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Lisp hints with VM, BBDB and Personality Crisis
From: |
spam |
Subject: |
Lisp hints with VM, BBDB and Personality Crisis |
Date: |
15 Sep 2003 00:16:02 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 |
Hello,
I have been playing around with the Personality Crisis package for
VM. I have written the following code which basically is a test to see
if the recipient of the e-mail is a friend. It goes in the bbdb record
for the e-mail handle and sees if there is a string like "efriend" in
the note field.
I am not an expert in elisp and I was wondering if there is a way to
shorten the code? Especially, in checking nil variables, I tend to do
a lot of (unless (eq thingy nil). Any other comments are appreciated.
(defun my-check-efriend()
"Fetch the 'to' address from the e-mail. Look up in bbdb for the given
address. Look in the note field and check for the string
'efriend'. Returns t when that's the case"
(interactive)
(let ((header (vmpc-get-current-header-contents "to")))
(unless (eq header nil)
(when (string-match "<\\(.*\\)>" header)
(let* ((email (match-string 1 header))
(record (bbdb-search-simple "" email)))
(unless (eq record nil)
(let ((note (bbdb-record-notes record)))
(unless (eq note nil)
(when (string-match "efriend" note) t)))))))))
--
/-----------------------------------------------------------------------------*
| "At Group L, Stoffel oversees six first-rate | Ivan Kanis |
| programmers, a managerial challenge roughly | Software Developper |
| comparable to herding cats." | www.kanis.cc |
| (The Wasington Post, June 9, 1985) | |
*-----------------------------------------------------------------------------/
- Lisp hints with VM, BBDB and Personality Crisis,
spam <=