unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Stefan Monnier" <monnier+gnu/emacs@RUM.cs.yale.edu>
Cc: emacs-devel@gnu.org
Subject: Re: mode-line-inactive and face inheritance
Date: Mon, 18 Feb 2002 10:24:40 -0500	[thread overview]
Message-ID: <200202181524.g1IFOe210109@rum.cs.yale.edu> (raw)
In-Reply-To: 9003-Sat16Feb2002095527+0200-eliz@is.elta.co.il

> 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


  parent reply	other threads:[~2002-02-18 15:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200202181524.g1IFOe210109@rum.cs.yale.edu \
    --to=monnier+gnu/emacs@rum.cs.yale.edu \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).