Gnus development mailing list
 help / color / mirror / Atom feed
* sending messages from script/command line
@ 2013-06-28 15:40 lee
  2013-07-01 12:40 ` Ted Zlatanov
  0 siblings, 1 reply; 9+ messages in thread
From: lee @ 2013-06-28 15:40 UTC (permalink / raw)
  To: ding

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



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-07-08 14:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-28 15:40 sending messages from script/command line lee
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

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