[Top][All Lists]

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

RE: reading a variable from the user

From: drain
Subject: RE: reading a variable from the user
Date: Wed, 10 Oct 2012 18:09:50 -0700 (PDT)

strings.el and simple+.el are new to me: thanks. They may contain the answer,
and I need to pick through them carefully, but I'll just be forthright about
what I am trying to do. Very new to Emacs Lisp...

I want to prompt myself with "To:", enter a contact name and a topic, then
pass them as arguments to compose-mail.

This was no problem, but the goal right now is to cut out the redundant
conditional statement, and instead match the name string I enter to its
variable directly, for example "William" to the William variable. Might
require pointers or arrays of some sort, but I haven't gotten that far in
the Emacs Lisp Intro.

Here's what I have:

(defun custom-compose-mail (Contact Topic)
  (interactive "sTo: \nsTopic: ")
  (setq William "address@hidden"
        David "address@hidden"
        Jason "address@hidden"
        Carl "address@hidden")
  (cond ((equal Contact "William") (setq Contact William))
        ((equal Contact "David") (setq Contact David))
        ((equal Contact "Jason") (setq Contact Jason))
        ((equal Contact "Carl") (setq Contact Carl)))
  (compose-mail Contact Topic)

View this message in context:
Sent from the Emacs - Help mailing list archive at

reply via email to

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