emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mode-line-inactive and face inheritance


From: Stefan Monnier
Subject: Re: mode-line-inactive and face inheritance
Date: Mon, 18 Feb 2002 10:24:40 -0500

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]