unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#23246: 25.0.92; Local face-remapping-alist doesn't affect tooltips
@ 2016-04-08 19:22 Artur Malabarba
  2016-04-08 19:34 ` Eli Zaretskii
  0 siblings, 1 reply; 14+ messages in thread
From: Artur Malabarba @ 2016-04-08 19:22 UTC (permalink / raw)
  To: 23246


1. Start emacs -q

2. Create a buffer in fundamental-mode and type some text.

3. Evaluate this:

    (setq x-gtk-use-system-tooltips nil)
    (add-text-properties (point-min) (point-max) '(help-echo "OKOK"))
    (face-remap-add-relative 'tooltip '((:foreground "blue")))

4. Tooltips displayed are NOT blue.

5. If, instead, I add an entry to face-remapping-alist without making it
buffer-local, the tooltip does indeed display blue.





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

* bug#23246: 25.0.92; Local face-remapping-alist doesn't affect tooltips
  2016-04-08 19:22 bug#23246: 25.0.92; Local face-remapping-alist doesn't affect tooltips Artur Malabarba
@ 2016-04-08 19:34 ` Eli Zaretskii
  2016-04-08 20:06   ` Artur Malabarba
  2016-04-09  9:04   ` martin rudalics
  0 siblings, 2 replies; 14+ messages in thread
From: Eli Zaretskii @ 2016-04-08 19:34 UTC (permalink / raw)
  To: Artur Malabarba; +Cc: 23246

> From: Artur Malabarba <bruce.connor.am@gmail.com>
> Date: Fri, 08 Apr 2016 16:22:11 -0300
> 
>     (setq x-gtk-use-system-tooltips nil)
>     (add-text-properties (point-min) (point-max) '(help-echo "OKOK"))
>     (face-remap-add-relative 'tooltip '((:foreground "blue")))
> 
> 4. Tooltips displayed are NOT blue.

Why did you expect them to be blue?  Tooltips are special frames that
don't display any buffer, whereas face-remap-add-relative is
documented as affecting only the buffer that was current at the time
it was called.

More generally, face remapping is designed to allow buffer-local
changes to faces.  If you want to affect the way tooltips are
displayed, you should instead customize the 'tooltip' face or the
parameters in 'tooltip-frame-parameters'.

IOW, I don't see any bug here.





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

* bug#23246: 25.0.92; Local face-remapping-alist doesn't affect tooltips
  2016-04-08 19:34 ` Eli Zaretskii
@ 2016-04-08 20:06   ` Artur Malabarba
  2016-04-09  9:04     ` martin rudalics
  2016-04-09  9:35     ` Eli Zaretskii
  2016-04-09  9:04   ` martin rudalics
  1 sibling, 2 replies; 14+ messages in thread
From: Artur Malabarba @ 2016-04-08 20:06 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 23246

Eli Zaretskii <eliz@gnu.org> writes:

> Why did you expect them to be blue?  Tooltips are special frames that
> don't display any buffer, whereas face-remap-add-relative is
> documented as affecting only the buffer that was current at the time
> it was called.

Sorry, to me it wasn't obvious that tooltips are different frames.

> More generally, face remapping is designed to allow buffer-local
> changes to faces.  If you want to affect the way tooltips are
> displayed, you should instead customize the 'tooltip' face or the
> parameters in 'tooltip-frame-parameters'.

I want to change the way tooltips are displayed in a major-mode I'm
writing. I don't want to change this face globally for the user, only
change it in the buffers where this major-mode is active.

I understand that might not be possible, in which case feel free to
close.


Artur





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

* bug#23246: 25.0.92; Local face-remapping-alist doesn't affect tooltips
  2016-04-08 19:34 ` Eli Zaretskii
  2016-04-08 20:06   ` Artur Malabarba
@ 2016-04-09  9:04   ` martin rudalics
  2016-04-09  9:39     ` Eli Zaretskii
  1 sibling, 1 reply; 14+ messages in thread
From: martin rudalics @ 2016-04-09  9:04 UTC (permalink / raw)
  To: Eli Zaretskii, Artur Malabarba; +Cc: 23246

 > Why did you expect them to be blue?  Tooltips are special frames that
 > don't display any buffer,

A tooltip frame displays a buffer called "*tip*".

 > whereas face-remap-add-relative is
 > documented as affecting only the buffer that was current at the time
 > it was called.

martin





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

* bug#23246: 25.0.92; Local face-remapping-alist doesn't affect tooltips
  2016-04-08 20:06   ` Artur Malabarba
@ 2016-04-09  9:04     ` martin rudalics
  2016-04-09  9:35     ` Eli Zaretskii
  1 sibling, 0 replies; 14+ messages in thread
From: martin rudalics @ 2016-04-09  9:04 UTC (permalink / raw)
  To: Artur Malabarba, Eli Zaretskii; +Cc: 23246

 > I want to change the way tooltips are displayed in a major-mode I'm
 > writing. I don't want to change this face globally for the user, only
 > change it in the buffers where this major-mode is active.
 >
 > I understand that might not be possible, in which case feel free to
 > close.

Try using ‘x-show-tip’ directly.

martin






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

* bug#23246: 25.0.92; Local face-remapping-alist doesn't affect tooltips
  2016-04-08 20:06   ` Artur Malabarba
  2016-04-09  9:04     ` martin rudalics
@ 2016-04-09  9:35     ` Eli Zaretskii
  2016-04-09 12:50       ` martin rudalics
  2016-04-11  3:15       ` Artur Malabarba
  1 sibling, 2 replies; 14+ messages in thread
From: Eli Zaretskii @ 2016-04-09  9:35 UTC (permalink / raw)
  To: Artur Malabarba; +Cc: 23246

> From: Artur Malabarba <bruce.connor.am@gmail.com>
> Cc: 23246@debbugs.gnu.org
> Date: Fri, 08 Apr 2016 17:06:01 -0300
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > Why did you expect them to be blue?  Tooltips are special frames that
> > don't display any buffer, whereas face-remap-add-relative is
> > documented as affecting only the buffer that was current at the time
> > it was called.
> 
> Sorry, to me it wasn't obvious that tooltips are different frames.

I've added to the ELisp manual some documentation about that, which
makes it clear these are frames.

> I want to change the way tooltips are displayed in a major-mode I'm
> writing. I don't want to change this face globally for the user, only
> change it in the buffers where this major-mode is active.
> 
> I understand that might not be possible, in which case feel free to
> close.

I think you can achieve that by putting your own hook function on the
tooltip-functions list.

Let me know if there's anything else to do about this bug report.





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

* bug#23246: 25.0.92; Local face-remapping-alist doesn't affect tooltips
  2016-04-09  9:04   ` martin rudalics
@ 2016-04-09  9:39     ` Eli Zaretskii
  0 siblings, 0 replies; 14+ messages in thread
From: Eli Zaretskii @ 2016-04-09  9:39 UTC (permalink / raw)
  To: martin rudalics; +Cc: 23246, bruce.connor.am

> Date: Sat, 09 Apr 2016 11:04:09 +0200
> From: martin rudalics <rudalics@gmx.at>
> CC: 23246@debbugs.gnu.org
> 
>  > Why did you expect them to be blue?  Tooltips are special frames that
>  > don't display any buffer,
> 
> A tooltip frame displays a buffer called "*tip*".

Right, I should have been more accurate, and say "any of your own
buffers".





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

* bug#23246: 25.0.92; Local face-remapping-alist doesn't affect tooltips
  2016-04-09  9:35     ` Eli Zaretskii
@ 2016-04-09 12:50       ` martin rudalics
  2016-04-09 13:18         ` Eli Zaretskii
  2016-04-11  3:15       ` Artur Malabarba
  1 sibling, 1 reply; 14+ messages in thread
From: martin rudalics @ 2016-04-09 12:50 UTC (permalink / raw)
  To: Eli Zaretskii, Artur Malabarba; +Cc: 23246

 > I've added to the ELisp manual some documentation about that, which
 > makes it clear these are frames.

Perfectly done.

Congratulations, martin





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

* bug#23246: 25.0.92; Local face-remapping-alist doesn't affect tooltips
  2016-04-09 12:50       ` martin rudalics
@ 2016-04-09 13:18         ` Eli Zaretskii
  0 siblings, 0 replies; 14+ messages in thread
From: Eli Zaretskii @ 2016-04-09 13:18 UTC (permalink / raw)
  To: martin rudalics; +Cc: 23246, bruce.connor.am

> Date: Sat, 09 Apr 2016 14:50:44 +0200
> From: martin rudalics <rudalics@gmx.at>
> CC: 23246@debbugs.gnu.org
> 
>  > I've added to the ELisp manual some documentation about that, which
>  > makes it clear these are frames.
> 
> Perfectly done.
> 
> Congratulations, martin

Thanks.





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

* bug#23246: 25.0.92; Local face-remapping-alist doesn't affect tooltips
  2016-04-09  9:35     ` Eli Zaretskii
  2016-04-09 12:50       ` martin rudalics
@ 2016-04-11  3:15       ` Artur Malabarba
  2016-04-11 15:40         ` Eli Zaretskii
  1 sibling, 1 reply; 14+ messages in thread
From: Artur Malabarba @ 2016-04-11  3:15 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 23246

[-- Attachment #1: Type: text/plain, Size: 1242 bytes --]

On Sat, Apr 9, 2016 at 6:35 AM Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Artur Malabarba <bruce.connor.am@gmail.com>
> > Cc: 23246@debbugs.gnu.org
> > Date: Fri, 08 Apr 2016 17:06:01 -0300
> >
> > Eli Zaretskii <eliz@gnu.org> writes:
> >
> > > Why did you expect them to be blue?  Tooltips are special frames that
> > > don't display any buffer, whereas face-remap-add-relative is
> > > documented as affecting only the buffer that was current at the time
> > > it was called.
> >
> > Sorry, to me it wasn't obvious that tooltips are different frames.
>
> I've added to the ELisp manual some documentation about that, which
> makes it clear these are frames.
>
> > I want to change the way tooltips are displayed in a major-mode I'm
> > writing. I don't want to change this face globally for the user, only
> > change it in the buffers where this major-mode is active.
> >
> > I understand that might not be possible, in which case feel free to
> > close.
>
> I think you can achieve that by putting your own hook function on the
> tooltip-functions list.
>
> Let me know if there's anything else to do about this bug report.
>

No, I think we can close this. Thanks for the help.
And thanks to martin too. `x-show-tip' just might work.

[-- Attachment #2: Type: text/html, Size: 1878 bytes --]

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

* bug#23246: 25.0.92; Local face-remapping-alist doesn't affect tooltips
  2016-04-11  3:15       ` Artur Malabarba
@ 2016-04-11 15:40         ` Eli Zaretskii
  2016-04-12  7:30           ` martin rudalics
  0 siblings, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2016-04-11 15:40 UTC (permalink / raw)
  To: Artur Malabarba; +Cc: 23246-done

> From: Artur Malabarba <bruce.connor.am@gmail.com>
> Date: Mon, 11 Apr 2016 03:15:20 +0000
> Cc: 23246@debbugs.gnu.org
> 
>  I think you can achieve that by putting your own hook function on the
>  tooltip-functions list.
> 
>  Let me know if there's anything else to do about this bug report.
> 
> No, I think we can close this. Thanks for the help. 

Done.

> And thanks to martin too. `x-show-tip' just might work.

You mean, tooltip-functions doesn't?





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

* bug#23246: 25.0.92; Local face-remapping-alist doesn't affect tooltips
  2016-04-11 15:40         ` Eli Zaretskii
@ 2016-04-12  7:30           ` martin rudalics
  2016-04-12 14:26             ` Drew Adams
  2016-04-12 15:14             ` Eli Zaretskii
  0 siblings, 2 replies; 14+ messages in thread
From: martin rudalics @ 2016-04-12  7:30 UTC (permalink / raw)
  To: 23246, eliz, bruce.connor.am

 >> `x-show-tip' just might work.
 >
 > You mean, tooltip-functions doesn't?

The doc-string of ‘x-show-tip’ advises that

   This is an internal function; Lisp code should call ‘tooltip-show’.

but ‘tooltip-show’ overrides any face properties of TEXT via

   (propertize text 'face 'tooltip)

in a hardcoded fashion.  So if you want to display your own face
attributes, you currently have to call ‘x-show-tip’ directly despite of
its advice.

Obviously, GTK+ (and probably OS X) tooltips override such attributes
anyway, so changing this might probably never given high priority.
Still, Emacs tooltip frames provide the possibility so why not use it?

martin






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

* bug#23246: 25.0.92; Local face-remapping-alist doesn't affect tooltips
  2016-04-12  7:30           ` martin rudalics
@ 2016-04-12 14:26             ` Drew Adams
  2016-04-12 15:14             ` Eli Zaretskii
  1 sibling, 0 replies; 14+ messages in thread
From: Drew Adams @ 2016-04-12 14:26 UTC (permalink / raw)
  To: martin rudalics, 23246, eliz, bruce.connor.am

>  >> `x-show-tip' just might work.
>  > You mean, tooltip-functions doesn't?
> 
> The doc-string of ‘x-show-tip’ advises that
>    This is an internal function; Lisp code should call ‘tooltip-show’.

Yes, and that's misguided, at least for the reason you give.

> but ‘tooltip-show’ overrides any face properties of TEXT via
>    (propertize text 'face 'tooltip)
> in a hardcoded fashion.  So if you want to display your own face
> attributes, you currently have to call ‘x-show-tip’ directly despite of
> its advice.

Exactly.  Plus ‘x-show-tip’ works across Emacs versions.
It is preferable, IMO.

> Obviously, GTK+ (and probably OS X) tooltips override such attributes
> anyway, so changing this might probably never given high priority.
> Still, Emacs tooltip frames provide the possibility so why not use it?

Yes.  Just do it.

When Emacs wants to steer users away from X toward Y, especially
because the name X is misleading (e.g. `x-<something'), it had
better make sure that Y is really an adequate replacement for X.





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

* bug#23246: 25.0.92; Local face-remapping-alist doesn't affect tooltips
  2016-04-12  7:30           ` martin rudalics
  2016-04-12 14:26             ` Drew Adams
@ 2016-04-12 15:14             ` Eli Zaretskii
  1 sibling, 0 replies; 14+ messages in thread
From: Eli Zaretskii @ 2016-04-12 15:14 UTC (permalink / raw)
  To: martin rudalics; +Cc: 23246, bruce.connor.am

> Date: Tue, 12 Apr 2016 09:30:17 +0200
> From: martin rudalics <rudalics@gmx.at>
> 
>  >> `x-show-tip' just might work.
>  >
>  > You mean, tooltip-functions doesn't?
> 
> The doc-string of ‘x-show-tip’ advises that
> 
>    This is an internal function; Lisp code should call ‘tooltip-show’.

It doesn't really matter, IMO.

> but ‘tooltip-show’ overrides any face properties of TEXT via
> 
>    (propertize text 'face 'tooltip)
> 
> in a hardcoded fashion.  So if you want to display your own face
> attributes, you currently have to call ‘x-show-tip’ directly despite of
> its advice.

I agree, but I thought that the function which calls x-show-tip should
be put in tooltip-functions, to avoid the need to copycat the
machinery of popping up and popping down tooltips.





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

end of thread, other threads:[~2016-04-12 15:14 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-08 19:22 bug#23246: 25.0.92; Local face-remapping-alist doesn't affect tooltips Artur Malabarba
2016-04-08 19:34 ` Eli Zaretskii
2016-04-08 20:06   ` Artur Malabarba
2016-04-09  9:04     ` martin rudalics
2016-04-09  9:35     ` Eli Zaretskii
2016-04-09 12:50       ` martin rudalics
2016-04-09 13:18         ` Eli Zaretskii
2016-04-11  3:15       ` Artur Malabarba
2016-04-11 15:40         ` Eli Zaretskii
2016-04-12  7:30           ` martin rudalics
2016-04-12 14:26             ` Drew Adams
2016-04-12 15:14             ` Eli Zaretskii
2016-04-09  9:04   ` martin rudalics
2016-04-09  9:39     ` Eli Zaretskii

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