From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Stewart Newsgroups: gmane.emacs.help Subject: Re: starting an external command from emacs Date: Thu, 13 Nov 2008 08:17:59 +0800 Message-ID: <87skpwqy14.fsf@manatee.domain> References: <1226519989.8767.681.camel@localhost> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1226549440 27487 80.91.229.12 (13 Nov 2008 04:10:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 13 Nov 2008 04:10:40 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Nov 13 05:11:42 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1L0TYT-0004kB-6J for geh-help-gnu-emacs@m.gmane.org; Thu, 13 Nov 2008 05:11:41 +0100 Original-Received: from localhost ([127.0.0.1]:51763 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L0TXL-00022u-3F for geh-help-gnu-emacs@m.gmane.org; Wed, 12 Nov 2008 23:10:31 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L0TWx-00022Q-2r for help-gnu-emacs@gnu.org; Wed, 12 Nov 2008 23:10:07 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L0TWv-00020X-Lx for help-gnu-emacs@gnu.org; Wed, 12 Nov 2008 23:10:06 -0500 Original-Received: from [199.232.76.173] (port=55598 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L0TWv-00020R-EH for help-gnu-emacs@gnu.org; Wed, 12 Nov 2008 23:10:05 -0500 Original-Received: from main.gmane.org ([80.91.229.2]:59994 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1L0TWv-0002bk-Dm for help-gnu-emacs@gnu.org; Wed, 12 Nov 2008 23:10:05 -0500 Original-Received: from root by ciao.gmane.org with local (Exim 4.43) id 1L0TWs-00041p-M9 for help-gnu-emacs@gnu.org; Thu, 13 Nov 2008 04:10:02 +0000 Original-Received: from 222.212.128.65 ([222.212.128.65]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 13 Nov 2008 04:10:02 +0000 Original-Received: from lazycat.manatee by 222.212.128.65 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 13 Nov 2008 04:10:02 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 56 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 222.212.128.65 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:jIUP4mGc8HXH0z8E6o8+B9+e2VQ= X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:59717 Archived-At: Hi, Matt! I recommend you use GNUS, it's more powerful and integration closer with Emacs. Matt Price writes: > hi, > > i'm a not-especially-technical person who uses emacs as a > straightforward text editor; in fact i'm experimenting with living > inside emacs most of the time on my main laptop, largely to eliminate > distractions while i'm writing. however, some significant fraction of > the stuff i write is intended to be emailed away. I'd like to do two > things: > > (1) write a function that takes the contents of the current buffer and > inserts it into a message; > (2) use an external script to query an already-existing contacts > database (for me it's evolution or gmail), and pass that address on to > the to-header of the resultant message. > > (2) seemed difficult to me. so what i'm trying right now is to write a > function that invokes mutt with an address string, then, within mutt, > use emacsclient as my editor, post-mode as my mode, and insert the text > into the message body. This is what i have so far: > > (defun start-mutt-with-this-buffer-contents (address) > (mark-whole-buffer) > (kill-ring-save) ;; ok this needs a beginning and end but i don't know how to do that > (interactive "M") ;; i think that's right > (set-buffer (apply 'make-term "Mutt" "mutt" nil (list address))) > (switch-to-buffer "*Mutt*") > ;; need some kind of "wait for mutt to start composing" thing here > (post-goto-body) > (yank) > ) > > > the problem with this right now is that the (yank) occurs too early, and > the yanked text appears in the *Mutt* window, instead of the *Composing* > window where i want it to appear. is there a way to tell emacs to wait > on mutt till the interactive command is finished, then switch tothe > composing buffer and paste the text in there? or failing that -- how > might i query an external database from within emacs? if i could do > that, then i guess i could use one of the many already-existing emacs > mail modes to actually send the message, and provide it with the the > query result as a to-address. i have, for instance, a couple of python > scripts that return a sequence of lines, one email address per line -- > these are designed for use with mutt -- i guess one could put them into > some kind of minibuffer that would then feed the appropriate choice back > to an emacs function. i just don't know how to do that kind of stuff > myself. > > Thanks in advance for your help!! > > matt