Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* Usenet/mail compose (was: Re: [Gnus] Fetch extra categories?)
       [not found] ` <87hab5xwig.fsf@nl106-137-194.student.uu.se>
@ 2013-11-27 21:06   ` Emanuel Berg
  0 siblings, 0 replies; only message in thread
From: Emanuel Berg @ 2013-11-27 21:06 UTC (permalink / raw)
  To: info-gnus-english

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-11-27 21:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <87a9gxo7lt.fsf@002215fd0050.amnet.co.cr>
     [not found] ` <87hab5xwig.fsf@nl106-137-194.student.uu.se>
2013-11-27 21:06   ` Usenet/mail compose (was: Re: [Gnus] Fetch extra categories?) Emanuel Berg

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