Re: [PATCH] replace gnu xargs usage in notmuch-mutt with perl
[notmuch-archives.git] / 2a / 8a8d7b60f2ba49ed60341aee60df5092b9a5da
1 Return-Path: <Sebastian@SSpaeth.de>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 3ECA24196F2\r
6         for <notmuch@notmuchmail.org>; Mon, 12 Apr 2010 01:30:59 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -1.9\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5\r
12         tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=ham\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id rKR0l-NmyyuS for <notmuch@notmuchmail.org>;\r
16         Mon, 12 Apr 2010 01:30:58 -0700 (PDT)\r
17 Received: from homiemail-a23.g.dreamhost.com (caiajhbdcaid.dreamhost.com\r
18         [208.97.132.83])\r
19         by olra.theworths.org (Postfix) with ESMTP id 9098E431FC1\r
20         for <notmuch@notmuchmail.org>; Mon, 12 Apr 2010 01:30:58 -0700 (PDT)\r
21 Received: from sspaeth.de (mtec-hg-docking-1-dhcp-204.ethz.ch\r
22         [129.132.133.204])\r
23         by homiemail-a23.g.dreamhost.com (Postfix) with ESMTPA id A9A8E4B007C\r
24         for <notmuch@notmuchmail.org>; Mon, 12 Apr 2010 01:30:56 -0700 (PDT)\r
25 Received: by sspaeth.de (sSMTP sendmail emulation);\r
26         Mon, 12 Apr 2010 10:30:54 +0200\r
27 From: "Sebastian Spaeth" <Sebastian@SSpaeth.de>\r
28 To: Notmuch list <notmuch@notmuchmail.org>\r
29 Subject: Re: [PATCH] RFC: User-Agent header\r
30 In-Reply-To: <87hbnhprk0.fsf@SSpaeth.de>\r
31 References: <87iq821hba.fsf@SSpaeth.de> <87hbnhprk0.fsf@SSpaeth.de>\r
32 Date: Mon, 12 Apr 2010 10:30:54 +0200\r
33 Message-ID: <87y6gtnkch.fsf@SSpaeth.de>\r
34 User-Agent: notmuch version 0.1.1 (Emacs 23.1.1/x86_64-pc-linux-gnu)\r
35 MIME-Version: 1.0\r
36 Content-Type: text/plain; charset=us-ascii\r
37 X-BeenThere: notmuch@notmuchmail.org\r
38 X-Mailman-Version: 2.1.13\r
39 Precedence: list\r
40 List-Id: "Use and development of the notmuch mail system."\r
41         <notmuch.notmuchmail.org>\r
42 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
43         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
44 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
45 List-Post: <mailto:notmuch@notmuchmail.org>\r
46 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
47 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
48         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
49 X-List-Received-Date: Mon, 12 Apr 2010 08:30:59 -0000\r
50 \r
51 \r
52 OK, final post from me on this issue. This is what I am using in my\r
53 .emacs now. It does not clutter up the message compose window with a\r
54 User-Agent header as it is hidden by message mode. It is also not shown\r
55 by default in the notmuch-show modes but viewing the full headers\r
56 confirms that it is indeed being send. It works for "c-x m" and "m" in\r
57 notmuch-show mode, AND it also work for "r"eplies in notmuch-show mode.\r
58 \r
59 I put this in the message mode hook because we will then not call the\r
60 notmuch binary each time we start up emacs, but it will be dynamically\r
61 be created when message mode is invoked. Not sure if others have a\r
62 cleverer solution here.\r
63 \r
64 ;; set the User-Agent string whenever we invoke message mode\r
65 (add-hook 'message-mode-hook '(lambda()\r
66     ;; check if User-Agent is a required header and set it if not\r
67     (if (not (memq 'User-Agent message-required-mail-headers))\r
68         (setq message-required-mail-headers \r
69               (append message-required-mail-headers '(User-Agent))))\r
70     ;; hide the User-Agent header if not already hidden\r
71     (if (not (memq '"^User-Agent:" message-hidden-headers))\r
72         (setq message-hidden-headers \r
73               (append message-hidden-headers '("^User-Agent:"))))\r
74     ;; create user agent string\r
75     (let ((notmuch-user-agent (concat \r
76                                (substring (shell-command-to-string (concat notmuch-command " --version")) 0 -1)\r
77                                " (Emacs " emacs-version "/"\r
78                                 system-configuration ")")))\r
79       (setq message-newsreader notmuch-user-agent))\r
80 ))\r
81 \r
82 Sebastian\r