--- Begin Message ---
Subject: |
24.2; The button library does not work on the header line |
Date: |
Tue, 06 Nov 2012 17:59:35 +0100 |
Hi,
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".
There is a library that makes 'button work on header-line:
https://raw.github.com/tarsius/header-button/master/header-button.el
Thank you
In GNU Emacs 24.2.1 (i686-pc-linux-gnu, GTK+ Version 2.24.13)
of 2012-11-06 on dubnium, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11300000
Configured using:
`configure '--build' 'i686-linux-gnu' '--build' 'i686-linux-gnu'
'--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib'
'--localstatedir=/var/lib' '--infodir=/usr/share/info'
'--mandir=/usr/share/man' '--with-pop=yes'
'--enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.2/site-lisp:/usr/share/emacs/site-lisp'
'--with-crt-dir=/usr/lib/i386-linux-gnu' '--with-x=yes'
'--with-x-toolkit=gtk' '--with-toolkit-scroll-bars'
'build_alias=i686-linux-gnu' 'CFLAGS=-g -O2 -fstack-protector
--param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall'
'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro'
'CPPFLAGS=-D_FORTIFY_SOURCE=2''
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: en_US.UTF-8
value of $XMODIFIERS: nil
locale-coding-system: utf-8-unix
default enable-multibyte-characters: t
Major mode: Lisp Interaction
Minor modes in effect:
tooltip-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Recent input:
<help-echo> <down-mouse-1> <mouse-1> <down-mouse-4>
<mouse-4> <double-down-mouse-4> <double-mouse-4> <triple-down-mouse-4>
<triple-mouse-4> C-n C-n C-n C-n C-n C-n C-n C-n C-n
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-M-x C-l C-l
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-M-x C-n
C-n C-n C-n C-n C-n C-n C-n C-M-x C-n C-l C-l C-n C-n
C-n C-n C-n C-a C-SPC M-> C-w C-y M-y C-p C-k C-M-x
C-y C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p
C-p C-p C-p C-p C-l C-a C-SPC C-n C-n C-f C-f C-x r
k C-p C-p <tab> C-n <tab> C-n <tab> M-v M-v C-v C-v
C-l C-p C-p C-p C-e C-n C-a C-k C-n C-SPC C-n C-n C-f
C-f C-f C-x r k C-p <tab> C-n <tab> C-e C-x C-e q C-p
C-p C-p C-p C-x C-e C-n C-n C-n C-n C-e C-x C-e <help-echo>
<down-mouse-1> <mouse-1> <down-mouse-1> <mouse-1> <help-echo>
<down-mouse-1> <mouse-1> C-n C-n C-n C-n C-a C-SPC
C-n C-n C-n C-f C-f C-f C-x r k C-e C-x C-e <help-echo>
<help-echo> <help-echo> <down-mouse-1> <mouse-1> <help-echo>
<down-mouse-4> <mouse-4> <down-mouse-4> <mouse-4> <down-mouse-4>
<mouse-4> <down-mouse-4> <mouse-4> <down-mouse-4> <mouse-4>
<down-mouse-4> <mouse-4> <double-down-mouse-4> <double-mouse-4>
<triple-down-mouse-4> <triple-mouse-4> <triple-down-mouse-4>
<triple-mouse-4> <down-mouse-1> <mouse-movement> <drag-mouse-1>
C-x 1 <down-mouse-1> <mouse-movement> <mouse-1> <help-echo>
<down-mouse-1> <mouse-1> <help-echo> <down-mouse-1>
<mouse-1> <help-echo> <down-mouse-1> <mouse-1> <help-echo>
<down-mouse-1> <mouse-1> <help-echo> <down-mouse-1>
<mouse-1> <help-echo> <down-mouse-5> <mouse-5> <double-down-mouse-5>
<double-mouse-5> <triple-down-mouse-5> <triple-mouse-5>
<down-mouse-1> <mouse-1> <down-mouse-1> <mouse-1> C-p
C-p C-SPC C-p C-p C-p C-p C-a C-w C-x C-o C-n C-SPC
M-> <f2> <f2> <f2> C-x 1 C-x 1 C-p C-p C-p <tab> C-n
<tab> C-n <tab> <down-mouse-1> <mouse-1> C-h k <f2>
<f2> C-x 1 <down-mouse-1> <mouse-1> C-l <down-mouse-1>
<mouse-movement> <drag-mouse-1> M-x r e p o r t - e
m a <tab> <tab> <return>
Recent messages:
This button labeled `No me!' belongs to category `my-header-button'
byte-code: Beginning of buffer
Mark set
This button labeled `Click me!' belongs to category `header-button' [2 times]
This button labeled `No me!' belongs to category `my-header-button'
Mark set [2 times]
Autoscrolling is on.
Type C-x 1 to delete the help window.
Mark set
Making completion list...
Load-path shadows:
/usr/share/emacs/24.2/site-lisp/cmake-data/cmake-mode hides
/usr/share/emacs/site-lisp/cmake-mode
/usr/share/emacs/24.2/site-lisp/dictionaries-common/flyspell hides
/usr/share/emacs/24.2/lisp/textmodes/flyspell
/usr/share/emacs/24.2/site-lisp/dictionaries-common/ispell hides
/usr/share/emacs/24.2/lisp/textmodes/ispell
Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail regexp-opt rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils two-column debug rect help-mode view
help-fns find-func jka-compr info easymenu edmacro kmacro cl time-date
tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar
dnd fontset image fringe lisp-mode register page menu-bar rfn-eshadow
timer select scroll-bar mouse jit-lock font-lock syntax facemenu
font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan
thai tai-viet lao korean japanese hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
cus-face files text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote
make-network-process dbusbind dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#12817: 24.2; The button library does not work on the header line |
Date: |
Thu, 06 Dec 2012 15:11:30 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
> 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.
Thanks, installed, after simplifying it a bit to just use STRING rather
than (STRING . STRING-POS).
Stefan
--- End Message ---