From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ian Zimmerman Newsgroups: gmane.emacs.help Subject: Re: A completing read to set message-mode or Gnus "from" Date: Tue, 11 Aug 2015 23:06:08 -0700 Message-ID: <20150812060255.25295.06559906@ahiker.mooo.com> References: <877fp1l9fl.fsf@linux.site> <20150812055626.25144.08C85626@ahiker.mooo.com> Reply-To: help-gnu-emacs@gnu.org NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1439359587 2585 80.91.229.3 (12 Aug 2015 06:06:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 12 Aug 2015 06:06:27 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Aug 12 08:06:26 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZPPBB-0006cH-5u for geh-help-gnu-emacs@m.gmane.org; Wed, 12 Aug 2015 08:06:25 +0200 Original-Received: from localhost ([::1]:37025 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPPBA-0002v1-HP for geh-help-gnu-emacs@m.gmane.org; Wed, 12 Aug 2015 02:06:24 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41392) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPPAy-0002ut-8W for help-gnu-emacs@gnu.org; Wed, 12 Aug 2015 02:06:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZPPAx-00075N-19 for help-gnu-emacs@gnu.org; Wed, 12 Aug 2015 02:06:12 -0400 Original-Received: from disorder-1-pt.tunnel.tserv3.fmt2.ipv6.he.net ([2001:470:1f04:51a::2]:37251 helo=acedia.primate.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPPAw-00075B-Mt for help-gnu-emacs@gnu.org; Wed, 12 Aug 2015 02:06:10 -0400 Original-Received: from acedia.primate.net (localhost [127.0.0.1]) by acedia.primate.net (8.14.9/8.14.9/Debian-4) with ESMTP id t7C6694v029960 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 11 Aug 2015 23:06:09 -0700 Original-Received: (from itz@localhost) by acedia.primate.net (8.14.9/8.14.9/Submit) id t7C669Yr029954 for help-gnu-emacs@gnu.org; Tue, 11 Aug 2015 23:06:09 -0700 X-Authentication-Warning: acedia.primate.net: itz set sender to itz@buug.org using -f Original-Received: from itz by ahiker.mooo.com with local (Exim 4.80) (envelope-from ) id 1ZPPAu-0006ao-LF for help-gnu-emacs@gnu.org; Tue, 11 Aug 2015 23:06:08 -0700 Content-Disposition: inline In-Reply-To: <20150812055626.25144.08C85626@ahiker.mooo.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:470:1f04:51a::2 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:106494 Archived-At: 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.