From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: spam@juliva.com Newsgroups: gmane.emacs.help Subject: Lisp hints with VM, BBDB and Personality Crisis Date: 15 Sep 2003 00:16:02 +0200 Organization: Guest of TISCALI - FRANCE Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <87znh7aue5.fsf@dell.i-did-not-set--mail-host-address--so-shoot-me> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1063591266 4801 80.91.224.253 (15 Sep 2003 02:01:06 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 15 Sep 2003 02:01:06 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Sep 15 04:01:04 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19yifo-0000ag-00 for ; Mon, 15 Sep 2003 04:01:04 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.22) id 19yifY-00025m-Vz for geh-help-gnu-emacs@m.gmane.org; Sun, 14 Sep 2003 22:00:48 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsmi-us.news.garr.it!NewsITBone-GARR!news.mailgate.org!newsfeed.stueberl.de!proxad.net!news.tiscali.fr!127.0.0.1!nobody Original-Newsgroups: gnu.emacs.help Original-Lines: 34 Original-NNTP-Posting-Host: 212.47.244.165 Original-X-Trace: news.tiscali.fr 1063590469 12736 212.47.244.165 (15 Sep 2003 01:47:49 GMT) Original-X-Complaints-To: abuse@libertysurf.fr Original-NNTP-Posting-Date: Mon, 15 Sep 2003 01:47:49 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Original-Xref: shelby.stanford.edu gnu.emacs.help:116594 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:12515 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:12515 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) | | *-----------------------------------------------------------------------------/