Subject: Re: bug#12817: 24.2; The button library does not work on the header line

From: Stefan Monnier <[email-masked]>
Date: Tue, 04 Dec 2012 15:19:46 -0500

> the button library does not work if a button is created on the header-line:

>   (require 'button)
>   (defun my-button-action (button)
>     (message "HERE I AM"))
>   (define-button-type 'my-button-type
>     'action #'my-button-action
>     'follow-link t)
>   (setq test-button (copy-sequence "CLICK ME"))
>   (make-text-button test-button nil
>                     'type 'my-button-type)
>   (setq header-line-format test-button)

> After evaluating these lines, a button appear with the text "CLICK ME"
> in blue and underlined. But clicking this button does nothing. I was
> expecting that clicking the button would trigger 'my-button-action and
> display the message "HERE I AM".

Sounds like a reasonable expectation.

> There is a library that makes 'button work on header-line: 
> https://raw.github.com/tarsius/header-button/master/header-button.el

Would someone be able to turn the above code into a patch to button.el
that makes your sample code work (i.e. make `make-text-button' work in
a header, instead of introducing an ad-hoc `header-button-format')?

        Stefan

PS: BTW, the "follow-link does not work here" comment points at
a misfeature of follow-link, indeed.  I think `follow-link' should be
implemented in function-key-map rather than in mouse-drag-region.