Gnus development mailing list
 help / color / mirror / Atom feed
From: Dan Christensen <jdc@uwo.ca>
To: ding@gnus.org
Subject: Re: using templates to write articles (email)
Date: Sat, 11 Jun 2011 13:22:38 -0400	[thread overview]
Message-ID: <87aadoe10h.fsf@uwo.ca> (raw)
In-Reply-To: <87fwnhd0mx.fsf@yun.yagibdah.de>

[-- Attachment #1: Type: text/plain, Size: 220 bytes --]

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: gnusemail --]
[-- Type: text/x-python, Size: 1181 bytes --]

#!/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])

  parent reply	other threads:[~2011-06-11 17:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-10 18:03 lee
2011-06-10 18:53 ` Eric Abrahamsen
2011-06-10 20:41   ` lee
2011-06-10 19:32 ` Didier Verna
2011-06-10 20:46   ` lee
2011-06-11 17:22 ` Dan Christensen [this message]
2011-06-13  0:33 ` solved: " lee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87aadoe10h.fsf@uwo.ca \
    --to=jdc@uwo.ca \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).