Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
From: Emanuel Berg <embe8573@student.uu.se>
To: info-gnus-english@gnu.org
Subject: Usenet/mail compose (was: Re: [Gnus] Fetch extra categories?)
Date: Wed, 27 Nov 2013 22:06:26 +0100	[thread overview]
Message-ID: <87txexbllg.fsf_-_@nl106-137-194.student.uu.se> (raw)
In-Reply-To: <87hab5xwig.fsf@nl106-137-194.student.uu.se>

Emanuel Berg <embe8573@student.uu.se> writes [on gnu.emacs.help]:

> ;; The below is about *sending* - it sets the signature
> ;; (same for everything), but when answering a *mail*,
> ;; it adds the Newsgroup: header if I were to change my
> ;; mind and make it a Usenet post instead (or "as
> ;; well"), *or* as is a much more common case, if I
> ;; send a Usenet post and when I write it I think,
> ;; "Man, this would be right up X's alley", but he is
> ;; not on Usenet, so then I need inserted a To: header
> ;; to make it a mail as well.
>
> (setq gnus-posting-styles
>       (let ((sig "Emanuel Berg ... "))
>         `(("nnml:.*"
>            (Newsgroups "")
>            (signature ,sig)
>            )
>           (message-this-is-news
>            (To "")
>            (Mail-Copies-To "never")
>            (signature ,sig) ))))
>
> ;; While we are on this subject - perhaps that is a bad
> ;; idea in terms of spamming? Should I program it to,
> ;; when I send to Usenet, *first* send is as a mail,
> ;; remove the To: header, and then send it to Usenet
> ;; (i.e., without the header)?  But I did this a lot
> ;; and no one ever complained.

Well, now someone did, but spamming wasn't the issue. I
got a mail from a guy using the Evolution mail client,
and he said that the "Newsgroups" empty header made my
mail address not appearing in the "To" header, although
in the "From" header of the original mail, when he
invoked <reply>.

This turned out to be a bug in Evolution:

> A quick search reveals that the behavior of Evolution
> is a known bug
> (https://bugzilla.gnome.org/show_bug.cgi?id=260995).

However, be that as it may, it still doesn't make sense
to provide empty "Newsgroups" and "To" headers (in
Usenet posts and mails, respectively), so when the
"joint Usenet/mail compose interface" is not employed,
I decided it'd be best to remove the surplus (empty)
header.

I managed to to this like this:

(defun get-separator-pos ()
  "Get the position of `mail-header-separator'."
  (save-excursion
    (rfc822-goto-eoh)
    (point) ))

(defun remove-empty-headers ()
  (interactive)
  (let ((start (point-min))
        (stop  (get-separator-pos)) )
    (save-excursion
      (replace-regexp "Newsgroups: \n" "" nil start stop)
      (replace-regexp "To: \n" "" nil start stop) )))
(add-hook 'message-send-hook 'remove-empty-headers)

I was tempted to write a defun that would remove *all*
empty headers, but I don't know - perhaps there are
some headers that can be empty and still useful (?).

-- 
Emanuel Berg, programmer-for-rent. CV, projects, etc at uXu
underground experts united:  http://user.it.uu.se/~embe8573

           reply	other threads:[~2013-11-27 21:06 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <87hab5xwig.fsf@nl106-137-194.student.uu.se>]

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=87txexbllg.fsf_-_@nl106-137-194.student.uu.se \
    --to=embe8573@student.uu.se \
    --cc=info-gnus-english@gnu.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).