GNU bug report logs - #12817
24.2; The button library does not work on the header line

Previous Next

Package: emacs;

Reported by: Damien Cassou <damien.cassou <at> gmail.com>

Date: Tue, 6 Nov 2012 17:05:01 UTC

Severity: normal

Found in version 24.2

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


Message #14 received at 12817 <at> debbugs.gnu.org (full text, mbox):

From: Damien Cassou <damien.cassou <at> gmail.com>
To: Jonas Bernoulli <jonas <at> bernoul.li>
Cc: 12817 <at> debbugs.gnu.org
Subject: Re: bug#12817: 24.2;
	The button library does not work on the header line
Date: Thu, 6 Dec 2012 08:38:01 +0100
[Message part 1 (text/plain, inline)]
Thank you very much Jonas

Damien Cassou
http://damiencassou.seasidehosting.st
On Dec 5, 2012 9:39 PM, "Jonas Bernoulli" <jonas <at> bernoul.li> wrote:

> The attached patch allows inserting buttons into the header-line as well
> as the mode-line.  I haven't tested it much but it appears to work.
>
> As you suggested it doesn't use a function such as
> `header-button-format'.  Instead `make-text-button' was changed to
> return a useful value when BEG is a string: the propertized string.
>
> ,----
> | (setq header-line-format
> |       (make-text-button "test" nil
> |                         'action (lambda (button)
> |                                   (message "Button: %s" button))))
> `----
>
> The above is enough now to insert a button in the header-line or
> mode-line.  No need for an intermediate variable to hold the string.
> Additionally the following changes are needed so that clicking the
> button actually does something.
>
> Add an additional kind of "button object" that is used internally and
> passed to the button action function: "area buttons" (analogously to
> `posn-area').  Normally these have the form (STRING . STRING-POS), where
> STRING is the propertized string and STRING-POS is list of the form
> returned by `event-start'.  STRING-POS might be useful in actions but
> isn't used internally.  Area button objects can also be just a string.
>
> [mode-line mouse-2] and [header-line mouse-2] are bound to push-button
> just like [mouse-2].  [follow-link] is not actually used at all.  (I
> think it was used instead of [mouse-2] in the past, but I might be
> wrong).
>
> I don't know whether binding these events might cause problems for
> regular buttons, but it does not appear to be the case.
>
> (Maybe using follow-link instead and extending it to work in the
> header-line and mode-line would be better; but I know to little about
> that.  The little I do know tells me doing so would probably not be
> worth the effort.)
>
> `push-button', `button-get', `button-put', `button-label' are taught to
> deal with area buttons.  Using `button-start', `button-end' and
> `button-at' with an area button causes an error.  Of the "button
> creating functions" only `make-text-button' is useful for area buttons.
> `[next|previous|forward|backward]-button' also cannot be used.
>
> The patch is against 24.3.50 from a few days ago but if necessary I can
> redo it against a different version.
>
>
[Message part 2 (text/html, inline)]

This bug report was last modified 12 years and 229 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.