From: spam@juliva.com
Subject: Lisp hints with VM, BBDB and Personality Crisis
Date: 15 Sep 2003 00:16:02 +0200 [thread overview]
Message-ID: <87znh7aue5.fsf@dell.i-did-not-set--mail-host-address--so-shoot-me> (raw)
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) | |
*-----------------------------------------------------------------------------/
next reply other threads:[~2003-09-14 22:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-14 22:16 spam [this message]
2003-09-15 2:28 ` Lisp hints with VM, BBDB and Personality Crisis Jesper Harder
2003-09-18 13:07 ` Ivan Kanis
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=87znh7aue5.fsf@dell.i-did-not-set--mail-host-address--so-shoot-me \
--to=spam@juliva.com \
/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).