From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Cecil Westerhof Newsgroups: gmane.emacs.help Subject: Re: How to convert a char to a property Date: Tue, 27 Jul 2010 15:18:38 +0200 Organization: Decebal Computing Message-ID: <87fwz583m9.fsf@decebal.nl> References: <87sk358gzw.fsf@decebal.nl> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1291851885 12991 80.91.229.12 (8 Dec 2010 23:44:45 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 8 Dec 2010 23:44:45 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Dec 09 00:44:41 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PQTge-0002QV-Ls for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Dec 2010 00:44:40 +0100 Original-Received: from localhost ([127.0.0.1]:57597 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQTgd-0001yu-UI for geh-help-gnu-emacs@m.gmane.org; Wed, 08 Dec 2010 18:44:40 -0500 Original-Path: usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Original-Newsgroups: gnu.emacs.help X-Homepage: http://www.decebal.nl/ User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:9nfLIH0QHjG5YG/z4Ap6rnqadxc= Original-Lines: 52 Original-NNTP-Posting-Host: 84.53.123.169 Original-X-Trace: 1280236716 news.xs4all.nl 22916 decebal/[::ffff:84.53.123.169]:13256 Original-X-Complaints-To: abuse@xs4all.nl Original-Xref: usenet.stanford.edu gnu.emacs.help:180106 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:76234 Archived-At: Op dinsdag 27 jul 2010 10:29 CEST schreef Cecil Westerhof: > I have the following property list: > (defvar dcbl-bbdb-user-defined-fields (list :L "mail-alias" > :M "mailer" > :P "playlist" > :s "subjects" > :t "type" > :w "website") > "User defined fields in the bbdb with parameter to insert into buffer") > > With (getf dcbl-bbdb-user-defined-fields :M) I get "mailer". > > But I want to work parameter driven. So for example I have: > (setq parameters "MLst") > (setq current-char (string-to-char parameters)) > > The variable current-char now contains 77. How could I use > current-char to retrieve "mailer"? At the moment I use another solution. I now have: (defvar dcbl-bbdb-user-defined-fields '(("L" "mail-alias") ("M" "mailer") ("P" "playlist") ("s" "subjects") ("t" "type") ("w" "website")) "User defined fields in the bbdb with parameter to insert into buffer") and use the following code: (setq field-name nil parameters dcbl-bbdb-user-defined-fields this-value nil) (while parameters (setq this-parameter (car parameters) parameters (cdr parameters)) (when (string= current-char (car this-parameter)) (setq field-name (car (cdr this-parameter)) parameters nil))) The variable current-char is the parameter (as a string) that I am searching for. This does work, but I do not know if it is very efficient. Is this a good solution, or should I code it differently? -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof