emacs-devel
[Top][All Lists]
Advanced

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

Re: Customizing faces with `defcustom'


From: Juri Linkov
Subject: Re: Customizing faces with `defcustom'
Date: Fri, 30 Dec 2005 08:29:42 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

>     There should be a special separate face for the mode line.  What would
>     be a good name for it?  `mode-line-buffer'?  This is too specific.
>
> `mode-line-buffer' would be a good name for a face used only to
> highlight buffer names.  But if we want something a little
> more general, how about `mode-line-emphasis'?

I now think the best name would be the same as the variable name whose
propertized value is used in the mode-line to display buffer information.
I mean the variable `mode-line-buffer-identification'.  However, it is
too long for the face name, and the suffix `-identification' or even a
shorter one `-id' doesn't make the purpose of the face name clearer.

Selecting a good face name will also set up a rule for naming more
mode line faces that could be added after the release, e.g.
(existing variable vs. new face name):

mode-line-mule-info variable - mode-line-mule face
mode-line-modified variable - mode-line-modified face
mode-line-frame-identification variable - mode-line-frame face
mode-line-position variable - mode-line-position face
vc-mode variable - mode-line-vc-mode face
mode-line-modes variable - mode-line-modes face
...

So taking this into account, for now a good face name for buffer
information in the mode line would be `mode-line-buffer'.

In the patch below I added a new group `mode-line-faces'
with the following faces belonging to it:

mode-line
mode-line-inactive
mode-line-highlight
mode-line-buffer (new face)
display-time-mail-face

Index: lisp/faces.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/faces.el,v
retrieving revision 1.345
diff -c -r1.345 faces.el
*** lisp/faces.el       11 Dec 2005 11:08:34 -0000      1.345
--- lisp/faces.el       30 Dec 2005 06:27:47 -0000
***************
*** 1932,1937 ****
--- 1932,1943 ----
    "Basic face for highlighting."
    :group 'basic-faces)
  
+ (defgroup mode-line-faces nil
+   "Faces used in the mode line."
+   :group 'modeline
+   :group 'faces
+   :version "22.1")
+ 
  (defface mode-line-highlight
    '((((class color) (min-colors 88))
       :box (:line-width 2 :color "grey40" :style released-button))
***************
*** 1939,1945 ****
       :inherit highlight))
    "Basic mode line face for highlighting."
    :version "22.1"
!   :group 'modeline
    :group 'basic-faces)
  
  (defface region
--- 1945,1951 ----
       :inherit highlight))
    "Basic mode line face for highlighting."
    :version "22.1"
!   :group 'mode-line-faces
    :group 'basic-faces)
  
  (defface region
***************
*** 2014,2020 ****
       :inverse-video t))
    "Basic mode line face for selected window."
    :version "21.1"
!   :group 'modeline
    :group 'basic-faces)
  
  (defface mode-line-inactive
--- 2020,2026 ----
       :inverse-video t))
    "Basic mode line face for selected window."
    :version "21.1"
!   :group 'mode-line-faces
    :group 'basic-faces)
  
  (defface mode-line-inactive
***************
*** 2030,2036 ****
       :foreground "grey80" :background "grey30"))
    "Basic mode line face for non-selected windows."
    :version "22.1"
!   :group 'modeline
    :group 'basic-faces)
  
  ;; Make `modeline' an alias for `mode-line', for compatibility.
--- 2036,2042 ----
       :foreground "grey80" :background "grey30"))
    "Basic mode line face for non-selected windows."
    :version "22.1"
!   :group 'mode-line-faces
    :group 'basic-faces)
  
  ;; Make `modeline' an alias for `mode-line', for compatibility.
***************
*** 2038,2043 ****
--- 2044,2055 ----
  (put 'modeline-inactive 'face-alias 'mode-line-inactive)
  (put 'modeline-highlight 'face-alias 'mode-line-highlight)
  
+ (defface mode-line-buffer
+   '((t (:weight bold)))
+   "Face used to highlight buffer identification parts of the mode line."
+   :version "22.1"
+   :group 'mode-line-faces)
+ 
  (defface header-line
    '((default
       :inherit mode-line)
***************
*** 2077,2083 ****
    '((((type tty)) :inherit mode-line-inactive))
    "Face used for vertical window dividers on ttys."
    :version "22.1"
-   :group 'modeline
    :group 'basic-faces)
  
  (defface minibuffer-prompt
--- 2089,2094 ----

Index: lisp/bindings.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/bindings.el,v
retrieving revision 1.155
diff -c -r1.155 bindings.el
*** lisp/bindings.el    16 Dec 2005 11:35:25 -0000      1.155
--- lisp/bindings.el    30 Dec 2005 06:27:52 -0000
***************
*** 449,455 ****
  FMT is a format specifier such as \"%12b\".  This function adds
  text properties for face, help-echo, and local-map to it."
    (list (propertize fmt
!                   'face 'Buffer-menu-buffer
                    'help-echo
                    (purecopy "mouse-1: previous buffer, mouse-3: next buffer")
                    'mouse-face 'mode-line-highlight
--- 449,455 ----
  FMT is a format specifier such as \"%12b\".  This function adds
  text properties for face, help-echo, and local-map to it."
    (list (propertize fmt
!                   'face 'mode-line-buffer
                    'help-echo
                    (purecopy "mouse-1: previous buffer, mouse-3: next buffer")
                    'mouse-face 'mode-line-highlight

Index: lisp/time.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/time.el,v
retrieving revision 1.88
diff -c -r1.88 time.el
*** lisp/time.el        11 Aug 2005 01:53:17 -0000      1.88
--- lisp/time.el        30 Dec 2005 06:27:02 -0000
***************
*** 129,135 ****
  If `display-time-use-mail-icon' is non-nil, the image's
  background color is the background of this face.  Set this to
  make the mail indicator stand out on a color display."
!   :group 'faces
    :group 'display-time
    :version "22.1"
    :type '(choice (const :tag "None" nil) face))
--- 129,135 ----
  If `display-time-use-mail-icon' is non-nil, the image's
  background color is the background of this face.  Set this to
  make the mail indicator stand out on a color display."
!   :group 'mode-line-faces
    :group 'display-time
    :version "22.1"
    :type '(choice (const :tag "None" nil) face))

Index: lisp/info.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/info.el,v
retrieving revision 1.469
diff -c -r1.469 info.el
*** lisp/info.el        23 Dec 2005 21:52:00 -0000      1.469
--- lisp/info.el        30 Dec 2005 06:27:28 -0000
***************
*** 1403,1410 ****
                (concat " ("
                        (if Info-current-file
                            (file-name-nondirectory Info-current-file)
!                         " ")
!                       ") " (or Info-current-node ""))))))
  
  ;; Go to an Info node specified with a filename-and-nodename string
  ;; of the sort that is found in pointers in nodes.
--- 1403,1414 ----
                (concat " ("
                        (if Info-current-file
                            (file-name-nondirectory Info-current-file)
!                         "")
!                       ") "
!                       (if Info-current-node
!                           (propertize Info-current-node
!                                       'face 'mode-line-buffer)
!                         ""))))))
  
  ;; Go to an Info node specified with a filename-and-nodename string
  ;; of the sort that is found in pointers in nodes.

-- 
Juri Linkov
http://www.jurta.org/emacs/





reply via email to

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