unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#8530: 23.2; Button 'mouse-face property loses Bold and Italic properties
@ 2011-04-21  4:28 PJ Weisberg
  2011-04-21 10:06 ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: PJ Weisberg @ 2011-04-21  4:28 UTC (permalink / raw)
  To: 8530

(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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#8530: 23.2; Button 'mouse-face property loses Bold and Italic properties
  2011-04-21  4:28 bug#8530: 23.2; Button 'mouse-face property loses Bold and Italic properties PJ Weisberg
@ 2011-04-21 10:06 ` Eli Zaretskii
  2011-04-21 18:38   ` PJ Weisberg
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2011-04-21 10:06 UTC (permalink / raw)
  To: PJ Weisberg; +Cc: 8530

> Date: Wed, 20 Apr 2011 21:28:39 -0700
> From: PJ Weisberg <pj@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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#8530: 23.2; Button 'mouse-face property loses Bold and Italic properties
  2011-04-21 10:06 ` Eli Zaretskii
@ 2011-04-21 18:38   ` PJ Weisberg
  2011-04-21 19:24     ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: PJ Weisberg @ 2011-04-21 18:38 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 8530

On Thu, Apr 21, 2011 at 3:06 AM, Eli Zaretskii <eliz@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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#8530: 23.2; Button 'mouse-face property loses Bold and Italic properties
  2011-04-21 18:38   ` PJ Weisberg
@ 2011-04-21 19:24     ` Eli Zaretskii
  2011-04-21 20:05       ` Drew Adams
                         ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Eli Zaretskii @ 2011-04-21 19:24 UTC (permalink / raw)
  To: PJ Weisberg; +Cc: 8530

> Date: Thu, 21 Apr 2011 11:38:44 -0700
> From: PJ Weisberg <pj@irregularexpressions.net>
> Cc: 8530@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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#8530: 23.2; Button 'mouse-face property loses Bold and Italic properties
  2011-04-21 19:24     ` Eli Zaretskii
@ 2011-04-21 20:05       ` Drew Adams
  2011-05-11 15:17       ` PJ Weisberg
  2011-08-09 21:15       ` Chong Yidong
  2 siblings, 0 replies; 7+ messages in thread
From: Drew Adams @ 2011-04-21 20:05 UTC (permalink / raw)
  To: 'Eli Zaretskii', 'PJ Weisberg'; +Cc: 8530

> > 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.






^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#8530: 23.2; Button 'mouse-face property loses Bold and Italic properties
  2011-04-21 19:24     ` Eli Zaretskii
  2011-04-21 20:05       ` Drew Adams
@ 2011-05-11 15:17       ` PJ Weisberg
  2011-08-09 21:15       ` Chong Yidong
  2 siblings, 0 replies; 7+ messages in thread
From: PJ Weisberg @ 2011-05-11 15:17 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 8530@debbugs.gnu.org, PJ Weisberg

On Thursday, April 21, 2011, Eli Zaretskii <eliz@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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#8530: 23.2; Button 'mouse-face property loses Bold and Italic properties
  2011-04-21 19:24     ` Eli Zaretskii
  2011-04-21 20:05       ` Drew Adams
  2011-05-11 15:17       ` PJ Weisberg
@ 2011-08-09 21:15       ` Chong Yidong
  2 siblings, 0 replies; 7+ messages in thread
From: Chong Yidong @ 2011-08-09 21:15 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 8530, PJ Weisberg

Eli Zaretskii <eliz@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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-08-09 21:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-21  4:28 bug#8530: 23.2; Button 'mouse-face property loses Bold and Italic properties PJ Weisberg
2011-04-21 10:06 ` Eli Zaretskii
2011-04-21 18:38   ` PJ Weisberg
2011-04-21 19:24     ` Eli Zaretskii
2011-04-21 20:05       ` Drew Adams
2011-05-11 15:17       ` PJ Weisberg
2011-08-09 21:15       ` Chong Yidong

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).