emacs-pretest-bug
[Top][All Lists]
Advanced

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

face-alias issues


From: Glenn Morris
Subject: face-alias issues
Date: Tue, 21 Jun 2005 19:07:07 +0100
User-agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)

1. The face-alias mechanism does not seem to be documented anywhere.

2. It seems to have some problems. For example, in faces.el there is

    ;; Make `modeline' an alias for `mode-line', for compatibility.
    (put 'modeline 'face-alias 'mode-line)

(describe-face 'mode-line)
   -> Documentation: Basic mode line face for selected window.
   [details of face]

(describe-face 'modeline)
   -> Documentation: Not documented as a face.
   [details of face]

Maybe a patch something like the following?

Index: faces.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/faces.el,v
retrieving revision 1.319
diff -c -c -w -r1.319 faces.el
*** faces.el  20 Jun 2005 10:45:28 -0000 1.319
--- faces.el  21 Jun 2005 17:41:13 -0000
***************
*** 514,520 ****
  
  (defun face-documentation (face)
    "Get the documentation string for FACE."
!   (get face 'face-documentation))
  
  
  (defun set-face-documentation (face string)
--- 514,529 ----
  
  (defun face-documentation (face)
    "Get the documentation string for FACE."
!   (let ((alias (get face 'face-alias))
!         doc)
!     (if alias
!         (progn
!           ;; (face-documentation alias)?
!           (setq doc (get alias 'face-documentation))
!           (format "%s is an alias for the face `%s'.%s" face alias
!                   (if doc (format "\n%s" doc)
!                     "")))
!       (get face 'face-documentation))))


The "Defined in <filename>" bit still doesn't work, but I don't think
it can, given the mechanism.


3. (set-face-foreground 'modeline "red")

The face mode-line is changed, but

(customize-face 'mode-line)
   -> this face is unchanged from its standard setting.
    (or the somewhat less friendly "STANDARD" as it seems to use now).


Maybe something like the following patch?

Perhaps a `resolve-face-name' or somesuch that expands face aliases to the
actual faces they point to might be useful?


***************
*** 661,667 ****
      (setq args (purecopy args))
      ;; If we set the new-frame defaults, this face is modified
*** outside Custom.
      (if (memq where '(0 t))
!     (put face 'face-modified t))
      (while args
        (internal-set-lisp-face-attribute face (car args)
                                                     (purecopy (cadr
*** args))
--- 670,676 ----
      (setq args (purecopy args))
      ;; If we set the new-frame defaults, this face is modified
*** outside Custom.
      (if (memq where '(0 t))
!     (put (or (get face 'face-alias) face) 'face-modified t))
      (while args
        (internal-set-lisp-face-attribute face (car args)
                                                     (purecopy (cadr
*** args))
***************
*** 1443,1449 ****
    ;; When we reset the face based on its spec, then it is unmodified
    ;; as far as Custom is concerned.
    (if (null frame)
!       (put face 'face-modified nil)))
  
  
  (defun face-attr-match-p (face attrs &optional frame)
--- 1452,1458 ----
    ;; When we reset the face based on its spec, then it is unmodified
    ;; as far as Custom is concerned.
    (if (null frame)
!       (put (or (get face 'face-alias) face) 'face-modified nil)))
  
  
  (defun face-attr-match-p (face attrs &optional frame)




reply via email to

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