Mercurial > emacs
comparison lisp/faces.el @ 10105:249d94c7e4f1
(face-name, face-id, face-foreground, face-background)
(face-font, face-stipple, face-underline-p): Change defsubst to defun.
(set-face-font, set-face-foreground, set-face-background)
(set-face-stipple, set-face-underline-p): Change defsubst to defun.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 04 Dec 1994 14:18:45 +0000 |
parents | 30e0dc7c07cd |
children | 2af74ff52cd0 |
comparison
equal
deleted
inserted
replaced
10104:8a04af3511c1 | 10105:249d94c7e4f1 |
---|---|
37 (defmacro internal-check-face (face) | 37 (defmacro internal-check-face (face) |
38 (` (while (not (internal-facep (, face))) | 38 (` (while (not (internal-facep (, face))) |
39 (setq (, face) (signal 'wrong-type-argument (list 'internal-facep (, face))))))) | 39 (setq (, face) (signal 'wrong-type-argument (list 'internal-facep (, face))))))) |
40 | 40 |
41 ;;; Accessors. | 41 ;;; Accessors. |
42 (defsubst face-name (face) | 42 (defun face-name (face) |
43 "Return the name of face FACE." | 43 "Return the name of face FACE." |
44 (aref (internal-get-face face) 1)) | 44 (aref (internal-get-face face) 1)) |
45 | 45 |
46 (defsubst face-id (face) | 46 (defun face-id (face) |
47 "Return the internal ID number of face FACE." | 47 "Return the internal ID number of face FACE." |
48 (aref (internal-get-face face) 2)) | 48 (aref (internal-get-face face) 2)) |
49 | 49 |
50 (defsubst face-font (face &optional frame) | 50 (defun face-font (face &optional frame) |
51 "Return the font name of face FACE, or nil if it is unspecified. | 51 "Return the font name of face FACE, or nil if it is unspecified. |
52 If the optional argument FRAME is given, report on face FACE in that frame. | 52 If the optional argument FRAME is given, report on face FACE in that frame. |
53 If FRAME is t, report on the defaults for face FACE (for new frames). | 53 If FRAME is t, report on the defaults for face FACE (for new frames). |
54 The font default for a face is either nil, or a list | 54 The font default for a face is either nil, or a list |
55 of the form (bold), (italic) or (bold italic). | 55 of the form (bold), (italic) or (bold italic). |
56 If FRAME is omitted or nil, use the selected frame." | 56 If FRAME is omitted or nil, use the selected frame." |
57 (aref (internal-get-face face frame) 3)) | 57 (aref (internal-get-face face frame) 3)) |
58 | 58 |
59 (defsubst face-foreground (face &optional frame) | 59 (defun face-foreground (face &optional frame) |
60 "Return the foreground color name of face FACE, or nil if unspecified. | 60 "Return the foreground color name of face FACE, or nil if unspecified. |
61 If the optional argument FRAME is given, report on face FACE in that frame. | 61 If the optional argument FRAME is given, report on face FACE in that frame. |
62 If FRAME is t, report on the defaults for face FACE (for new frames). | 62 If FRAME is t, report on the defaults for face FACE (for new frames). |
63 If FRAME is omitted or nil, use the selected frame." | 63 If FRAME is omitted or nil, use the selected frame." |
64 (aref (internal-get-face face frame) 4)) | 64 (aref (internal-get-face face frame) 4)) |
65 | 65 |
66 (defsubst face-background (face &optional frame) | 66 (defun face-background (face &optional frame) |
67 "Return the background color name of face FACE, or nil if unspecified. | 67 "Return the background color name of face FACE, or nil if unspecified. |
68 If the optional argument FRAME is given, report on face FACE in that frame. | 68 If the optional argument FRAME is given, report on face FACE in that frame. |
69 If FRAME is t, report on the defaults for face FACE (for new frames). | 69 If FRAME is t, report on the defaults for face FACE (for new frames). |
70 If FRAME is omitted or nil, use the selected frame." | 70 If FRAME is omitted or nil, use the selected frame." |
71 (aref (internal-get-face face frame) 5)) | 71 (aref (internal-get-face face frame) 5)) |
72 | 72 |
73 (defsubst face-stipple (face &optional frame) | 73 (defun face-stipple (face &optional frame) |
74 "Return the stipple pixmap name of face FACE, or nil if unspecified. | 74 "Return the stipple pixmap name of face FACE, or nil if unspecified. |
75 If the optional argument FRAME is given, report on face FACE in that frame. | 75 If the optional argument FRAME is given, report on face FACE in that frame. |
76 If FRAME is t, report on the defaults for face FACE (for new frames). | 76 If FRAME is t, report on the defaults for face FACE (for new frames). |
77 If FRAME is omitted or nil, use the selected frame." | 77 If FRAME is omitted or nil, use the selected frame." |
78 (aref (internal-get-face face frame) 6)) | 78 (aref (internal-get-face face frame) 6)) |
79 | 79 |
80 (defalias 'face-background-pixmap 'face-stipple) | 80 (defalias 'face-background-pixmap 'face-stipple) |
81 | 81 |
82 (defsubst face-underline-p (face &optional frame) | 82 (defun face-underline-p (face &optional frame) |
83 "Return t if face FACE is underlined. | 83 "Return t if face FACE is underlined. |
84 If the optional argument FRAME is given, report on face FACE in that frame. | 84 If the optional argument FRAME is given, report on face FACE in that frame. |
85 If FRAME is t, report on the defaults for face FACE (for new frames). | 85 If FRAME is t, report on the defaults for face FACE (for new frames). |
86 If FRAME is omitted or nil, use the selected frame." | 86 If FRAME is omitted or nil, use the selected frame." |
87 (aref (internal-get-face face frame) 7)) | 87 (aref (internal-get-face face frame) 7)) |
88 | 88 |
89 | 89 |
90 ;;; Mutators. | 90 ;;; Mutators. |
91 | 91 |
92 (defsubst set-face-font (face font &optional frame) | 92 (defun set-face-font (face font &optional frame) |
93 "Change the font of face FACE to FONT (a string). | 93 "Change the font of face FACE to FONT (a string). |
94 If the optional FRAME argument is provided, change only | 94 If the optional FRAME argument is provided, change only |
95 in that frame; otherwise change each frame." | 95 in that frame; otherwise change each frame." |
96 (interactive (internal-face-interactive "font")) | 96 (interactive (internal-face-interactive "font")) |
97 (if (stringp font) (setq font (x-resolve-font-name font face frame))) | 97 (if (stringp font) (setq font (x-resolve-font-name font face frame))) |
98 (internal-set-face-1 face 'font font 3 frame)) | 98 (internal-set-face-1 face 'font font 3 frame)) |
99 | 99 |
100 (defsubst set-face-foreground (face color &optional frame) | 100 (defun set-face-foreground (face color &optional frame) |
101 "Change the foreground color of face FACE to COLOR (a string). | 101 "Change the foreground color of face FACE to COLOR (a string). |
102 If the optional FRAME argument is provided, change only | 102 If the optional FRAME argument is provided, change only |
103 in that frame; otherwise change each frame." | 103 in that frame; otherwise change each frame." |
104 (interactive (internal-face-interactive "foreground")) | 104 (interactive (internal-face-interactive "foreground")) |
105 (internal-set-face-1 face 'foreground color 4 frame)) | 105 (internal-set-face-1 face 'foreground color 4 frame)) |
106 | 106 |
107 (defsubst set-face-background (face color &optional frame) | 107 (defun set-face-background (face color &optional frame) |
108 "Change the background color of face FACE to COLOR (a string). | 108 "Change the background color of face FACE to COLOR (a string). |
109 If the optional FRAME argument is provided, change only | 109 If the optional FRAME argument is provided, change only |
110 in that frame; otherwise change each frame." | 110 in that frame; otherwise change each frame." |
111 (interactive (internal-face-interactive "background")) | 111 (interactive (internal-face-interactive "background")) |
112 ;; For a specific frame, use gray stipple instead of gray color | 112 ;; For a specific frame, use gray stipple instead of gray color |
116 (not (x-display-color-p frame)) | 116 (not (x-display-color-p frame)) |
117 (not (x-display-grayscale-p frame))) | 117 (not (x-display-grayscale-p frame))) |
118 (set-face-stipple face color frame) | 118 (set-face-stipple face color frame) |
119 (internal-set-face-1 face 'background color 5 frame))) | 119 (internal-set-face-1 face 'background color 5 frame))) |
120 | 120 |
121 (defsubst set-face-stipple (face name &optional frame) | 121 (defun set-face-stipple (face name &optional frame) |
122 "Change the stipple pixmap of face FACE to PIXMAP. | 122 "Change the stipple pixmap of face FACE to PIXMAP. |
123 PIXMAP should be a string, the name of a file of pixmap data. | 123 PIXMAP should be a string, the name of a file of pixmap data. |
124 The directories listed in the `x-bitmap-file-path' variable are searched. | 124 The directories listed in the `x-bitmap-file-path' variable are searched. |
125 | 125 |
126 Alternatively, PIXMAP may be a list of the form (WIDTH HEIGHT DATA) | 126 Alternatively, PIXMAP may be a list of the form (WIDTH HEIGHT DATA) |
132 (interactive (internal-face-interactive "stipple")) | 132 (interactive (internal-face-interactive "stipple")) |
133 (internal-set-face-1 face 'background-pixmap name 6 frame)) | 133 (internal-set-face-1 face 'background-pixmap name 6 frame)) |
134 | 134 |
135 (defalias 'set-face-background-pixmap 'set-face-stipple) | 135 (defalias 'set-face-background-pixmap 'set-face-stipple) |
136 | 136 |
137 (defsubst set-face-underline-p (face underline-p &optional frame) | 137 (defun set-face-underline-p (face underline-p &optional frame) |
138 "Specify whether face FACE is underlined. (Yes if UNDERLINE-P is non-nil.) | 138 "Specify whether face FACE is underlined. (Yes if UNDERLINE-P is non-nil.) |
139 If the optional FRAME argument is provided, change only | 139 If the optional FRAME argument is provided, change only |
140 in that frame; otherwise change each frame." | 140 in that frame; otherwise change each frame." |
141 (interactive (internal-face-interactive "underline-p" "underlined")) | 141 (interactive (internal-face-interactive "underline-p" "underlined")) |
142 (internal-set-face-1 face 'underline underline-p 7 frame)) | 142 (internal-set-face-1 face 'underline underline-p 7 frame)) |