From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.help Subject: Usenet/mail compose (was: Re: [Gnus] Fetch extra categories?) Date: Wed, 27 Nov 2013 22:06:26 +0100 Organization: Aioe.org NNTP Server Message-ID: <87txexbllg.fsf_-___46455.9111664586$1385586625$gmane$org@nl106-137-194.student.uu.se> References: <87a9gxo7lt.fsf@002215fd0050.amnet.co.cr> <87hab5xwig.fsf@nl106-137-194.student.uu.se> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1385586614 2489 80.91.229.3 (27 Nov 2013 21:10:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 27 Nov 2013 21:10:14 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Nov 27 22:10:21 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VlmNI-0002cf-Lg for geh-help-gnu-emacs@m.gmane.org; Wed, 27 Nov 2013 22:10:20 +0100 Original-Received: from localhost ([::1]:37798 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VlmNI-0005Xf-4Z for geh-help-gnu-emacs@m.gmane.org; Wed, 27 Nov 2013 16:10:20 -0500 Original-Path: usenet.stanford.edu!goblin1!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help,gnu.emacs.gnus Original-Followup-To: gnu.emacs.help Original-Lines: 74 Original-NNTP-Posting-Host: VVbyYd/iFZoeWNmD9i++cQ.user.speranza.aioe.org Original-X-Complaints-To: abuse@aioe.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) X-Notice: Filtered by postfilter v. 0.8.2 Cancel-Lock: sha1:In4QP7+dNsRWUIITtXzoJk7YpAs= Mail-Copies-To: never Original-Xref: usenet.stanford.edu gnu.emacs.help:202413 gnu.emacs.gnus:87712 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:94682 Archived-At: Emanuel Berg 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 . 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