GNU bug report logs - #8530
23.2; Button 'mouse-face property loses Bold and Italic properties

Previous Next

Package: emacs;

Reported by: PJ Weisberg <pj <at> irregularexpressions.net>

Date: Thu, 21 Apr 2011 04:29:01 UTC

Severity: normal

Found in version 23.2

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 8530 in the body.
You can then email your comments to 8530 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8530; Package emacs. (Thu, 21 Apr 2011 04:29:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to PJ Weisberg <pj <at> irregularexpressions.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 21 Apr 2011 04:29:01 GMT) Full text and rfc822 format available.

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

From: PJ Weisberg <pj <at> irregularexpressions.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 23.2; Button 'mouse-face property loses Bold and Italic properties
Date: Wed, 20 Apr 2011 21:28:39 -0700
(defun buggy-button()
  (interactive)
  (insert-text-button "MyButton"
		      'face 'font-lock-function-name-face
		      'mouse-face 'font-lock-warning-face))

Evaluate that, then call buggy-button to insert a button.

font-lock-function-name-face is blue
font-lock-warning-face is red/bold

The button that was inserted has a blue face, but when you hold the
mouse over it it turns red, but not bold.

The manual says that mouse-face is "merged with the usual button face",
so I expected this:

(defun buggy-button()
  (interactive)
  (insert-text-button "MyButton"
		      'face 'font-lock-function-name-face
		      'mouse-face 'bold-italic))

To result in a button that is blue, bold, and italic when the mouse is
over it.  Instead, I get a button that goes back to the default face
when the mouse is over it.


In GNU Emacs 23.2.1 (i486-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2010-12-11 on raven, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.10905000
configured using `configure  '--build' 'i486-linux-gnu' '--build'
'i486-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/emacs23:/etc/emacs:/usr/local/share/emacs/23.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.2/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.2/leim'
'--with-x=yes' '--with-x-toolkit=lucid' '--with-toolkit-scroll-bars'
'--without-gconf' 'build_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g
-O2' 'LDFLAGS=-g' 'CPPFLAGS=''

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: Text

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-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<return> <return> <return> <help-echo> <down-mouse-1>
<mouse-1> <help-echo> <down-mouse-5> <mouse-5> <down-mouse-5>
<mouse-5> <double-down-mouse-5> <double-mouse-5> <down-mouse-5>
<mouse-5> <down-mouse-5> <mouse-5> <down-mouse-5> <mouse-5>
<down-mouse-5> <mouse-5> <down-mouse-5> <mouse-5> <help-echo>
<down-mouse-5> <mouse-5> <double-down-mouse-5> <double-mouse-5>
<down-mouse-5> <mouse-5> <double-down-mouse-5> <double-mouse-5>
<down-mouse-5> <mouse-5> <down-mouse-5> <mouse-5> <down-mouse-5>
<mouse-5> <down-mouse-5> <mouse-5> <double-down-mouse-5>
<double-mouse-5> <down-mouse-5> <mouse-5> <down-mouse-5>
<mouse-5> <down-mouse-5> <mouse-5> <help-echo> <down-mouse-1>
<mouse-1> C-k C-k C-k C-k C-k C-k c u s t o m - v a
r i a b l e - b u t t o n ) ) C-x C-e <return> <return>
M-x b u g g y <return> <return> <return> <help-echo>
<up> <up> C-k <backspace> <backspace> <help-echo> <down-mouse-5>
<mouse-5> <down-mouse-5> <mouse-5> <down-mouse-5> <mouse-5>
<double-down-mouse-5> <double-mouse-5> <down-mouse-5>
<mouse-5> <double-down-mouse-5> <double-mouse-5> <down-mouse-5>
<mouse-5> <down-mouse-5> <mouse-5> <down-mouse-1> <mouse-1>
<next> <down> <down> <down> <down> <down> <down> <left>
<left> <return> <return> <right> <right> <down> <down>
<up> <left> <up> <left> <return> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <up>
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up>
<up> <up> <up> <up> <up> <up> <up> <down> <left> <return>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <next> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <left> <left> <return>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> C-x o <left>
<left> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> f o n t - l o c
k - w a r n i n g - f a c e C-e C-x C-e <return> <return>
M-x b u g g y <return> <return> <return> <help-echo>
<help-echo> <help-echo> M-x r e p o r t SPC e m a c
s SPC b u g <return>

Recent messages:
buggy
Quit
buggy
Making completion list...
Quit
Mark set
buggy [2 times]
Creating face editor...done
Creating face editor...done
Creating face editor...done
buggy

Load-path shadows:
/usr/share/emacs/23.2/site-lisp/debian-startup hides
/usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs/23.2/site-lisp/html-helper-mode/tempo hides
/usr/share/emacs/23.2/lisp/tempo
/usr/share/emacs/23.2/site-lisp/dictionaries-common/flyspell hides
/usr/share/emacs/23.2/lisp/textmodes/flyspell
/usr/share/emacs/23.2/site-lisp/dictionaries-common/ispell hides
/usr/share/emacs/23.2/lisp/textmodes/ispell
/usr/share/emacs/23.2/site-lisp/css-mode/css-mode hides
/usr/share/emacs/23.2/lisp/textmodes/css-mode

Features:
(shadow sort mail-extr message sendmail regexp-opt ecomplete rfc822 mml
mml-sec password-cache mm-decode mm-bodies mm-encode mailcap mail-parse
rfc2231 rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader gnus-util
netrc time-date mm-util mail-prsvr gmm-utils mailheader canlock sha1
hex-util hashcash mail-utils emacsbug pp debug multi-isearch help-mode
view help-fns crm thingatpt cus-edit easymenu cus-start cus-load
wid-edit tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd
font-setting tool-bar dnd fontset image fringe lisp-mode register page
menu-bar rfn-eshadow timer select scroll-bar mldrag 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 loaddefs button
minibuffer faces cus-face files text-properties overlay md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process dbusbind font-render-setting x-toolkit x
multi-tty emacs)

-PJ




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8530; Package emacs. (Thu, 21 Apr 2011 10:07:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: PJ Weisberg <pj <at> irregularexpressions.net>
Cc: 8530 <at> debbugs.gnu.org
Subject: Re: bug#8530: 23.2;
	Button 'mouse-face property loses Bold and Italic properties
Date: Thu, 21 Apr 2011 13:06:56 +0300
> Date: Wed, 20 Apr 2011 21:28:39 -0700
> From: PJ Weisberg <pj <at> irregularexpressions.net>
> 
> (defun buggy-button()
>   (interactive)
>   (insert-text-button "MyButton"
> 		      'face 'font-lock-function-name-face
> 		      'mouse-face 'font-lock-warning-face))
> 
> Evaluate that, then call buggy-button to insert a button.
> 
> font-lock-function-name-face is blue
> font-lock-warning-face is red/bold
> 
> The button that was inserted has a blue face, but when you hold the
> mouse over it it turns red, but not bold.
> 
> The manual says that mouse-face is "merged with the usual button face",
> so I expected this:
> 
> (defun buggy-button()
>   (interactive)
>   (insert-text-button "MyButton"
> 		      'face 'font-lock-function-name-face
> 		      'mouse-face 'bold-italic))
> 
> To result in a button that is blue, bold, and italic when the mouse is
> over it.  Instead, I get a button that goes back to the default face
> when the mouse is over it.

Well, "merged with the usual button face" for some value of "merge"...
We never use any information from the mouse-face except its colors.
So we currently don't support bold and italic attributes in that face;
they are simply ignored.

We could close this bug report, or we could leave it open as a
wishlist.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8530; Package emacs. (Thu, 21 Apr 2011 18:40:03 GMT) Full text and rfc822 format available.

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

From: PJ Weisberg <pj <at> irregularexpressions.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 8530 <at> debbugs.gnu.org
Subject: Re: bug#8530: 23.2;
	Button 'mouse-face property loses Bold and Italic properties
Date: Thu, 21 Apr 2011 11:38:44 -0700
On Thu, Apr 21, 2011 at 3:06 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> Well, "merged with the usual button face" for some value of "merge"...
> We never use any information from the mouse-face except its colors.
> So we currently don't support bold and italic attributes in that face;
> they are simply ignored.
>
> We could close this bug report, or we could leave it open as a
> wishlist.

Well, it's not *only* the colors, since the "box" property is
respected.  It seems odd that some properties are used and some are
ignored.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8530; Package emacs. (Thu, 21 Apr 2011 19:25:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: PJ Weisberg <pj <at> irregularexpressions.net>
Cc: 8530 <at> debbugs.gnu.org
Subject: Re: bug#8530: 23.2;
	Button 'mouse-face property loses Bold and Italic properties
Date: Thu, 21 Apr 2011 15:24:24 -0400
> Date: Thu, 21 Apr 2011 11:38:44 -0700
> From: PJ Weisberg <pj <at> irregularexpressions.net>
> Cc: 8530 <at> debbugs.gnu.org
> 
> Well, it's not *only* the colors, since the "box" property is
> respected.  It seems odd that some properties are used and some are
> ignored.

Well, the font is explicitly ignored, at least in my reading of the
code.  Maybe that's because mouse-face was intended to _highlight_ the
text, not redraw it in some entirely different face.  Or maybe there
are other reasons, or even no particular reason at all.  I don't know.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8530; Package emacs. (Thu, 21 Apr 2011 20:06:02 GMT) Full text and rfc822 format available.

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

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Eli Zaretskii'" <eliz <at> gnu.org>,
	"'PJ Weisberg'" <pj <at> irregularexpressions.net>
Cc: 8530 <at> debbugs.gnu.org
Subject: RE: bug#8530: 23.2;
	Button 'mouse-face property loses Bold and Italic properties
Date: Thu, 21 Apr 2011 13:05:23 -0700
> > Well, it's not *only* the colors, since the "box" property is
> > respected.  It seems odd that some properties are used and some are
> > ignored.

Underlining, as well.  I use underlining for `mouse-face' in some buffers that
have essentially tabular data (e.g. Dired, grep).  I put the (underline)
`mouse-face' property on the whole line, to make it easier to choose from any
column and easier on visual scanning (same reason you might employ zebra
striping: to be able to easily see what's in the same row/line).
 
> Well, the font is explicitly ignored, at least in my reading of the
> code.  Maybe that's because mouse-face was intended to _highlight_ the
> text, not redraw it in some entirely different face.  Or maybe there
> are other reasons, or even no particular reason at all.  I don't know.

From a user point of view it is a bug, IMO.  Regardless of what an Emacs
developer might foresee as the only reasonable settings, a user should be able
to set `mouse-face' to any face or any set of face properties and have that
setting be manifested.





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8530; Package emacs. (Wed, 11 May 2011 15:18:01 GMT) Full text and rfc822 format available.

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

From: PJ Weisberg <pj <at> irregularexpressions.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: "8530 <at> debbugs.gnu.org" <8530 <at> debbugs.gnu.org>,
	PJ Weisberg <pj <at> irregularexpressions.net>
Subject: Re: bug#8530: 23.2;
	Button 'mouse-face property loses Bold and Italic properties
Date: Wed, 11 May 2011 08:17:07 -0700
On Thursday, April 21, 2011, Eli Zaretskii <eliz <at> gnu.org> wrote:
> Well, the font is explicitly ignored, at least in my reading of the
> code.  Maybe that's because mouse-face was intended to _highlight_ the
> text, not redraw it in some entirely different face.  Or maybe there
> are other reasons, or even no particular reason at all.  I don't know.
>

FWIW, as a user I consider adding bold and/or italic properties a more
subtle change than changing the color, even though as a developer I
know that they're implemented as separate fonts.  (Which is why I have
the magit-item-highlight face customized to bold+italic, and therefore
noticed when adding it as a mouse-face to a section didn't have the
same effect as highlighting the section by moving the point into it.)

-- 

-PJ




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8530; Package emacs. (Tue, 09 Aug 2011 21:17:02 GMT) Full text and rfc822 format available.

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

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 8530 <at> debbugs.gnu.org, PJ Weisberg <pj <at> irregularexpressions.net>
Subject: Re: bug#8530: 23.2;
	Button 'mouse-face property loses Bold and Italic properties
Date: Tue, 09 Aug 2011 17:15:19 -0400
Eli Zaretskii <eliz <at> gnu.org> writes:

> the font is explicitly ignored, at least in my reading of the code.
> Maybe that's because mouse-face was intended to _highlight_ the text,
> not redraw it in some entirely different face.  Or maybe there are
> other reasons, or even no particular reason at all.

Here is one reason:

- Move the mouse cursor over some text with a mouse face.
- Mouse face activates.
- Mouse face has a smaller font, so the text shrinks in size.
- The text is no longer under the mouse cursor.
- Mouse face should not be active.
- ????

I have added a note to the Lisp manual that the mouse-face can't be used
to change the text size.




bug closed, send any further explanations to 8530 <at> debbugs.gnu.org and PJ Weisberg <pj <at> irregularexpressions.net> Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> debbugs.gnu.org. (Tue, 09 Aug 2011 21:17:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 07 Sep 2011 11:24:03 GMT) Full text and rfc822 format available.

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

Previous Next


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