Mercurial > emacs
comparison lisp/faces.el @ 63660:47c90f7c23df
(face-documentation, set-face-attribute)
(face-spec-set): Handle face aliases.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Wed, 22 Jun 2005 14:20:18 +0000 |
parents | 906515736089 |
children | 7f05fee725b0 |
comparison
equal
deleted
inserted
replaced
63659:ce9e9d1055bf | 63660:47c90f7c23df |
---|---|
511 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 511 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
512 ;;; Face documentation. | 512 ;;; Face documentation. |
513 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 513 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
514 | 514 |
515 (defun face-documentation (face) | 515 (defun face-documentation (face) |
516 "Get the documentation string for FACE." | 516 "Get the documentation string for FACE. |
517 (get face 'face-documentation)) | 517 If FACE is a face-alias, get the documentation for the target face." |
518 (let ((alias (get face 'face-alias)) | |
519 doc) | |
520 (if alias | |
521 (progn | |
522 (setq doc (get alias 'face-documentation)) | |
523 (format "%s is an alias for the face `%s'.%s" face alias | |
524 (if doc (format "\n%s" doc) | |
525 ""))) | |
526 (get face 'face-documentation)))) | |
518 | 527 |
519 | 528 |
520 (defun set-face-documentation (face string) | 529 (defun set-face-documentation (face string) |
521 "Set the documentation string for FACE to STRING." | 530 "Set the documentation string for FACE to STRING." |
522 ;; Perhaps the text should go in DOC. | 531 ;; Perhaps the text should go in DOC. |
659 like an underlying face would be, with higher priority than underlying faces." | 668 like an underlying face would be, with higher priority than underlying faces." |
660 (let ((where (if (null frame) 0 frame))) | 669 (let ((where (if (null frame) 0 frame))) |
661 (setq args (purecopy args)) | 670 (setq args (purecopy args)) |
662 ;; If we set the new-frame defaults, this face is modified outside Custom. | 671 ;; If we set the new-frame defaults, this face is modified outside Custom. |
663 (if (memq where '(0 t)) | 672 (if (memq where '(0 t)) |
664 (put face 'face-modified t)) | 673 (put (or (get face 'face-alias) face) 'face-modified t)) |
665 (while args | 674 (while args |
666 (internal-set-lisp-face-attribute face (car args) | 675 (internal-set-lisp-face-attribute face (car args) |
667 (purecopy (cadr args)) | 676 (purecopy (cadr args)) |
668 where) | 677 where) |
669 (setq args (cdr (cdr args)))))) | 678 (setq args (cdr (cdr args)))))) |
1441 (set-face-attribute face frame attribute value))) | 1450 (set-face-attribute face frame attribute value))) |
1442 (setq attrs (cdr (cdr attrs))))) | 1451 (setq attrs (cdr (cdr attrs))))) |
1443 ;; When we reset the face based on its spec, then it is unmodified | 1452 ;; When we reset the face based on its spec, then it is unmodified |
1444 ;; as far as Custom is concerned. | 1453 ;; as far as Custom is concerned. |
1445 (if (null frame) | 1454 (if (null frame) |
1446 (put face 'face-modified nil))) | 1455 (put (or (get face 'face-alias) face) 'face-modified nil))) |
1447 | 1456 |
1448 | 1457 |
1449 (defun face-attr-match-p (face attrs &optional frame) | 1458 (defun face-attr-match-p (face attrs &optional frame) |
1450 "Return t if attributes of FACE match values in plist ATTRS. | 1459 "Return t if attributes of FACE match values in plist ATTRS. |
1451 Optional parameter FRAME is the frame whose definition of FACE | 1460 Optional parameter FRAME is the frame whose definition of FACE |