all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* mode-line-inactive and face inheritance
@ 2002-02-16  7:55 Eli Zaretskii
  2002-02-16 21:49 ` Kim F. Storm
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Eli Zaretskii @ 2002-02-16  7:55 UTC (permalink / raw)


Here's the definition of mode-line-inactive face:

    (defface mode-line-inactive
      '((((type x w32 mac) (background light) (class color))
	 :inherit mode-line
	 :weight light
	 :box (:line-width -1 :color "grey75" :style nil)
	 :foreground "grey20" :background "grey90")
	(((type x w32 mac) (background dark) (class color))
	 :inherit mode-line
	 :weight light
	 :box (:line-width -1 :color "grey40" :style nil)
	 :foreground "grey80" :background "grey30")
	(t
	 :inverse-video t))
      "Basic mode line face for non-selected windows."
      :version "21.2"
      :group 'modeline
      :group 'basic-faces)

The definition for non-GUI versions doesn't include `:inherit mode-line'.
Is that intentional?  I think it's not a good idea to have this
difference, especially since the documentation mentions the inheritance,
and doesn't say it's display-dependent.  FWIW, I don't see any reason
why an :inherit attribute would hurt here.

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


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

* Re: mode-line-inactive and face inheritance
  2002-02-16  7:55 mode-line-inactive and face inheritance Eli Zaretskii
@ 2002-02-16 21:49 ` Kim F. Storm
  2002-02-17 16:48 ` Richard Stallman
  2002-02-18 15:24 ` Stefan Monnier
  2 siblings, 0 replies; 12+ messages in thread
From: Kim F. Storm @ 2002-02-16 21:49 UTC (permalink / raw)
  Cc: emacs-devel

"Eli Zaretskii" <eliz@is.elta.co.il> writes:

> Here's the definition of mode-line-inactive face:
> 	(t
> 	 :inverse-video t))
>       "Basic mode line face for non-selected windows."
>       :version "21.2"
>       :group 'modeline
>       :group 'basic-faces)
> 
> The definition for non-GUI versions doesn't include `:inherit mode-line'.
> Is that intentional?

No, it is an oversight on my part (I copied this from the header-line font,
so I would assume it has a similar problem).

For non-GUI, the proper setting would probably be just :inherit and
nothing else (to make it identical to the normal mode line).

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


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

* Re: mode-line-inactive and face inheritance
  2002-02-16  7:55 mode-line-inactive and face inheritance Eli Zaretskii
  2002-02-16 21:49 ` Kim F. Storm
@ 2002-02-17 16:48 ` Richard Stallman
  2002-02-17 18:24   ` Eli Zaretskii
  2002-02-18 15:24 ` Stefan Monnier
  2 siblings, 1 reply; 12+ messages in thread
From: Richard Stallman @ 2002-02-17 16:48 UTC (permalink / raw)
  Cc: emacs-devel

    The definition for non-GUI versions doesn't include `:inherit mode-line'.
    Is that intentional?

Unless there is some very good reason for the discrepancy,
would you please add that inherit?


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


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

* Re: mode-line-inactive and face inheritance
  2002-02-17 16:48 ` Richard Stallman
@ 2002-02-17 18:24   ` Eli Zaretskii
  0 siblings, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2002-02-17 18:24 UTC (permalink / raw)
  Cc: emacs-devel

> Date: Sun, 17 Feb 2002 09:48:52 -0700 (MST)
> From: Richard Stallman <rms@gnu.org>
> 
>     The definition for non-GUI versions doesn't include `:inherit mode-line'.
>     Is that intentional?
> 
> Unless there is some very good reason for the discrepancy,
> would you please add that inherit?

I added it to mode-line-inactive and also to header-line.

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


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

* Re: mode-line-inactive and face inheritance
  2002-02-16  7:55 mode-line-inactive and face inheritance Eli Zaretskii
  2002-02-16 21:49 ` Kim F. Storm
  2002-02-17 16:48 ` Richard Stallman
@ 2002-02-18 15:24 ` Stefan Monnier
  2002-02-18 19:44   ` Kim F. Storm
  2002-02-19 21:30   ` Richard Stallman
  2 siblings, 2 replies; 12+ messages in thread
From: Stefan Monnier @ 2002-02-18 15:24 UTC (permalink / raw)
  Cc: emacs-devel

> Here's the definition of mode-line-inactive face:
> 
>     (defface mode-line-inactive
>       '((((type x w32 mac) (background light) (class color))
> 	 :inherit mode-line
> 	 :weight light
> 	 :box (:line-width -1 :color "grey75" :style nil)
> 	 :foreground "grey20" :background "grey90")
> 	(((type x w32 mac) (background dark) (class color))
> 	 :inherit mode-line
> 	 :weight light
> 	 :box (:line-width -1 :color "grey40" :style nil)
> 	 :foreground "grey80" :background "grey30")
> 	(t
> 	 :inverse-video t))
>       "Basic mode line face for non-selected windows."
>       :version "21.2"
>       :group 'modeline
>       :group 'basic-faces)
> 
> The definition for non-GUI versions doesn't include `:inherit mode-line'.
> Is that intentional?  I think it's not a good idea to have this
> difference, especially since the documentation mentions the inheritance,
> and doesn't say it's display-dependent.  FWIW, I don't see any reason
> why an :inherit attribute would hurt here.

Reminds me that I have a minor hack in faces.el that allows
slightly more structured specs for faces, so that you can move the
`:inherit mode-line' outside of any display-specific thing.
More specifically, it adds an `all' entry which (just like `t')
always matches but doesn't prevent subsequent specs from being
considered.  Also it allows nesting of display-specific specs
so you can extract the common part of the `light' and `'dark'
settings for `color' displays.

It needs to be cleaned up and documented before it's ready for
commit, but I'm not even sure if there's any interest in such
a feature.


	Stefan


Index: faces.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/faces.el,v
retrieving revision 1.254
diff -c -r1.254 faces.el
*** faces.el	12 Feb 2002 02:59:05 -0000	1.254
--- faces.el	18 Feb 2002 15:18:05 -0000
***************
*** 1283,1301 ****
    (unless frame
      (setq frame (selected-frame)))
    (let ((tail spec)
! 	result)
      (while tail
        (let* ((entry (pop tail))
  	     (display (car entry))
  	     (attrs (cdr entry)))
! 	(when (face-spec-set-match-display display frame)
! 	  (setq result (if (listp (car attrs))
  			   ;; Old-style entry, the attribute list is the
  			   ;; first element.
! 			   (car attrs)
! 			 attrs)
! 		tail nil))))
!     result))
  
  
  (defun face-spec-reset-face (face &optional frame)
--- 1283,1307 ----
    (unless frame
      (setq frame (selected-frame)))
    (let ((tail spec)
! 	result all)
      (while tail
        (let* ((entry (pop tail))
  	     (display (car entry))
  	     (attrs (cdr entry)))
! 	(if (eq display 'all)
! 	    (setq all attrs)
! 	  (when (face-spec-set-match-display display frame)
! 	    (setq result (cond
! 			  ((null (cdr attrs)) ;; was (listp (car attrs))
  			   ;; Old-style entry, the attribute list is the
  			   ;; first element.
! 			   (car attrs))
! 			  ((listp (car attrs))
! 			   ;; Nested spec
! 			   (face-spec-choose attrs frame))
! 			  (t attrs))
! 		  tail nil)))))
!     (if all (append result all) result)))
  
  
  (defun face-spec-reset-face (face &optional frame)
***************
*** 1747,1770 ****
       ;; happens to look good with the only current use of header-lines,
       ;; the info browser. XXX
       :underline t)
!     (((class color grayscale) (background light))
!      :inherit mode-line
!      :background "grey90" :foreground "grey20"
!      :box nil)
!     (((class color grayscale) (background dark))
!      :inherit mode-line
!      :background "grey20" :foreground "grey90"
!      :box nil)
      (((class mono) (background light))
       :inherit mode-line
       :background "white" :foreground "black"
       :inverse-video nil
       :box nil
       :underline t)
      (((class mono) (background dark))
       :inherit mode-line
       :background "black" :foreground "white"
       :inverse-video nil
       :box nil
       :underline t)
      (t
--- 1753,1779 ----
       ;; happens to look good with the only current use of header-lines,
       ;; the info browser. XXX
       :underline t)
!     (((class color grayscale))
!      (all
!       :inherit mode-line
!       :family "helv"
!       :box (:line-width -1 :style released-button))
!      (((background light))
!       :background "grey90" :foreground "grey20")
!      (((background dark))
!       :background "grey20" :foreground "grey90"))
      (((class mono) (background light))
       :inherit mode-line
       :background "white" :foreground "black"
       :inverse-video nil
+      :family "helv"
       :box nil
       :underline t)
      (((class mono) (background dark))
       :inherit mode-line
       :background "black" :foreground "white"
       :inverse-video nil
+      :family "helv"
       :box nil
       :underline t)
      (t
***************
*** 1775,1786 ****
  
  
  (defface tool-bar
!   '((((type x w32 mac) (class color))
!      (:box (:line-width 1 :style released-button)
! 	   :background "grey75" :foreground "black"))
      (((type x) (class mono))
!      (:box (:line-width 1 :style released-button)
! 	   :background "grey" :foreground "black"))
      (t
       ()))
    "Basic tool-bar face."
--- 1784,1796 ----
  
  
  (defface tool-bar
!   '((all
!      :box (:line-width 1 :style released-button)
!      :foreground "black")
!     (((type x w32 mac) (class color))
!      :background "grey75")
      (((type x) (class mono))
!      :background "grey")
      (t
       ()))
    "Basic tool-bar face."


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


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

* Re: mode-line-inactive and face inheritance
  2002-02-18 15:24 ` Stefan Monnier
@ 2002-02-18 19:44   ` Kim F. Storm
  2002-02-18 22:08     ` Stefan Monnier
  2002-02-19 21:30   ` Richard Stallman
  1 sibling, 1 reply; 12+ messages in thread
From: Kim F. Storm @ 2002-02-18 19:44 UTC (permalink / raw)
  Cc: emacs-devel

"Stefan Monnier" <monnier+gnu/emacs@RUM.cs.yale.edu> writes:

> Reminds me that I have a minor hack in faces.el that allows
> slightly more structured specs for faces, so that you can move the
> `:inherit mode-line' outside of any display-specific thing.

I don't quite understand -- the rewritten initialization of
the mode-line-inactive face still has multiple :inherit tags.

> It needs to be cleaned up and documented before it's ready for
> commit, but I'm not even sure if there's any interest in such
> a feature.

Looing at the two rewritten face specs doesn't persuade me this
is desireable in general (the partial structuring doesn't really
make things clearer to me).  But for the :inherit tag, I can see it
could be useful.

What happens if the `all' spec contains a tag which is also in the
specific section? E.g. if all gives one foreground and the specific
section another -- which one wins?  (I would say the specific
section).

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


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

* Re: mode-line-inactive and face inheritance
  2002-02-18 19:44   ` Kim F. Storm
@ 2002-02-18 22:08     ` Stefan Monnier
  0 siblings, 0 replies; 12+ messages in thread
From: Stefan Monnier @ 2002-02-18 22:08 UTC (permalink / raw)
  Cc: Stefan Monnier, emacs-devel

> Looking at the two rewritten face specs doesn't persuade me this
> is desireable in general (the partial structuring doesn't really
> make things clearer to me).

I agree that the structuring tends to be a bit difficult to read.

>  But for the :inherit tag, I can see it could be useful.

That's the main kind of use I had in mind: I hate duplication so I wanted
to reduce duplication between the different arms of a face spec.

> What happens if the `all' spec contains a tag which is also in the
> specific section? E.g. if all gives one foreground and the specific
> section another -- which one wins?  (I would say the specific
> section).

Of course, the specific section should win, although I haven't actually
checked whether that's indeed what happens.


	Stefan


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


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

* Re: mode-line-inactive and face inheritance
  2002-02-18 15:24 ` Stefan Monnier
  2002-02-18 19:44   ` Kim F. Storm
@ 2002-02-19 21:30   ` Richard Stallman
  2002-02-19 22:53     ` Stefan Monnier
  1 sibling, 1 reply; 12+ messages in thread
From: Richard Stallman @ 2002-02-19 21:30 UTC (permalink / raw)
  Cc: eliz, emacs-devel

    More specifically, it adds an `all' entry which (just like `t')
    always matches but doesn't prevent subsequent specs from being
    considered.

That seems useful.  `common' might be clearer than `all'.

		 Also it allows nesting of display-specific specs
    so you can extract the common part of the `light' and `'dark'
    settings for `color' displays.

That seems too complex; I think I would not want to document this
even if it worked.

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


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

* Re: mode-line-inactive and face inheritance
  2002-02-19 21:30   ` Richard Stallman
@ 2002-02-19 22:53     ` Stefan Monnier
  2002-02-22  4:31       ` Richard Stallman
  0 siblings, 1 reply; 12+ messages in thread
From: Stefan Monnier @ 2002-02-19 22:53 UTC (permalink / raw)
  Cc: monnier+gnu/emacs, eliz, emacs-devel

>     More specifically, it adds an `all' entry which (just like `t')
>     always matches but doesn't prevent subsequent specs from being
>     considered.
> That seems useful.  `common' might be clearer than `all'.

Actually, I think we can just reuse t instead of `all' or `common'.
Currently t can only be meaningfully used for the last entry,
so we can simply extend its meaning a little bit in a backward
compatible way.

> 		 Also it allows nesting of display-specific specs
>     so you can extract the common part of the `light' and `'dark'
>     settings for `color' displays.
> 
> That seems too complex; I think I would not want to document this
> even if it worked.

I'm ambivalent about it.  I think it could also make things simpler.
Currently defface accepts a SPEC of the form:

	SPEC     ::= (CONDSPEC CONDSPEC ...)
	CONDSPEC ::= (COND PROPS)
	           | (COND PROP PROP ...)

Where (COND PROPS) is an obsolete form kept for backward compatibility only.
The code I posted changes it to

	SPEC     ::= (CONDSPEC CONDSPEC ...)
	CONDSPEC ::= (COND PROPS)
	           | (COND PROP PROP ...)
	           | (COND CONDSPEC CONDSPEC ...)

But an alternative way to get a similar result would be to use

	SPEC     ::= (CONDSPEC CONDSPEC ...)
	           | (PROP PROP ...)
	CONDSPEC ::= (COND PROPS)
	           | (COND . SPEC)

which has the advantage that a simple defface that has no conditional
part could now be written as

	(defface font-lock-doc-face
	  '(:inherit font-lock-string-face)
	  "Font Lock mode face used to highlight documentation."
	  :group 'font-lock-highlighting-faces)

instead of

	(defface font-lock-doc-face
	  '((t :inherit font-lock-string-face))
	  "Font Lock mode face used to highlight documentation."
	  :group 'font-lock-highlighting-faces)


-- Stefan


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


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

* Re: mode-line-inactive and face inheritance
  2002-02-19 22:53     ` Stefan Monnier
@ 2002-02-22  4:31       ` Richard Stallman
  2002-02-22 16:07         ` Stefan Monnier
  0 siblings, 1 reply; 12+ messages in thread
From: Richard Stallman @ 2002-02-22  4:31 UTC (permalink / raw)
  Cc: monnier+gnu/emacs, eliz, emacs-devel

    Actually, I think we can just reuse t instead of `all' or `common'.
    Currently t can only be meaningfully used for the last entry,
    so we can simply extend its meaning a little bit in a backward
    compatible way.

Even better.

    > 		 Also it allows nesting of display-specific specs
    >     so you can extract the common part of the `light' and `'dark'
    >     settings for `color' displays.
    > 
    > That seems too complex; I think I would not want to document this
    > even if it worked.

    I'm ambivalent about it.  I think it could also make things simpler.

I am thinking about documenting this, and it seems complex, so I think
we should do without it.

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


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

* Re: mode-line-inactive and face inheritance
  2002-02-22  4:31       ` Richard Stallman
@ 2002-02-22 16:07         ` Stefan Monnier
  2002-02-23  5:26           ` Richard Stallman
  0 siblings, 1 reply; 12+ messages in thread
From: Stefan Monnier @ 2002-02-22 16:07 UTC (permalink / raw)
  Cc: monnier+gnu/emacs, eliz, emacs-devel

>     > 		 Also it allows nesting of display-specific specs
>     >     so you can extract the common part of the `light' and `'dark'
>     >     settings for `color' displays.
>     > 
>     > That seems too complex; I think I would not want to document this
>     > even if it worked.
> 
>     I'm ambivalent about it.  I think it could also make things simpler.
> 
> I am thinking about documenting this, and it seems complex, so I think
> we should do without it.

Could explain what's complex about it ?


	Stefan


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


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

* Re: mode-line-inactive and face inheritance
  2002-02-22 16:07         ` Stefan Monnier
@ 2002-02-23  5:26           ` Richard Stallman
  0 siblings, 0 replies; 12+ messages in thread
From: Richard Stallman @ 2002-02-23  5:26 UTC (permalink / raw)
  Cc: monnier+gnu/emacs, eliz, emacs-devel

    Could explain what's complex about it ?

I don't know how to explain a thing like this.  You either see it or
not.

Sorry.


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


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

end of thread, other threads:[~2002-02-23  5:26 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-02-16  7:55 mode-line-inactive and face inheritance Eli Zaretskii
2002-02-16 21:49 ` Kim F. Storm
2002-02-17 16:48 ` Richard Stallman
2002-02-17 18:24   ` Eli Zaretskii
2002-02-18 15:24 ` Stefan Monnier
2002-02-18 19:44   ` Kim F. Storm
2002-02-18 22:08     ` Stefan Monnier
2002-02-19 21:30   ` Richard Stallman
2002-02-19 22:53     ` Stefan Monnier
2002-02-22  4:31       ` Richard Stallman
2002-02-22 16:07         ` Stefan Monnier
2002-02-23  5:26           ` Richard Stallman

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.