From: Ian Zimmerman <itz@buug.org>
To: help-gnu-emacs@gnu.org
Subject: Re: A completing read to set message-mode or Gnus "from"
Date: Tue, 11 Aug 2015 23:06:08 -0700 [thread overview]
Message-ID: <20150812060255.25295.06559906@ahiker.mooo.com> (raw)
In-Reply-To: <20150812055626.25144.08C85626@ahiker.mooo.com>
On 2015-08-11 23:01 -0700, Ian Zimmerman wrote:
Tory> As a Helm user with 7 or so email addresses I might be sending
Tory> with, I wanted to put together a quick completing-read to fill in
Tory> my from address with a keystroke; however, it's not working and
Tory> I'm not sure why. It complains about wanting a list, but when I
Tory> return a list it complains about wanting a string.
> > --8<---------------cut here---------------start------------->8---
> > (defun tsa/message-choose-from ()
> > (interactive
> > (let ((my-name "Joseph Smith")
> > (my-from-list '("abc@gmail.com" "def@gmail.com"
> > "xyz@gmail.com")))
> > (message-make-from my-name (completing-read "From:"
> > my-from-list nil t)))))
> >
> > (add-hook 'message-mode-hook
> > (lambda ()
> > (local-set-key (kbd "C-c f") 'tsa/message-choose-from)))
>
Ian> I think you don't understand what the interactive declaration is
Ian> for.
Ian>
Ian> It doesn't mean "this code interacts with the user". It means it
Ian> can be invoked as a command, with a keybinding or via M-x. In your
Ian> case, you're calling your function from a hook, which is as
Ian> non-interactive as it gets :-)
Eh, forget this part. It's quite late here :-(
Ian> When we clarify that point, we can get to _how_ to use interactive
This, though, is valid. Have you looked at some Emacs source to see how
(interactive) is used?
--
Please *no* private copies of mailing list or newsgroup messages.
Rule 420: All persons more than eight miles high to leave the court.
next prev parent reply other threads:[~2015-08-12 6:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-11 22:58 A completing read to set message-mode or Gnus "from" Tory S. Anderson
2015-08-12 6:01 ` Ian Zimmerman
2015-08-12 6:06 ` Ian Zimmerman [this message]
2015-08-12 7:34 ` Thierry Volpiatto
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=20150812060255.25295.06559906@ahiker.mooo.com \
--to=itz@buug.org \
--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.
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).