[PATCH] RFC: User-Agent header

2010-04-15 Thread Carl Worth
On Wed, 14 Apr 2010 09:44:16 +0200, "Sebastian Spaeth"  wrote:
> On 2010-04-13, Carl Worth wrote:
> > No, wait! I want more from you. :-)
> 
> Sigh, they always want more :-)

Sorry about that. :-)

> See the "sister mail" to this thread, in which I simply added the whole
> shebang to notmuch.el (not using a lambda function). Is that what you
> had in mind.

Yes, that looks pretty good. But David has some improvements in mind,
this feature was implemented after the 0.2 merge window closed, *and*
I've committed to David to not keep messing with the emacs code before
merging in his outstanding changes.

So I'm going to wait on this for now at least.

> Is that "version" really needed, BTW? Why can't notmuch --version not just 
> say:
> notmuch 0.1-107-g553feae

Good point. I think I was imitating the "git --version" output or
something. I can't give any reason for this though. I'll fix this.

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 



[PATCH] RFC: User-Agent header

2010-04-14 Thread Sebastian Spaeth
On 2010-04-13, Carl Worth wrote:
> > OK, final post from me on this issue.
> No, wait! I want more from you. :-)

Sigh, they always want more :-)

> Would you care to put together a solution that does this from within
> notmuch*.el ? I really want things usable by default without people
> having to hack up their .emacs files.

See the "sister mail" to this thread, in which I simply added the whole
shebang to notmuch.el (not using a lambda function). Is that what you
had in mind. Mind you, my elisp knowledge borders close to 0, so I would
be surprised if I did not botch up things. However, I have tested the
patch, and the User-Agent header got inserted.

> Of course, we could also easily add a variable to make this not happen,
> (but that can be added in a follow-on patch by anyone).

Some don't want it, but it cannot be disabled in this patch, so that
would indeed need to be a followup patch.

This gets now inserted (message mode automatically wrapped the header
like this):
User-Agent: notmuch version 0.1-107-g553feae (Emacs
23.1.1/x86_64-pc-linux-gnu)

Is that an acceptable format? I would have preferred to not include the
"version" string, but notmuch --version spits that out, and it was just
easier to leave it in. 

Is that "version" really needed, BTW? Why can't notmuch --version not just say:
notmuch 0.1-107-g553feae

Sebastian


[PATCH] RFC: User-Agent header

2010-04-14 Thread Xavier Maillard
On Tue, 13 Apr 2010 10:44:03 -0700, Carl Worth  wrote:
> On Mon, 12 Apr 2010 10:30:54 +0200, "Sebastian Spaeth"  SSpaeth.de> wrote:
> > 
> > OK, final post from me on this issue.
> 
> No, wait! I want more from you. :-)
> 
> Would you care to put together a solution that does this from within
> notmuch*.el ? I really want things usable by default without people
> having to hack up their .emacs files.

+1

> Of course, we could also easily add a variable to make this not happen,
> (but that can be added in a follow-on patch by anyone).

+1

Xavier


[PATCH] RFC: User-Agent header

2010-04-13 Thread Carl Worth
On Mon, 12 Apr 2010 10:30:54 +0200, "Sebastian Spaeth"  wrote:
> 
> OK, final post from me on this issue.

No, wait! I want more from you. :-)

Would you care to put together a solution that does this from within
notmuch*.el ? I really want things usable by default without people
having to hack up their .emacs files.

Of course, we could also easily add a variable to make this not happen,
(but that can be added in a follow-on patch by anyone).

Thanks,

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 



Re: [PATCH] RFC: User-Agent header

2010-04-13 Thread Carl Worth
On Mon, 12 Apr 2010 10:30:54 +0200, Sebastian Spaeth sebast...@sspaeth.de 
wrote:
 
 OK, final post from me on this issue.

No, wait! I want more from you. :-)

Would you care to put together a solution that does this from within
notmuch*.el ? I really want things usable by default without people
having to hack up their .emacs files.

Of course, we could also easily add a variable to make this not happen,
(but that can be added in a follow-on patch by anyone).

Thanks,

-Carl


pgpSMRw949mzF.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] RFC: User-Agent header

2010-04-12 Thread Sebastian Spaeth

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


Re: [PATCH] RFC: User-Agent header

2010-04-12 Thread Sebastian Spaeth

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 replies 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
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch