unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* face-remapping-alist can not override internal-border face?
@ 2019-03-08  4:30 tumashu
  2019-03-08  8:26 ` Eli Zaretskii
  0 siblings, 1 reply; 26+ messages in thread
From: tumashu @ 2019-03-08  4:30 UTC (permalink / raw)
  To: emacs-devel@gnu.org

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

I have tested the below code in msys2-emas26 of window7, seem that internal-border

can not be overrrided.
----------------

(defface test
  '((t (:inherit default :background "green")))
  "Face used by the ivy-posframe."
  :group 'ivy-posframe)

(setq face-remapping-alist '((internal-border . test)))

(make-frame '((internal-border-width . 100)))

(redraw-display)




----------------



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

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

* Re: face-remapping-alist can not override internal-border face?
  2019-03-08  4:30 face-remapping-alist can not override internal-border face? tumashu
@ 2019-03-08  8:26 ` Eli Zaretskii
  2019-03-08 16:19   ` tumashu
  0 siblings, 1 reply; 26+ messages in thread
From: Eli Zaretskii @ 2019-03-08  8:26 UTC (permalink / raw)
  To: tumashu; +Cc: emacs-devel

> Date: Fri, 8 Mar 2019 12:30:05 +0800 (CST)
> From: tumashu <tumashu@163.com>
> 
> I have tested the below code in msys2-emas26 of window7, seem that internal-border 
> can not be overrrided.
> ----------------
> 
> (defface test
>   '((t (:inherit default :background "green")))
>   "Face used by the ivy-posframe."
>   :group 'ivy-posframe)
> 
> (setq face-remapping-alist '((internal-border . test)))
> 
> (make-frame '((internal-border-width . 100)))
> 
> (redraw-display)

I think this is because your remapped face inherits from 'default'.
Faces that inherit from the basic faces are remapped as their parents,
so you created a contradiction, whereby one basic face
(internal-border) is remapped to face whose parent (default) is NOT
remapped.



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

* Re:Re: face-remapping-alist can not override internal-border face?
  2019-03-08  8:26 ` Eli Zaretskii
@ 2019-03-08 16:19   ` tumashu
  2019-03-08 18:52     ` martin rudalics
  2019-03-09 17:16     ` Eli Zaretskii
  0 siblings, 2 replies; 26+ messages in thread
From: tumashu @ 2019-03-08 16:19 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel@gnu.org











At 2019-03-08 16:26:20, "Eli Zaretskii" <eliz@gnu.org> wrote:
>> Date: Fri, 8 Mar 2019 12:30:05 +0800 (CST)
>> From: tumashu <tumashu@163.com>
>> 
>> I have tested the below code in msys2-emas26 of window7, seem that internal-border 
>> can not be overrrided.
>> ----------------
>> 
>> (defface test
>>   '((t (:inherit default :background "green")))
>>   "Face used by the ivy-posframe."
>>   :group 'ivy-posframe)
>> 
>> (setq face-remapping-alist '((internal-border . test)))
>> 
>> (make-frame '((internal-border-width . 100)))
>> 
>> (redraw-display)
>
>I think this is because your remapped face inherits from 'default'.
>Faces that inherit from the basic faces are remapped as their parents,
>so you created a contradiction, whereby one basic face
>(internal-border) is remapped to face whose parent (default) is NOT
>remapped.

Sorry, I do not understand this,  does this mean: test is inherited to default face,
so internal-border is remapped to default instead of test? but the below code
seem to not work too:

(defface test
  '((:background "green"))
  "Face used by the ivy-posframe."
  :group 'ivy-posframe)

(setq face-remapping-alist '((internal-border . test)))

(make-frame '((internal-border-width . 100)))

(redraw-display)


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

* Re: face-remapping-alist can not override internal-border face?
  2019-03-08 16:19   ` tumashu
@ 2019-03-08 18:52     ` martin rudalics
  2019-03-09 14:28       ` tumashu
  2019-03-09 17:16     ` Eli Zaretskii
  1 sibling, 1 reply; 26+ messages in thread
From: martin rudalics @ 2019-03-08 18:52 UTC (permalink / raw)
  To: tumashu, Eli Zaretskii; +Cc: emacs-devel@gnu.org

 > Sorry, I do not understand this,  does this mean: test is inherited to default face,
 > so internal-border is remapped to default instead of test? but the below code
 > seem to not work too:
 >
 > (defface test
 >    '((:background "green"))
 >    "Face used by the ivy-posframe."
 >    :group 'ivy-posframe)
 >
 > (setq face-remapping-alist '((internal-border . test)))
 >
 > (make-frame '((internal-border-width . 100)))
 >
 > (redraw-display)

In a package I wrote I added a separate 'defcustom' to let users
specify the background of the internal border like

(defcustom my-internal-border "blue"
   "Background of internal border."
   :type 'string
   ...)

and later use

(set-face-background 'internal-border my-internal-border ...)

to put that into effect.  I don't recall whether I then conducted
special experiments as to whether other solutions would work but
faintly recall that the face of the internal border is special in a
way.

martin



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

* Re:Re: face-remapping-alist can not override internal-border face?
  2019-03-08 18:52     ` martin rudalics
@ 2019-03-09 14:28       ` tumashu
  2019-03-09 14:55         ` Eli Zaretskii
  2019-03-10  8:45         ` martin rudalics
  0 siblings, 2 replies; 26+ messages in thread
From: tumashu @ 2019-03-09 14:28 UTC (permalink / raw)
  To: martin rudalics; +Cc: Eli Zaretskii, emacs-devel@gnu.org











At 2019-03-09 02:52:44, "martin rudalics" <rudalics@gmx.at> wrote:
> > Sorry, I do not understand this,  does this mean: test is inherited to default face,
> > so internal-border is remapped to default instead of test? but the below code
> > seem to not work too:
> >
> > (defface test
> >    '((:background "green"))
> >    "Face used by the ivy-posframe."
> >    :group 'ivy-posframe)
> >
> > (setq face-remapping-alist '((internal-border . test)))
> >
> > (make-frame '((internal-border-width . 100)))
> >
> > (redraw-display)
>
>In a package I wrote I added a separate 'defcustom' to let users
>specify the background of the internal border like
>
>(defcustom my-internal-border "blue"
>   "Background of internal border."
>   :type 'string
>   ...)
>
>and later use
>
>(set-face-background 'internal-border my-internal-border ...)
>
>to put that into effect.  I don't recall whether I then conducted
>special experiments as to whether other solutions would work but
>faintly recall that the face of the internal border is special in a
>way.

I think set-face-background will change internal-border globally,
Do we have any method which can let differnet frame have different border color?
>
>martin

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

* Re: face-remapping-alist can not override internal-border face?
  2019-03-09 14:28       ` tumashu
@ 2019-03-09 14:55         ` Eli Zaretskii
  2019-03-10  0:35           ` tumashu
  2019-03-10  8:45         ` martin rudalics
  1 sibling, 1 reply; 26+ messages in thread
From: Eli Zaretskii @ 2019-03-09 14:55 UTC (permalink / raw)
  To: tumashu; +Cc: rudalics, emacs-devel

> Date: Sat, 9 Mar 2019 22:28:32 +0800 (CST)
> From: tumashu  <tumashu@163.com>
> Cc: "Eli Zaretskii" <eliz@gnu.org>, "emacs-devel@gnu.org" <emacs-devel@gnu.org>
> 
> I think set-face-background will change internal-border globally,
> Do we have any method which can let differnet frame have different border color?

Faces are defined per frame, so it should work, yes.  E.g.,
set-face-background accepts a FRAME argument.




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

* Re: face-remapping-alist can not override internal-border face?
  2019-03-08 16:19   ` tumashu
  2019-03-08 18:52     ` martin rudalics
@ 2019-03-09 17:16     ` Eli Zaretskii
  2019-03-09 17:51       ` Eli Zaretskii
  2019-03-10 10:14       ` tumashu
  1 sibling, 2 replies; 26+ messages in thread
From: Eli Zaretskii @ 2019-03-09 17:16 UTC (permalink / raw)
  To: tumashu; +Cc: emacs-devel

> Date: Sat, 9 Mar 2019 00:19:56 +0800 (CST)
> From: tumashu  <tumashu@163.com>
> Cc: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
> 
> Sorry, I do not understand this,  does this mean: test is inherited to default face,
> so internal-border is remapped to default instead of test? but the below code
> seem to not work too:
> 
> (defface test
>   '((:background "green"))
>   "Face used by the ivy-posframe."
>   :group 'ivy-posframe)
> 
> (setq face-remapping-alist '((internal-border . test)))
> 
> (make-frame '((internal-border-width . 100)))

You are right.  I see that when we draw the border, we don't consult
face-remapping-alist.  But I'm not sure we should, because
face-remapping-alist can be buffer-local (and makes most sense when
it's buffer-local), whereas the internal-border face affects the
entire frame.

So maybe instead tell why you wanted to use face-remapping-alist
instead of simply changing the face's attributes?



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

* Re: face-remapping-alist can not override internal-border face?
  2019-03-09 17:16     ` Eli Zaretskii
@ 2019-03-09 17:51       ` Eli Zaretskii
  2019-03-10 10:14       ` tumashu
  1 sibling, 0 replies; 26+ messages in thread
From: Eli Zaretskii @ 2019-03-09 17:51 UTC (permalink / raw)
  To: tumashu; +Cc: emacs-devel

> Date: Sat, 09 Mar 2019 19:16:36 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: emacs-devel@gnu.org
> 
> You are right.  I see that when we draw the border, we don't consult
> face-remapping-alist.  But I'm not sure we should, because
> face-remapping-alist can be buffer-local (and makes most sense when
> it's buffer-local), whereas the internal-border face affects the
> entire frame.

But I decided to fix this anyway, just don't expect this to do
something sensible if you make face-remapping-alist buffer-local.



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

* Re:Re: face-remapping-alist can not override internal-border face?
  2019-03-09 14:55         ` Eli Zaretskii
@ 2019-03-10  0:35           ` tumashu
  2019-03-10  3:36             ` Eli Zaretskii
  2019-03-10 12:39             ` Eli Zaretskii
  0 siblings, 2 replies; 26+ messages in thread
From: tumashu @ 2019-03-10  0:35 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: martin rudalics, emacs-devel@gnu.org












At 2019-03-09 22:55:58, "Eli Zaretskii" <eliz@gnu.org> wrote:
>> Date: Sat, 9 Mar 2019 22:28:32 +0800 (CST)
>> From: tumashu  <tumashu@163.com>
>> Cc: "Eli Zaretskii" <eliz@gnu.org>, "emacs-devel@gnu.org" <emacs-devel@gnu.org>
>> 
>> I think set-face-background will change internal-border globally,
>> Do we have any method which can let differnet frame have different border color?
>
>Faces are defined per frame, so it should work, yes.  E.g.,
>set-face-background accepts a FRAME argument.


I have tested, but I found that it *only* work normal frame,  child-frame do not work:

(defface test
  '((t (:inherit default :background "green")))
  "Face used by the ivy-posframe."
  :group 'ivy-posframe)

(set-face-background
 'internal-border
 (face-attribute 'test :background)
 (make-frame `((internal-border-width . 100)
               (parent-frame . ,(window-frame)))))

(set-face-background
 'internal-border
 (face-attribute 'test :background)
 (make-frame `((internal-border-width . 100))))



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

* Re: face-remapping-alist can not override internal-border face?
  2019-03-10  0:35           ` tumashu
@ 2019-03-10  3:36             ` Eli Zaretskii
  2019-03-10  8:47               ` martin rudalics
  2019-03-10 12:39             ` Eli Zaretskii
  1 sibling, 1 reply; 26+ messages in thread
From: Eli Zaretskii @ 2019-03-10  3:36 UTC (permalink / raw)
  To: tumashu; +Cc: rudalics, emacs-devel

> Date: Sun, 10 Mar 2019 08:35:55 +0800 (CST)
> From: tumashu  <tumashu@163.com>
> Cc: "martin rudalics" <rudalics@gmx.at>, 
> 	"emacs-devel@gnu.org" <emacs-devel@gnu.org>
> 
> >Faces are defined per frame, so it should work, yes.  E.g.,
> >set-face-background accepts a FRAME argument.
> 
> 
> I have tested, but I found that it *only* work normal frame,  child-frame do not work:

I think that's expected.  Martin?



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

* Re: face-remapping-alist can not override internal-border face?
  2019-03-09 14:28       ` tumashu
  2019-03-09 14:55         ` Eli Zaretskii
@ 2019-03-10  8:45         ` martin rudalics
  1 sibling, 0 replies; 26+ messages in thread
From: martin rudalics @ 2019-03-10  8:45 UTC (permalink / raw)
  To: tumashu; +Cc: Eli Zaretskii, emacs-devel@gnu.org

 > I think set-face-background will change internal-border globally,
 > Do we have any method which can let differnet frame have different border color?

One stretch of code I use every day is (unedited, so to not miss a
maybe important detail)

(defvar my-child-frame nil)

(defun my-make-child-frame ()
   (interactive)
   (setq my-child-frame
	(make-frame
	 `((parent-frame . ,(selected-frame))
	   (no-focus-on-map . t)
	   (undecorated . t)
	   (left . 1.0)
	   (top . 0.5)
	   (width . 0.3)
	   (height . 0.8)
	   (border-width . 0)
	   (internal-border-width . 3)
	   (background-color . "yellow")
	   (tool-bar-lines . 0)
	   (menu-bar-lines . 0)
	   (minibuffer . nil)
	   (vertical-scroll-bars . nil)
	   (horizontal-scroll-bars . nil)
	   (left-fringe . 0)
	   (right-fringe . 0)
	   (drag-internal-border . t)
	   (drag-with-mode-line . t)
	   (drag-with-header-line . t)
	   (min-height . 1)
	   (min-width . 1)
	   (keep-ratio . t)
	   (snap-width . 25)
	   (top-visible . 4)
;; 	   (bottom-visible . 8)
	   (no-special-glyphs . t)
	   (unsplittable . t)
	   )))
   (setq my-child-window (frame-root-window my-child-frame))
   (set-window-buffer my-child-window (get-buffer-create "*my-notes*"))
   (set-window-parameter my-child-window 'mode-line-format 'none)
   (set-window-parameter
    my-child-window 'header-line-format '(" " (:eval (buffer-name))))
;;   (set-window-parameter
;;    my-child-window 'mode-line-format '(" " (:eval (buffer-name))))
   (set-face-background 'internal-border "blue" my-child-frame))

The last form of the last definition does set the background for
my-child-frame's internal border, leaving the backgrounds of the
internal borders of all other frames alone.

martin



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

* Re: face-remapping-alist can not override internal-border face?
  2019-03-10  3:36             ` Eli Zaretskii
@ 2019-03-10  8:47               ` martin rudalics
  2019-03-10 10:22                 ` tumashu
  2019-03-10 12:45                 ` Eli Zaretskii
  0 siblings, 2 replies; 26+ messages in thread
From: martin rudalics @ 2019-03-10  8:47 UTC (permalink / raw)
  To: Eli Zaretskii, tumashu; +Cc: emacs-devel

 >> I have tested, but I found that it *only* work normal frame,  child-frame do not work:
 >
 > I think that's expected.  Martin?

It works here without problems.  The internal border is important for
child frames since some window systems cannot/do not draw an external
border around them.  So it's important to make the internal border
stand out in some way with a different color and/or width.  I have not
found a system here where setting its background does not work.

martin



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

* Re:Re: face-remapping-alist can not override internal-border face?
  2019-03-09 17:16     ` Eli Zaretskii
  2019-03-09 17:51       ` Eli Zaretskii
@ 2019-03-10 10:14       ` tumashu
  2019-03-10 12:47         ` Eli Zaretskii
  1 sibling, 1 reply; 26+ messages in thread
From: tumashu @ 2019-03-10 10:14 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel@gnu.org











At 2019-03-10 01:16:36, "Eli Zaretskii" <eliz@gnu.org> wrote:
>> Date: Sat, 9 Mar 2019 00:19:56 +0800 (CST)
>> From: tumashu  <tumashu@163.com>
>> Cc: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
>> 
>> Sorry, I do not understand this,  does this mean: test is inherited to default face,
>> so internal-border is remapped to default instead of test? but the below code
>> seem to not work too:
>> 
>> (defface test
>>   '((:background "green"))
>>   "Face used by the ivy-posframe."
>>   :group 'ivy-posframe)
>> 
>> (setq face-remapping-alist '((internal-border . test)))
>> 
>> (make-frame '((internal-border-width . 100)))
>
>You are right.  I see that when we draw the border, we don't consult
>face-remapping-alist.  But I'm not sure we should, because
>face-remapping-alist can be buffer-local (and makes most sense when
>it's buffer-local), whereas the internal-border face affects the
>entire frame.
>
>So maybe instead tell why you wanted to use face-remapping-alist
>instead of simply changing the face's attributes?

I just want to child-frame have its own border color, i do not know face have "frame" argument
so I use a buffer-local face-remapping-alist to this job :-)

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

* Re:Re: face-remapping-alist can not override internal-border face?
  2019-03-10  8:47               ` martin rudalics
@ 2019-03-10 10:22                 ` tumashu
  2019-03-10 10:28                   ` tumashu
  2019-03-10 13:00                   ` Eli Zaretskii
  2019-03-10 12:45                 ` Eli Zaretskii
  1 sibling, 2 replies; 26+ messages in thread
From: tumashu @ 2019-03-10 10:22 UTC (permalink / raw)
  To: martin rudalics; +Cc: Eli Zaretskii, emacs-devel@gnu.org











At 2019-03-10 16:47:27, "martin rudalics" <rudalics@gmx.at> wrote:
> >> I have tested, but I found that it *only* work normal frame,  child-frame do not work:
> >
> > I think that's expected.  Martin?
>
>It works here without problems.  The internal border is important for
>child frames since some window systems cannot/do not draw an external
>border around them.  So it's important to make the internal border
>stand out in some way with a different color and/or width.  I have not
>found a system here where setting its background does not work.
>
>martin

I use below code to test, when child-frame is created, border's color is not 
change,  after I click frame with the help of mouse, the border's color change
to green

 
  (set-face-background
   'internal-border
   (face-attribute 'test :background)
   (make-frame `((internal-border-width . 100)
		 (parent-frame . ,(window-frame)))))

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

* Re:Re:Re: face-remapping-alist can not override internal-border face?
  2019-03-10 10:22                 ` tumashu
@ 2019-03-10 10:28                   ` tumashu
  2019-03-10 13:00                   ` Eli Zaretskii
  1 sibling, 0 replies; 26+ messages in thread
From: tumashu @ 2019-03-10 10:28 UTC (permalink / raw)
  To: 我; +Cc: martin rudalics, Eli Zaretskii, emacs-devel@gnu.org











At 2019-03-10 18:22:19, "tumashu" <tumashu@163.com> wrote:
>
>
>
>
>
>
>
>
>
>
>At 2019-03-10 16:47:27, "martin rudalics" <rudalics@gmx.at> wrote:
>> >> I have tested, but I found that it *only* work normal frame,  child-frame do not work:
>> >
>> > I think that's expected.  Martin?
>>
>>It works here without problems.  The internal border is important for
>>child frames since some window systems cannot/do not draw an external
>>border around them.  So it's important to make the internal border
>>stand out in some way with a different color and/or width.  I have not
>>found a system here where setting its background does not work.
>>
>>martin
>
>I use below code to test, when child-frame is created, border's color is not 
>change,  after I click frame with the help of mouse, the border's color change
>to green
>
> 
>  (set-face-background
>   'internal-border
>   (face-attribute 'test :background)
>   (make-frame `((internal-border-width . 100)
>		 (parent-frame . ,(window-frame)))))

I use your example to create child-frame, need click too,  emacs26 msys2 win7

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

* Re: face-remapping-alist can not override internal-border face?
  2019-03-10  0:35           ` tumashu
  2019-03-10  3:36             ` Eli Zaretskii
@ 2019-03-10 12:39             ` Eli Zaretskii
  2019-03-10 13:04               ` tumashu
  1 sibling, 1 reply; 26+ messages in thread
From: Eli Zaretskii @ 2019-03-10 12:39 UTC (permalink / raw)
  To: tumashu; +Cc: rudalics, emacs-devel

> Date: Sun, 10 Mar 2019 08:35:55 +0800 (CST)
> From: tumashu  <tumashu@163.com>
> Cc: martin rudalics <rudalics@gmx.at>,
> 	"emacs-devel@gnu.org" <emacs-devel@gnu.org>
> 
> I have tested, but I found that it *only* work normal frame,  child-frame do not work:
> 
> (defface test
>   '((t (:inherit default :background "green")))
>   "Face used by the ivy-posframe."
>   :group 'ivy-posframe)
> 
> (set-face-background
>  'internal-border
>  (face-attribute 'test :background)
>  (make-frame `((internal-border-width . 100)
>                (parent-frame . ,(window-frame)))))
> 
> (set-face-background
>  'internal-border
>  (face-attribute 'test :background)
>  (make-frame `((internal-border-width . 100))))

This does work for me, so Martin is right: it should work.  I have no
idea why it didn't for you; did you try in "emacs -Q"?



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

* Re: face-remapping-alist can not override internal-border face?
  2019-03-10  8:47               ` martin rudalics
  2019-03-10 10:22                 ` tumashu
@ 2019-03-10 12:45                 ` Eli Zaretskii
  1 sibling, 0 replies; 26+ messages in thread
From: Eli Zaretskii @ 2019-03-10 12:45 UTC (permalink / raw)
  To: martin rudalics; +Cc: tumashu, emacs-devel

> Date: Sun, 10 Mar 2019 09:47:27 +0100
> From: martin rudalics <rudalics@gmx.at>
> CC: emacs-devel@gnu.org
> 
>  >> I have tested, but I found that it *only* work normal frame,  child-frame do not work:
>  >
>  > I think that's expected.  Martin?
> 
> It works here without problems.

You are right, it works for me as well.



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

* Re: face-remapping-alist can not override internal-border face?
  2019-03-10 10:14       ` tumashu
@ 2019-03-10 12:47         ` Eli Zaretskii
  2019-03-10 13:35           ` martin rudalics
  0 siblings, 1 reply; 26+ messages in thread
From: Eli Zaretskii @ 2019-03-10 12:47 UTC (permalink / raw)
  To: tumashu; +Cc: emacs-devel

> Date: Sun, 10 Mar 2019 18:14:37 +0800 (CST)
> From: tumashu  <tumashu@163.com>
> Cc: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
> 
> I just want to child-frame have its own border color, i do not know face have "frame" argument
> so I use a buffer-local face-remapping-alist to this job :-)

Buffer-local variables that determine frame-global behavior are a bad
idea.  Don't be surprised if you will see the face change unexpectedly
because some other buffer happened to be the current buffer when the
border was redrawn.



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

* Re: face-remapping-alist can not override internal-border face?
  2019-03-10 10:22                 ` tumashu
  2019-03-10 10:28                   ` tumashu
@ 2019-03-10 13:00                   ` Eli Zaretskii
  2019-03-10 13:16                     ` tumashu
  1 sibling, 1 reply; 26+ messages in thread
From: Eli Zaretskii @ 2019-03-10 13:00 UTC (permalink / raw)
  To: tumashu; +Cc: rudalics, emacs-devel

> Date: Sun, 10 Mar 2019 18:22:19 +0800 (CST)
> From: tumashu  <tumashu@163.com>
> Cc: "Eli Zaretskii" <eliz@gnu.org>, "emacs-devel@gnu.org" <emacs-devel@gnu.org>
> I use below code to test, when child-frame is created, border's color is not 
> change,  after I click frame with the help of mouse, the border's color change
> to green
> 
>  
>   (set-face-background
>    'internal-border
>    (face-attribute 'test :background)
>    (make-frame `((internal-border-width . 100)
> 		 (parent-frame . ,(window-frame)))))

Try creating the frame first, and change the face only afterwards.



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

* Re:Re: face-remapping-alist can not override internal-border face?
  2019-03-10 12:39             ` Eli Zaretskii
@ 2019-03-10 13:04               ` tumashu
  2019-03-10 13:41                 ` Eli Zaretskii
  0 siblings, 1 reply; 26+ messages in thread
From: tumashu @ 2019-03-10 13:04 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: martin rudalics, emacs-devel@gnu.org











At 2019-03-10 20:39:54, "Eli Zaretskii" <eliz@gnu.org> wrote:
>> Date: Sun, 10 Mar 2019 08:35:55 +0800 (CST)
>> From: tumashu  <tumashu@163.com>
>> Cc: martin rudalics <rudalics@gmx.at>,
>> 	"emacs-devel@gnu.org" <emacs-devel@gnu.org>
>> 
>> I have tested, but I found that it *only* work normal frame,  child-frame do not work:
>> 
>> (defface test
>>   '((t (:inherit default :background "green")))
>>   "Face used by the ivy-posframe."
>>   :group 'ivy-posframe)
>> 
>> (set-face-background
>>  'internal-border
>>  (face-attribute 'test :background)
>>  (make-frame `((internal-border-width . 100)
>>                (parent-frame . ,(window-frame)))))
>> 
>> (set-face-background
>>  'internal-border
>>  (face-attribute 'test :background)
>>  (make-frame `((internal-border-width . 100))))
>
>This does work for me, so Martin is right: it should work.  I have no
>idea why it didn't for you; did you try in "emacs -Q"?

I can change child-frame's border color know,  after create child-frame,  click frame or
type a char will let border show correct color, do not know why, but should works for posframe.


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

* Re:Re: face-remapping-alist can not override internal-border face?
  2019-03-10 13:00                   ` Eli Zaretskii
@ 2019-03-10 13:16                     ` tumashu
  2019-03-10 13:44                       ` Eli Zaretskii
  0 siblings, 1 reply; 26+ messages in thread
From: tumashu @ 2019-03-10 13:16 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: martin rudalics, emacs-devel@gnu.org











At 2019-03-10 21:00:00, "Eli Zaretskii" <eliz@gnu.org> wrote:
>> Date: Sun, 10 Mar 2019 18:22:19 +0800 (CST)
>> From: tumashu  <tumashu@163.com>
>> Cc: "Eli Zaretskii" <eliz@gnu.org>, "emacs-devel@gnu.org" <emacs-devel@gnu.org>
>> I use below code to test, when child-frame is created, border's color is not 
>> change,  after I click frame with the help of mouse, the border's color change
>> to green
>> 
>>  
>>   (set-face-background
>>    'internal-border
>>    (face-attribute 'test :background)
>>    (make-frame `((internal-border-width . 100)
>> 		 (parent-frame . ,(window-frame)))))
>
>Try creating the frame first, and change the face only afterwards.

Thanks for your and martin's help, posframe can change border's color now:

   https://github.com/tumashu/posframe/commit/edfbff5ce5110e6d1a78bfe203fa8ec5d9d4e3ec

Now I need to do is deal with posframe's face-mapping argument, 
it use buffer-local face-mapping-alist,  a question is that:
Is there a function, which can replace a face's definition with other face's definition?

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

* Re: face-remapping-alist can not override internal-border face?
  2019-03-10 12:47         ` Eli Zaretskii
@ 2019-03-10 13:35           ` martin rudalics
  0 siblings, 0 replies; 26+ messages in thread
From: martin rudalics @ 2019-03-10 13:35 UTC (permalink / raw)
  To: Eli Zaretskii, tumashu; +Cc: emacs-devel

 > Buffer-local variables that determine frame-global behavior are a bad
 > idea.

Yes.  I would use the term "frame-local" here.  Framewise
specification should be done with frame parameters.

 > Don't be surprised if you will see the face change unexpectedly
 > because some other buffer happened to be the current buffer when the
 > border was redrawn.

Buffer-local values should be used for buffers and windows only.  As
for the latter, window parameters are useful when specifying something
that should survive showing another buffer in that window.

martin



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

* Re: face-remapping-alist can not override internal-border face?
  2019-03-10 13:04               ` tumashu
@ 2019-03-10 13:41                 ` Eli Zaretskii
  0 siblings, 0 replies; 26+ messages in thread
From: Eli Zaretskii @ 2019-03-10 13:41 UTC (permalink / raw)
  To: tumashu; +Cc: rudalics, emacs-devel

> Date: Sun, 10 Mar 2019 21:04:19 +0800 (CST)
> From: tumashu  <tumashu@163.com>
> Cc: "martin rudalics" <rudalics@gmx.at>, 
> 	"emacs-devel@gnu.org" <emacs-devel@gnu.org>
> 
> >This does work for me, so Martin is right: it should work.  I have no
> >idea why it didn't for you; did you try in "emacs -Q"?
> 
> I can change child-frame's border color know,  after create child-frame,  click frame or
> type a char will let border show correct color, do not know why

Maybe because you don't give the window-system the chance to display
the frame.  AFAIR, it is actually done in a separate thread, so you
need to wait for a short while before changing the way the new frame
looks.



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

* Re: face-remapping-alist can not override internal-border face?
  2019-03-10 13:16                     ` tumashu
@ 2019-03-10 13:44                       ` Eli Zaretskii
  2019-03-11 13:32                         ` tumashu
  0 siblings, 1 reply; 26+ messages in thread
From: Eli Zaretskii @ 2019-03-10 13:44 UTC (permalink / raw)
  To: tumashu; +Cc: rudalics, emacs-devel

> Date: Sun, 10 Mar 2019 21:16:19 +0800 (CST)
> From: tumashu  <tumashu@163.com>
> Cc: "martin rudalics" <rudalics@gmx.at>, 
> 	"emacs-devel@gnu.org" <emacs-devel@gnu.org>
> 
> Now I need to do is deal with posframe's face-mapping argument, 
> it use buffer-local face-mapping-alist,  a question is that:
> Is there a function, which can replace a face's definition with other face's definition?

I don't think I understand the question, sorry.  Isn't
face-mapping-alist what you want?



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

* Re:Re: face-remapping-alist can not override internal-border face?
  2019-03-10 13:44                       ` Eli Zaretskii
@ 2019-03-11 13:32                         ` tumashu
  2019-03-11 15:11                           ` Eli Zaretskii
  0 siblings, 1 reply; 26+ messages in thread
From: tumashu @ 2019-03-11 13:32 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: martin rudalics, emacs-devel@gnu.org











At 2019-03-10 21:44:43, "Eli Zaretskii" <eliz@gnu.org> wrote:
>> Date: Sun, 10 Mar 2019 21:16:19 +0800 (CST)
>> From: tumashu  <tumashu@163.com>
>> Cc: "martin rudalics" <rudalics@gmx.at>, 
>> 	"emacs-devel@gnu.org" <emacs-devel@gnu.org>
>> 
>> Now I need to do is deal with posframe's face-mapping argument, 
>> it use buffer-local face-mapping-alist,  a question is that:
>> Is there a function, which can replace a face's definition with other face's definition?
>
>I don't think I understand the question, sorry.  Isn't
>face-mapping-alist what you want?

Before I use buffer-local face-mapping-alist to deal with posframe's face-mapping argument,
your opinion is that buffer-local face-mapping-alist is not a good idea, so I decide to use other way, 
 after I know that a face's attribute can change for a frame, I want to 
do like this: set faceA's all attributes = faceB's all attributes :-)
         
       




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

* Re: face-remapping-alist can not override internal-border face?
  2019-03-11 13:32                         ` tumashu
@ 2019-03-11 15:11                           ` Eli Zaretskii
  0 siblings, 0 replies; 26+ messages in thread
From: Eli Zaretskii @ 2019-03-11 15:11 UTC (permalink / raw)
  To: tumashu; +Cc: rudalics, emacs-devel

> Date: Mon, 11 Mar 2019 21:32:46 +0800 (CST)
> From: tumashu  <tumashu@163.com>
> Cc: "martin rudalics" <rudalics@gmx.at>, 
> 	"emacs-devel@gnu.org" <emacs-devel@gnu.org>
> 
> >I don't think I understand the question, sorry.  Isn't
> >face-mapping-alist what you want?
> 
> Before I use buffer-local face-mapping-alist to deal with posframe's face-mapping argument,
> your opinion is that buffer-local face-mapping-alist is not a good idea, so I decide to use other way, 
>  after I know that a face's attribute can change for a frame, I want to 
> do like this: set faceA's all attributes = faceB's all attributes :-)

face-remapping-alist doesn't have to be buffer-local, it can be
global.  If you want that to be specific to a frame, store it in the
frame parameters alist.




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

end of thread, other threads:[~2019-03-11 15:11 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-08  4:30 face-remapping-alist can not override internal-border face? tumashu
2019-03-08  8:26 ` Eli Zaretskii
2019-03-08 16:19   ` tumashu
2019-03-08 18:52     ` martin rudalics
2019-03-09 14:28       ` tumashu
2019-03-09 14:55         ` Eli Zaretskii
2019-03-10  0:35           ` tumashu
2019-03-10  3:36             ` Eli Zaretskii
2019-03-10  8:47               ` martin rudalics
2019-03-10 10:22                 ` tumashu
2019-03-10 10:28                   ` tumashu
2019-03-10 13:00                   ` Eli Zaretskii
2019-03-10 13:16                     ` tumashu
2019-03-10 13:44                       ` Eli Zaretskii
2019-03-11 13:32                         ` tumashu
2019-03-11 15:11                           ` Eli Zaretskii
2019-03-10 12:45                 ` Eli Zaretskii
2019-03-10 12:39             ` Eli Zaretskii
2019-03-10 13:04               ` tumashu
2019-03-10 13:41                 ` Eli Zaretskii
2019-03-10  8:45         ` martin rudalics
2019-03-09 17:16     ` Eli Zaretskii
2019-03-09 17:51       ` Eli Zaretskii
2019-03-10 10:14       ` tumashu
2019-03-10 12:47         ` Eli Zaretskii
2019-03-10 13:35           ` martin rudalics

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