all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: drain <aeuster@gmail.com>
To: Help-gnu-emacs@gnu.org
Subject: RE: reading a variable from the user
Date: Wed, 10 Oct 2012 18:09:50 -0700 (PDT)	[thread overview]
Message-ID: <1349917790397-266847.post@n5.nabble.com> (raw)
In-Reply-To: <D9C9B9320D2549D0B24BB987C90DC002@us.oracle.com>

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 "xx@xxxxxxxxxxx.org"
	David "xxxxxxxxxxx@gmail.com"
	Jason "xxxxxxxxxx@gmail.com"
	Carl "xxxxxx@gmail.com")
  (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)
  (end-of-buffer)
  (newline))




--
View this message in context: http://emacs.1067599.n5.nabble.com/reading-a-variable-from-the-user-tp266778p266847.html
Sent from the Emacs - Help mailing list archive at Nabble.com.



  reply	other threads:[~2012-10-11  1:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-10  7:24 reading a variable from the user drain
2012-10-10  9:08 ` Francesco Mazzoli
2012-10-10  9:16   ` Tassilo Horn
2012-10-10  9:22     ` horse_rivers
2012-10-10 13:59 ` Doug Lewan
2012-10-10 14:13 ` Drew Adams
2012-10-11  1:09   ` drain [this message]
2012-10-11  3:27     ` Eric Abrahamsen
2012-10-11  6:08       ` PJ Weisberg
2012-10-11  6:50         ` Eric Abrahamsen
2012-10-11  6:16       ` drain

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1349917790397-266847.post@n5.nabble.com \
    --to=aeuster@gmail.com \
    --cc=Help-gnu-emacs@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.