help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Usenet/mail compose (was: Re: [Gnus] Fetch extra categories?)


From: Emanuel Berg
Subject: Usenet/mail compose (was: Re: [Gnus] Fetch extra categories?)
Date: Wed, 27 Nov 2013 22:06:26 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]