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:06:08 -0700
User-agent: Mutt/1.5.21 (2010-09-15)

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.




reply via email to

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