From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/79063 Path: news.gmane.org!not-for-mail From: Dan Christensen Newsgroups: gmane.emacs.gnus.general Subject: Re: using templates to write articles (email) Date: Sat, 11 Jun 2011 13:22:38 -0400 Message-ID: <87aadoe10h.fsf@uwo.ca> References: <87fwnhd0mx.fsf@yun.yagibdah.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1307812997 17806 80.91.229.12 (11 Jun 2011 17:23:17 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 11 Jun 2011 17:23:17 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M27362@lists.math.uh.edu Sat Jun 11 19:23:13 2011 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QVRtw-0003uP-5r for ding-account@gmane.org; Sat, 11 Jun 2011 19:23:12 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1QVRth-0006fa-Ta; Sat, 11 Jun 2011 12:22:57 -0500 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1QVRtg-0006fQ-Bs for ding@lists.math.uh.edu; Sat, 11 Jun 2011 12:22:56 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1QVRtf-0001ZF-7n for ding@lists.math.uh.edu; Sat, 11 Jun 2011 12:22:56 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]) by quimby.gnus.org with esmtp (Exim 4.72) (envelope-from ) id 1QVRtd-0006pc-SG for ding@gnus.org; Sat, 11 Jun 2011 19:22:53 +0200 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QVRtb-0003nq-K3 for ding@gnus.org; Sat, 11 Jun 2011 19:22:51 +0200 Original-Received: from cpe78cd8e6c4f18-cm78cd8e6c4f15.cpe.net.cable.rogers.com ([99.249.98.79]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 11 Jun 2011 19:22:51 +0200 Original-Received: from jdc by cpe78cd8e6c4f18-cm78cd8e6c4f15.cpe.net.cable.rogers.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 11 Jun 2011 19:22:51 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: ding@gnus.org Original-Lines: 59 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: cpe78cd8e6c4f18-cm78cd8e6c4f15.cpe.net.cable.rogers.com User-Agent: Gnus/5.110012 (No Gnus v0.12) Emacs/23.1 (gnu/linux) Mail-Copies-To: never Cancel-Lock: sha1:3hzdJOkAam8b5Zp7XCMot8G00BM= X-Spam-Score: -4.9 (----) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:79063 Archived-At: --=-=-= Content-Type: text/plain I use mozmail-compose-gnus in mozmail.el. I wrap this with the attached python script which reads an e-mail message from standard input and then uses emacsclient to open a message buffer via mozmail-compose-gnus. Dan --=-=-= Content-Type: text/x-python Content-Disposition: inline; filename=gnusemail #!/usr/bin/env python # Reads an e-mail message from stdin, and sets up a gnus compose buffer # with it ready to edit/send. Only handles single-line To, Cc, Subject, etc. import sys import subprocess readinghead = True to = 'nil' cc = 'nil' bcc = 'nil' subject = 'nil' body = '"' for line in sys.stdin: # Replace \ with \\ line=line.replace('\\', r'\\') # Replace " with \" line=line.replace(r'"', r'\"') if readinghead: line = line.strip() if line: if line.startswith('To: '): to = '"' + line[4:] + '"' elif line.startswith('Cc: '): cc = '"' + line[4:] + '"' elif line.startswith('Bcc: '): bcc = '"' + line[5:] + '"' elif line.startswith('Subject: '): subject = '"' + line[9:] + '"' else: print 'Error: unknown line in head:' print line sys.exit(1) else: readinghead = False else: body += line body += '"' elisp = '(mozmail-compose-gnus %s %s %s %s %s)' % (to, subject, cc, bcc, body) subprocess.call(['emacsclient', '-n', '--eval', elisp]) --=-=-=--