From: Damien Cassou <damien.cassou@gmail.com>
To: Jonas Bernoulli <jonas@bernoul.li>
Cc: 12817@debbugs.gnu.org
Subject: bug#12817: 24.2; The button library does not work on the header line
Date: Thu, 6 Dec 2012 08:38:01 +0100 [thread overview]
Message-ID: <CA+y5ggjcwUFq+q4gOGRwRCSk5S0s89AL=y1vmz+eOy7jYDaHtA@mail.gmail.com> (raw)
In-Reply-To: <87ehj4mdxo.fsf@bernoul.li>
[-- Attachment #1: Type: text/plain, Size: 2428 bytes --]
Thank you very much Jonas
Damien Cassou
http://damiencassou.seasidehosting.st
On Dec 5, 2012 9:39 PM, "Jonas Bernoulli" <jonas@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.
>
>
[-- Attachment #2: Type: text/html, Size: 2999 bytes --]
next prev parent reply other threads:[~2012-12-06 7:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-06 16:59 bug#12817: 24.2; The button library does not work on the header line Damien Cassou
2012-12-04 20:19 ` Stefan Monnier
2012-12-05 20:39 ` Jonas Bernoulli
2012-12-06 7:38 ` Damien Cassou [this message]
2012-12-06 20:11 ` Stefan Monnier
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://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CA+y5ggjcwUFq+q4gOGRwRCSk5S0s89AL=y1vmz+eOy7jYDaHtA@mail.gmail.com' \
--to=damien.cassou@gmail.com \
--cc=12817@debbugs.gnu.org \
--cc=jonas@bernoul.li \
/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://git.savannah.gnu.org/cgit/emacs.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).