help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: A completing read to set message-mode or Gnus "from"


From: Ian Zimmerman
Subject: Re: A completing read to set message-mode or Gnus "from"
Date: Tue, 11 Aug 2015 23:01:34 -0700
User-agent: Mutt/1.5.21 (2010-09-15)

On 2015-08-11 16:58 -0600, Tory S. Anderson wrote:

> As a Helm user with 7 or so email addresses I might be sending with,
> I wanted to put together a quick completing-read to fill in my from
> address with a keystroke; however, it's not working and I'm not sure
> why. It complains about wanting a list, but when I 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 '("address@hidden" "address@hidden"      
> "address@hidden")))
>     (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)))

I think you don't understand what the interactive declaration is for.

It doesn't mean "this code interacts with the user".  It means it can be
invoked as a command, with a keybinding or via M-x.  In your case,
you're calling your function from a hook, which is as non-interactive as
it gets :-)

When we clarify that point, we can get to _how_ to use interactive; you
don't do that right either, even if it made sense to provide the
function as a command.

-- 
Please *no* private copies of mailing list or newsgroup messages.
Rule 420: All persons more than eight miles high to leave the court.




reply via email to

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