unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* can we please define a face for compile.el mouseover?
@ 2011-02-15 19:26 Drew Adams
  2011-02-15 19:42 ` Eli Zaretskii
  2011-02-15 21:12 ` Stefan Monnier
  0 siblings, 2 replies; 9+ messages in thread
From: Drew Adams @ 2011-02-15 19:26 UTC (permalink / raw)
  To: emacs-devel

Can we please define a face to be used for the `mouse-face' property in the
`compile.el' code?

It doesn't make sense to hard-code `highlight' in this code.  For a user to be
able to use a different face for mouseover s?he needs to duplicate EACH of the
following function definitions and then simply replace `highlight' in the code
by a face specific to compilation and grep:

 compilation-directory-properties
 compilation-internal-error-properties
 compilation-(-)compat-error-properties
   (`--' for Emacs 24; else `-')

And if the user wants the fix to work also for other Emacs releases, then s?he
needs to duplicate and tweak the definitions twice (the Emacs 24 code is
different, including the above function renaming).

That's silly.  Users should be able to just customize the face used for
mouseover highlighting.  Example face definition:

(defface compilation-mouseover '((t (:inherit highlight)))
  "Face used to highlight text the mouse is over in compilation modes."
  :group 'compilation :group 'font-lock-highlighting-faces)

I've requested this before, but it's always been resisted or ignored.  I see no
reason not to let users customize this.  (We DTRT for mode-line mouseover, BTW:
we define face `mode-line-highlight'.)






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

* Re: can we please define a face for compile.el mouseover?
  2011-02-15 19:26 can we please define a face for compile.el mouseover? Drew Adams
@ 2011-02-15 19:42 ` Eli Zaretskii
  2011-02-15 22:43   ` Drew Adams
  2011-02-15 21:12 ` Stefan Monnier
  1 sibling, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2011-02-15 19:42 UTC (permalink / raw)
  To: Drew Adams; +Cc: emacs-devel

> From: "Drew Adams" <drew.adams@oracle.com>
> Date: Tue, 15 Feb 2011 11:26:45 -0800
> 
> Can we please define a face to be used for the `mouse-face' property in the
> `compile.el' code?
> 
> It doesn't make sense to hard-code `highlight' in this code.

Is there any code in Emacs that does _not_ use `highlight' for
mouse-face?

If not (or if the other cases are a very small minority), this should
probably be fixed for Emacs in general, not just in compile.el.

Also, someone should perhaps see if using arbitrary faces for mouse
highlight will not be too dangerous (given how this is implemented in
the display engine), before we allow to customize it.



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

* Re: can we please define a face for compile.el mouseover?
  2011-02-15 19:26 can we please define a face for compile.el mouseover? Drew Adams
  2011-02-15 19:42 ` Eli Zaretskii
@ 2011-02-15 21:12 ` Stefan Monnier
  2011-02-15 22:41   ` Drew Adams
  1 sibling, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2011-02-15 21:12 UTC (permalink / raw)
  To: Drew Adams; +Cc: emacs-devel

> Can we please define a face to be used for the `mouse-face' property in the
> `compile.el' code?

Why do you want a different mouse-face in compile.el than elsewhere?

> It doesn't make sense to hard-code `highlight' in this code.
> For a user to be able to use a different face for mouseover s?he needs
> to duplicate EACH of the

Actually, you should be able to do it cleanly using face-remapping.


        Stefan



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

* RE: can we please define a face for compile.el mouseover?
  2011-02-15 21:12 ` Stefan Monnier
@ 2011-02-15 22:41   ` Drew Adams
  2011-02-16  2:32     ` Stefan Monnier
  0 siblings, 1 reply; 9+ messages in thread
From: Drew Adams @ 2011-02-15 22:41 UTC (permalink / raw)
  To: 'Stefan Monnier'; +Cc: emacs-devel

> > Can we please define a face to be used for the `mouse-face' 
> > property in the `compile.el' code?
> 
> Why do you want a different mouse-face in compile.el than elsewhere?

I want users to _be able_ to customize mouseover appearance differently in one
context from another.  I don't want to _require_ them to use different faces any
more than I want to require them to use the same face (the case today, and not
even customizable).

In my own case, I want mouseover in compilation/grep buffers to just underline
the text.  But I generally want mouseover to use face `highlight' elsewhere.
And on the mode line I want it to use face `mode-line-highlight' - which it does
(that's a raised box BTW - it has no relation to the mouseover appearance
elsewhere).

I also apply `mouse-face' to the whole grep/compilation line, but that's just
me.  I believe that users should get visual feedback indicating that they can
click anywhere on the line.  Also, mousing over the line anywhere (e.g. far off
to the right) highlights (underlines) the whole line, making it easy to visually
scan rows (like using a ruler) - it's especially useful with sparse table data
or code.

And of course I've mentioned all of this umpteen times in the past...
But thanks for asking. ;-)

> > It doesn't make sense to hard-code `highlight' in this code.
> > For a user to be able to use a different face for mouseover 
> > s?he needs to duplicate EACH of the
> 
> Actually, you should be able to do it cleanly using face-remapping.

Users should be able to do it by _customizing_ the particular face used for
mouseover in the particular context.  Why complicate things unnecessarily?  One
might be able to use face remapping here and there all over the place to
simulate face customization, but why?

If you think two particular contexts are similar a priori, then define their
mouseover faces to inherit the same way - same default appearance.  But at least
let the user customize them to look different if that's what s?he wants.




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

* RE: can we please define a face for compile.el mouseover?
  2011-02-15 19:42 ` Eli Zaretskii
@ 2011-02-15 22:43   ` Drew Adams
  0 siblings, 0 replies; 9+ messages in thread
From: Drew Adams @ 2011-02-15 22:43 UTC (permalink / raw)
  To: 'Eli Zaretskii'; +Cc: emacs-devel

> Is there any code in Emacs that does _not_ use `highlight' for
> mouse-face?

Yes.  Didn't I mention face `mode-line-highlight' explicitly?

> If not (or if the other cases are a very small minority), this should
> probably be fixed for Emacs in general, not just in compile.el.

IMO, it should not be fixed by imposing one single mouseover face for all of
Emacs.  That would only let you customize it one way for all contexts.  That
would make it impossible to customize different faces for the different contexts
(duh).  Why force users to use the same face for mode-line and grep mouseover
highlighting?

Most mouseover highlighting is for short sections of text such as names.  Some
mouseover highlighting is for things like buttons - and Emacs already uses
different faces here (in some cases hard-coded - see `mpc-volume-widget' for
instance; in other cases, such as the mode line, customizable).  And some
mouseover is for a whole text line or table row (I use that for grep, for
instance).

Those are different highlighting contexts and can reasonably call for different
highlighting appearances.  At least users can be given the possibility.

There is nothing wrong with defining one face for mouseover for compilation/grep
and another face for mouseover on the mode line, and having them both inherit
from the same face (or not).  Attempting to boil all mouseover highlighting down
to the same face would be misguided - only one step above hard-coding
`highlight' all over the place.

In my case, speaking as one user, I want most mouseover to use `highlight', but
for the mode line I want it to use `mode-line-highlight' (which it does), and
for compilation/grep I want it to use another highlighting style altogether (in
my case it just underlines).

I've grepped for `mouse-face' in the Emacs source code, and those three are the
only contexts that I use where I would want to customize the face used for
mouseover.  But other people use libraries that I don't use, and perhaps they
would suggest additional places to define a new face.  If not, then let's just
add a mouseover face for compile.el.

> Also, someone should perhaps see if using arbitrary faces for mouse
> highlight will not be too dangerous (given how this is implemented in
> the display engine), before we allow to customize it.

Dangerous?  I've been customizing it exactly the way I said for decades (using
face `compilation-mouseover').  Not only that, I put the `mouse-face' property
on the whole grep line, not just on the file name+lineno part.  And I have never
seen any problem, display or otherwise (even with huge grep buffers).




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

* Re: can we please define a face for compile.el mouseover?
  2011-02-15 22:41   ` Drew Adams
@ 2011-02-16  2:32     ` Stefan Monnier
  2011-02-16  4:03       ` Drew Adams
  0 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2011-02-16  2:32 UTC (permalink / raw)
  To: Drew Adams; +Cc: emacs-devel

>> > Can we please define a face to be used for the `mouse-face' 
>> > property in the `compile.el' code?
>> Why do you want a different mouse-face in compile.el than elsewhere?
> I want users to _be able_ to customize mouseover appearance
> differently in one context from another.  I don't want to _require_
> them to use different faces any more than I want to require them to
> use the same face (the case today, and not even customizable).

I understand, the question is about *you* as a user.

> In my own case, I want mouseover in compilation/grep buffers to just
> underline the text.  But I generally want mouseover to use face
> `highlight' elsewhere.

So, can you explain why?  Also, is that really the only case where you
want mouse-face to look different?

> Users should be able to do it by _customizing_ the particular face
> used for mouseover in the particular context.  Why complicate things
> unnecessarily?  One might be able to use face remapping here and there
> all over the place to simulate face customization, but why?

Because adding umpteen customization variables for all the cases where
some user might want to change a face makes no sense.  So if there's
a good reason why this particular case is likely to happen to many
users, a customization variable might be justified, but otherwise having
a generic solution (e.g. face-remapping) seems quite sufficient.


        Stefan



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

* RE: can we please define a face for compile.el mouseover?
  2011-02-16  2:32     ` Stefan Monnier
@ 2011-02-16  4:03       ` Drew Adams
  2011-02-19 21:11         ` Stefan Monnier
  0 siblings, 1 reply; 9+ messages in thread
From: Drew Adams @ 2011-02-16  4:03 UTC (permalink / raw)
  To: 'Stefan Monnier'; +Cc: emacs-devel

> >> > Can we please define a face to be used for the `mouse-face' 
> >> > property in the `compile.el' code?
> >>
> >> Why do you want a different mouse-face in compile.el than 
> >> elsewhere?
> >
> > I want users to _be able_ to customize mouseover appearance
> > differently in one context from another.  I don't want to _require_
> > them to use different faces any more than I want to require them to
> > use the same face (the case today, and not even customizable).
> 
> I understand, the question is about *you* as a user.

No, you apparently do not understand.  It is not about me.
Or you.  We have different views of users and customizing faces.

> > In my own case, I want mouseover in compilation/grep buffers to just
> > underline the text.  But I generally want mouseover to use face
> > `highlight' elsewhere.
> 
> So, can you explain why?

I did.  Both in my last reply and previously.

When mouse-face highlighting is on a full line I find simple underlining better
than a flashy background.  That's my preference, but the point is that mouseover
highlighting on a long line has a different effect visually than it does on a
short name or a button.

It's about different classes of text that are highlighted - different use
contexts.  I mentioned (a) short text such as names, (b) long text such as table
rows and code lines, (c) buttons, and (d) mode-line constructs (treated
generally as buttons, but worth treating as a separate case - as they in fact
are).

There are perhaps other common classes, but those are the ones where I see a use
for a separately customizable face.  Today, the _only_ customizable mouseover
face is for (d).  And the only additional one I explicitly requested is for
compile.el.

> Also, is that really the only case where you
> want mouse-face to look different?

No.  See what I wrote, including just above.  Mouseover is already different for
the mode line.  And that's a good thing.

> > Users should be able to do it by _customizing_ the particular face
> > used for mouseover in the particular context.  Why complicate things
> > unnecessarily?  One might be able to use face remapping here and
> > there all over the place to simulate face customization, but why?
> 
> Because adding umpteen customization variables for all the cases where
> some user might want to change a face makes no sense.

No one said anything about adding umpteen variables (or faces, ahem).  And no
one said anything about adding such for every user who might want to change a
face.  There is no call for hyperbole.

> So if there's a good reason why this particular case is likely to
> happen to many users, a customization variable might be justified, but 
> otherwise having a generic solution (e.g. face-remapping) seems quite
> sufficient.

Sigh.  Same song you've sung previously to defend hard-coding `highlight'...




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

* Re: can we please define a face for compile.el mouseover?
  2011-02-16  4:03       ` Drew Adams
@ 2011-02-19 21:11         ` Stefan Monnier
  2011-02-19 21:32           ` Chong Yidong
  0 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2011-02-19 21:11 UTC (permalink / raw)
  To: Drew Adams; +Cc: emacs-devel

> When mouse-face highlighting is on a full line I find simple
> underlining better than a flashy background.  That's my preference,
> but the point is that mouseover highlighting on a long line has
> a different effect visually than it does on a short name or a button.

I see what you mean and I partly agree.  So part of the reason you want
a different face is because you mouse-highlight the whole line.
But admittedly, the regexps we use in compile.el seem to cover
potentially long chunks of text, even without extending them to cover
the whole line.  Maybe we should add a new face `long-highlight',
inheriting from highlight and use it in compilation, or on the contrary
maybe we should try and reduce the size of the mouse-highlighted text.

> rows and code lines, (c) buttons, and (d) mode-line constructs (treated
> generally as buttons, but worth treating as a separate case - as they in
> fact are).

BTW, the reason why mode-line-highlight is different is very simple: the
mode-line face is very different from the default face, so using
`highlight' for mouse-over on the mode line looks bad in most
configurations, including the default one.

>> So if there's a good reason why this particular case is likely to
>> happen to many users, a customization variable might be justified, but 
>> otherwise having a generic solution (e.g. face-remapping) seems quite
>> sufficient.
> Sigh.  Same song you've sung previously to defend hard-coding
> `highlight'...

Of course, it's the leading theme of software maintenance.


        Stefan



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

* Re: can we please define a face for compile.el mouseover?
  2011-02-19 21:11         ` Stefan Monnier
@ 2011-02-19 21:32           ` Chong Yidong
  0 siblings, 0 replies; 9+ messages in thread
From: Chong Yidong @ 2011-02-19 21:32 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Drew Adams, emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> I see what you mean and I partly agree.  So part of the reason you
> want a different face is because you mouse-highlight the whole line.
> But admittedly, the regexps we use in compile.el seem to cover
> potentially long chunks of text, even without extending them to cover
> the whole line.  Maybe we should add a new face `long-highlight',
> inheriting from highlight and use it in compilation, or on the
> contrary maybe we should try and reduce the size of the
> mouse-highlighted text.

Any example of such usage in Emacs core code?



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

end of thread, other threads:[~2011-02-19 21:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-15 19:26 can we please define a face for compile.el mouseover? Drew Adams
2011-02-15 19:42 ` Eli Zaretskii
2011-02-15 22:43   ` Drew Adams
2011-02-15 21:12 ` Stefan Monnier
2011-02-15 22:41   ` Drew Adams
2011-02-16  2:32     ` Stefan Monnier
2011-02-16  4:03       ` Drew Adams
2011-02-19 21:11         ` Stefan Monnier
2011-02-19 21:32           ` 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).