Gnus development mailing list
 help / color / mirror / Atom feed
From: lee <lee@yun.yagibdah.de>
To: ding@gnus.org
Subject: sending messages from script/command line
Date: Fri, 28 Jun 2013 17:40:25 +0200	[thread overview]
Message-ID: <87zjua8edq.fsf@yun.yagibdah.de> (raw)

Hi,

is there a way to send messages from a script using the posting style of
a particular group?  Like

  emacsclient -e "(gnus-group-mail 1)"

works fine, only it doesn't let me specify which group to use and emacs
asks me.

Hmm ...

For what it's worth, I copied the defun and modified it:


(defun my-gnus-group-mail (arg)
  "Start composing a mail.
Use the group given in ARG to find a posting style."
  (interactive "P")
  ;; We can't `let' gnus-newsgroup-name here, since that leads
  ;; to local variables leaking.
  (let ((group gnus-newsgroup-name)
	;; make sure last viewed article doesn't affect posting styles:
	(gnus-article-copy)
	(buffer (current-buffer)))
    (unwind-protect
	(progn
	  (setq gnus-newsgroup-name arg)
	  ;; #### see comment in gnus-setup-message -- drv
	  (gnus-setup-message 'message (message-mail)))
      (with-current-buffer buffer
	(setq gnus-newsgroup-name group)))))


This might not be as it should be, but it seems to work:

  emacsclient -e '(my-gnus-group-mail "particular.group.name")'

Maybe there's a better (already built-in) way to do this?


Since I am at this:  This only works when gnus has already been started.
What would I do to make sure that it's started if it isn't?  Is there a
way to check whether gnus is running from the command line/script, or
could/should I write a wrapper around 'my-gnus-group-mail that starts
gnus in case it's not started already?

Maybe I should add that I'm not actually "composing" a mail with this:
Headers and body are read from files and I just need to take a look at
the mail and sometimes make a little change to it before actually
sending it.

Hmmm ... Can posting styles be specified on the command line?  Having
/one fixed/ posting style for a group isn't ideal in my case; I could
use something like being asked "Which of the posting styles for this
group would you like to use?" in some cases --- and/or be able to
specify them on the command line.

Perhaps I need to write a wrapper function that resets the posting-style
from what's in ~/.gnus to what I need?  Could I just add something like

(setq posting-style (signature "something else"))

to 'my-gnus-group-mail?  (This is probably wrong; I'm really not good
with elisp ...)


-- 
"Object-oriented programming languages aren't completely convinced that
you should be allowed to do anything with functions."
http://www.joelonsoftware.com/items/2006/08/01.html



             reply	other threads:[~2013-06-28 15:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-28 15:40 lee [this message]
2013-07-01 12:40 ` Ted Zlatanov
2013-07-02  9:48   ` lee
2013-07-02 15:35     ` Ted Zlatanov
2013-07-05 22:00       ` lee
2013-07-06  3:22         ` Eric Abrahamsen
2013-07-08 12:23           ` Ted Zlatanov
2013-07-08 14:08             ` Eric Abrahamsen
2013-07-08 12:32         ` Ted Zlatanov

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=87zjua8edq.fsf@yun.yagibdah.de \
    --to=lee@yun.yagibdah.de \
    --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).