Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 3ECA24196F2 for ; Mon, 12 Apr 2010 01:30:59 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.9 X-Spam-Level: X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=ham Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rKR0l-NmyyuS for ; Mon, 12 Apr 2010 01:30:58 -0700 (PDT) Received: from homiemail-a23.g.dreamhost.com (caiajhbdcaid.dreamhost.com [208.97.132.83]) by olra.theworths.org (Postfix) with ESMTP id 9098E431FC1 for ; Mon, 12 Apr 2010 01:30:58 -0700 (PDT) Received: from sspaeth.de (mtec-hg-docking-1-dhcp-204.ethz.ch [129.132.133.204]) by homiemail-a23.g.dreamhost.com (Postfix) with ESMTPA id A9A8E4B007C for ; Mon, 12 Apr 2010 01:30:56 -0700 (PDT) Received: by sspaeth.de (sSMTP sendmail emulation); Mon, 12 Apr 2010 10:30:54 +0200 From: "Sebastian Spaeth" To: Notmuch list Subject: Re: [PATCH] RFC: User-Agent header In-Reply-To: <87hbnhprk0.fsf@SSpaeth.de> References: <87iq821hba.fsf@SSpaeth.de> <87hbnhprk0.fsf@SSpaeth.de> Date: Mon, 12 Apr 2010 10:30:54 +0200 Message-ID: <87y6gtnkch.fsf@SSpaeth.de> User-Agent: notmuch version 0.1.1 (Emacs 23.1.1/x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Apr 2010 08:30:59 -0000 OK, final post from me on this issue. This is what I am using in my .emacs now. It does not clutter up the message compose window with a User-Agent header as it is hidden by message mode. It is also not shown by default in the notmuch-show modes but viewing the full headers confirms that it is indeed being send. It works for "c-x m" and "m" in notmuch-show mode, AND it also work for "r"eplies in notmuch-show mode. I put this in the message mode hook because we will then not call the notmuch binary each time we start up emacs, but it will be dynamically be created when message mode is invoked. Not sure if others have a cleverer solution here. ;; set the User-Agent string whenever we invoke message mode (add-hook 'message-mode-hook '(lambda() ;; check if User-Agent is a required header and set it if not (if (not (memq 'User-Agent message-required-mail-headers)) (setq message-required-mail-headers (append message-required-mail-headers '(User-Agent)))) ;; hide the User-Agent header if not already hidden (if (not (memq '"^User-Agent:" message-hidden-headers)) (setq message-hidden-headers (append message-hidden-headers '("^User-Agent:")))) ;; create user agent string (let ((notmuch-user-agent (concat (substring (shell-command-to-string (concat notmuch-command " --version")) 0 -1) " (Emacs " emacs-version "/" system-configuration ")"))) (setq message-newsreader notmuch-user-agent)) )) Sebastian