unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* starting an external command from emacs
@ 2008-11-12 19:59 Matt Price
  2008-11-13  0:17 ` Andy Stewart
  0 siblings, 1 reply; 9+ messages in thread
From: Matt Price @ 2008-11-12 19:59 UTC (permalink / raw)
  To: help-gnu-emacs

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



-- 
Matt Price
matt.price@utoronto.ca




^ permalink raw reply	[flat|nested] 9+ messages in thread
[parent not found: <mailman.201.1226528857.26697.help-gnu-emacs@gnu.org>]

end of thread, other threads:[~2008-11-14 20:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-12 19:59 starting an external command from emacs Matt Price
2008-11-13  0:17 ` Andy Stewart
     [not found] <mailman.201.1226528857.26697.help-gnu-emacs@gnu.org>
2008-11-12 23:08 ` Dan Espen
2008-11-13  3:48   ` Matt Price
     [not found]   ` <mailman.217.1226563070.26697.help-gnu-emacs@gnu.org>
2008-11-13 13:54     ` Dan Espen
2008-11-13 15:50 ` Xah
2008-11-14 15:33   ` Matt Price
     [not found]   ` <mailman.365.1226676836.26697.help-gnu-emacs@gnu.org>
2008-11-14 19:43     ` Xah
2008-11-14 20:31     ` Andreas Politz

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).