unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: "Sebastian Spaeth" <Sebastian@SSpaeth.de>
To: Notmuch list <notmuch@notmuchmail.org>
Subject: Re: [PATCH] RFC: User-Agent header
Date: Mon, 12 Apr 2010 10:30:54 +0200	[thread overview]
Message-ID: <87y6gtnkch.fsf@SSpaeth.de> (raw)
In-Reply-To: <87hbnhprk0.fsf@SSpaeth.de>


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

  parent reply	other threads:[~2010-04-12  8:30 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-08  8:26 RFC: User-Agent header Sebastian Spaeth
2010-04-08 15:12 ` Dirk Hohndel
2010-04-10  2:55   ` Carl Worth
2010-04-10  4:43     ` Dirk Hohndel
2010-04-10 13:16     ` Jameson Rollins
2010-04-10 14:00     ` Sebastian Spaeth
2010-04-10 14:45       ` Dirk Hohndel
2010-04-10 14:02   ` Xavier Maillard
2010-04-11 22:12 ` Sebastian Spaeth
2010-04-12  5:45   ` David Edmondson
2010-04-12  8:30   ` Sebastian Spaeth [this message]
2010-04-13 17:44     ` [PATCH] " Carl Worth
2010-04-13 22:55       ` Xavier Maillard
2010-04-14  7:38       ` [PATCH 13/13] notmuch.el: Add a function to insert a notmuch user-agent header Sebastian Spaeth
2010-04-14  7:44         ` David Edmondson
2010-04-14  9:52           ` Sebastian Spaeth
2010-04-14  7:44       ` [PATCH] RFC: User-Agent header Sebastian Spaeth
2010-04-15 19:52         ` Carl Worth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y6gtnkch.fsf@SSpaeth.de \
    --to=sebastian@sspaeth.de \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

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 read-only IMAP folder(s) and NNTP newsgroup(s).