diff options
| author | Miles Bader | 2001-10-05 13:06:51 +0000 |
|---|---|---|
| committer | Miles Bader | 2001-10-05 13:06:51 +0000 |
| commit | c165ad4044ba73d15aa77db7ce418d281a6f0236 (patch) | |
| tree | 8ac96398b5e96ac33cc3ad820c4e868510a88541 | |
| parent | 3ea051cb610eb5b2187600ad6a795ac8138697cb (diff) | |
| download | emacs-c165ad4044ba73d15aa77db7ce418d281a6f0236.tar.gz emacs-c165ad4044ba73d15aa77db7ce418d281a6f0236.zip | |
(custom-face-attributes): Make sure each attribute has a valid default
value. Remove hacks that mapped `nil' to `off' and used nil to mean
`unspecified'. Remove `unspecified' choices from all attributes
(unspecified is handled by the parent checklist).
| -rw-r--r-- | lisp/ChangeLog | 16 | ||||
| -rw-r--r-- | lisp/cus-face.el | 110 |
2 files changed, 60 insertions, 66 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 833f3101e2a..3fcad66a857 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,19 @@ | |||
| 1 | 2001-10-05 Miles Bader <miles@gnu.org> | ||
| 2 | |||
| 3 | * cus-face.el (custom-face-attributes): Make sure each attribute | ||
| 4 | has a valid default value. Remove hacks that mapped `nil' to | ||
| 5 | `off' and used nil to mean `unspecified'. Remove `unspecified' | ||
| 6 | choices from all attributes (unspecified is handled by the parent | ||
| 7 | checklist). | ||
| 8 | * cus-edit.el (custom-face-edit-convert-widget) | ||
| 9 | (custom-face-edit-deactivate, custom-face-edit-activate) | ||
| 10 | (custom-face-edit-delete, custom-face-edit-attribute-tag): | ||
| 11 | New functions. | ||
| 12 | (custom-face-edit): Specify a custom :convert-widget. | ||
| 13 | (custom-pre-filter-face-spec, custom-post-filter-face-spec): | ||
| 14 | Don't pass in default filters that map between `nil' and `off' and | ||
| 15 | `unspecified' and `nil'. | ||
| 16 | |||
| 1 | 2001-10-05 Gerd Moellmann <gerd@gnu.org> | 17 | 2001-10-05 Gerd Moellmann <gerd@gnu.org> |
| 2 | 18 | ||
| 3 | * progmodes/compile.el (compilation-buffer-name): New function. | 19 | * progmodes/compile.el (compilation-buffer-name): New function. |
diff --git a/lisp/cus-face.el b/lisp/cus-face.el index 2a2693c5f1a..a55dbd6eb90 100644 --- a/lisp/cus-face.el +++ b/lisp/cus-face.el | |||
| @@ -62,23 +62,15 @@ | |||
| 62 | 62 | ||
| 63 | ;;; Face attributes. | 63 | ;;; Face attributes. |
| 64 | 64 | ||
| 65 | ;; Below, nil is used in widget specifications for `unspecified' face | ||
| 66 | ;; attributes and `off' is used instead of nil attribute values. The | ||
| 67 | ;; reason for this is that nil corresponds to the result you get when | ||
| 68 | ;; looking up an attribute in a defface spec that isn't contained in | ||
| 69 | ;; the spec. | ||
| 70 | |||
| 71 | (defconst custom-face-attributes | 65 | (defconst custom-face-attributes |
| 72 | '((:family | 66 | '((:family |
| 73 | (choice :tag "Font family" | 67 | (string :tag "Font Family" |
| 74 | :help-echo "Font family or fontset alias name." | 68 | :help-echo "Font family or fontset alias name.")) |
| 75 | (const :tag "*" nil) | ||
| 76 | (string :tag "Family"))) | ||
| 77 | 69 | ||
| 78 | (:width | 70 | (:width |
| 79 | (choice :tag "Width" | 71 | (choice :tag "Width" |
| 80 | :help-echo "Font width." | 72 | :help-echo "Font width." |
| 81 | (const :tag "*" nil) | 73 | :value normal ; default |
| 82 | (const :tag "compressed" condensed) | 74 | (const :tag "compressed" condensed) |
| 83 | (const :tag "condensed" condensed) | 75 | (const :tag "condensed" condensed) |
| 84 | (const :tag "demiexpanded" semi-expanded) | 76 | (const :tag "demiexpanded" semi-expanded) |
| @@ -98,14 +90,14 @@ | |||
| 98 | (:height | 90 | (:height |
| 99 | (choice :tag "Height" | 91 | (choice :tag "Height" |
| 100 | :help-echo "Face's font height." | 92 | :help-echo "Face's font height." |
| 101 | (const :tag "*" nil) | 93 | :value 1.0 ; default |
| 102 | (integer :tag "Height in 1/10 pt") | 94 | (integer :tag "Height in 1/10 pt") |
| 103 | (number :tag "Scale" 1.0))) | 95 | (number :tag "Scale" 1.0))) |
| 104 | 96 | ||
| 105 | (:weight | 97 | (:weight |
| 106 | (choice :tag "Weight" | 98 | (choice :tag "Weight" |
| 107 | :help-echo "Font weight." | 99 | :help-echo "Font weight." |
| 108 | (const :tag "*" nil) | 100 | :value normal ; default |
| 109 | (const :tag "black" ultra_bold) | 101 | (const :tag "black" ultra_bold) |
| 110 | (const :tag "bold" bold) | 102 | (const :tag "bold" bold) |
| 111 | (const :tag "book" semi-light) | 103 | (const :tag "book" semi-light) |
| @@ -125,7 +117,7 @@ | |||
| 125 | (:slant | 117 | (:slant |
| 126 | (choice :tag "Slant" | 118 | (choice :tag "Slant" |
| 127 | :help-echo "Font slant." | 119 | :help-echo "Font slant." |
| 128 | (const :tag "*" nil) | 120 | :value normal ; default |
| 129 | (const :tag "italic" italic) | 121 | (const :tag "italic" italic) |
| 130 | (const :tag "oblique" oblique) | 122 | (const :tag "oblique" oblique) |
| 131 | (const :tag "normal" normal))) | 123 | (const :tag "normal" normal))) |
| @@ -133,33 +125,29 @@ | |||
| 133 | (:underline | 125 | (:underline |
| 134 | (choice :tag "Underline" | 126 | (choice :tag "Underline" |
| 135 | :help-echo "Control text underlining." | 127 | :help-echo "Control text underlining." |
| 136 | (const :tag "*" nil) | 128 | (const :tag "Off" nil) |
| 137 | (const :tag "On" t) | 129 | (const :tag "On" t) |
| 138 | (const :tag "Off" off) | ||
| 139 | (color :tag "Colored"))) | 130 | (color :tag "Colored"))) |
| 140 | 131 | ||
| 141 | (:overline | 132 | (:overline |
| 142 | (choice :tag "Overline" | 133 | (choice :tag "Overline" |
| 143 | :help-echo "Control text overlining." | 134 | :help-echo "Control text overlining." |
| 144 | (const :tag "*" nil) | 135 | (const :tag "Off" nil) |
| 145 | (const :tag "On" t) | 136 | (const :tag "On" t) |
| 146 | (const :tag "Off" off) | ||
| 147 | (color :tag "Colored"))) | 137 | (color :tag "Colored"))) |
| 148 | 138 | ||
| 149 | (:strike-through | 139 | (:strike-through |
| 150 | (choice :tag "Strike-through" | 140 | (choice :tag "Strike-through" |
| 151 | :help-echo "Control text strike-through." | 141 | :help-echo "Control text strike-through." |
| 152 | (const :tag "*" nil) | 142 | (const :tag "Off" nil) |
| 153 | (const :tag "On" t) | 143 | (const :tag "On" t) |
| 154 | (const :tag "Off" off) | ||
| 155 | (color :tag "Colored"))) | 144 | (color :tag "Colored"))) |
| 156 | 145 | ||
| 157 | (:box | 146 | (:box |
| 158 | ;; Fixme: this can probably be done better. | 147 | ;; Fixme: this can probably be done better. |
| 159 | (choice :tag "Box around text" | 148 | (choice :tag "Box around text" |
| 160 | :help-echo "Control box around text." | 149 | :help-echo "Control box around text." |
| 161 | (const :tag "*" nil) | 150 | (const :tag "Off" nil) |
| 162 | (const :tag "Off" off) | ||
| 163 | (list :tag "Box" | 151 | (list :tag "Box" |
| 164 | :value (:line-width 2 :color "grey75" :style released-button) | 152 | :value (:line-width 2 :color "grey75" :style released-button) |
| 165 | (const :format "" :value :line-width) | 153 | (const :format "" :value :line-width) |
| @@ -173,64 +161,54 @@ | |||
| 173 | (const :tag "None" nil)))) | 161 | (const :tag "None" nil)))) |
| 174 | ;; filter to make value suitable for customize | 162 | ;; filter to make value suitable for customize |
| 175 | (lambda (real-value) | 163 | (lambda (real-value) |
| 176 | (if (null real-value) | 164 | (and real-value |
| 177 | 'off | 165 | (let ((lwidth |
| 178 | (let ((lwidth | 166 | (or (and (consp real-value) |
| 179 | (or (and (consp real-value) (plist-get real-value :line-width)) | 167 | (plist-get real-value :line-width)) |
| 180 | (and (integerp real-value) real-value) | 168 | (and (integerp real-value) real-value) |
| 181 | 1)) | 169 | 1)) |
| 182 | (color | 170 | (color |
| 183 | (or (and (consp real-value) (plist-get real-value :color)) | 171 | (or (and (consp real-value) (plist-get real-value :color)) |
| 184 | (and (stringp real-value) real-value) | 172 | (and (stringp real-value) real-value) |
| 185 | nil)) | 173 | nil)) |
| 186 | (style | 174 | (style |
| 187 | (and (consp real-value) (plist-get real-value :style)))) | 175 | (and (consp real-value) (plist-get real-value :style)))) |
| 188 | (list :line-width lwidth :color color :style style)))) | 176 | (list :line-width lwidth :color color :style style)))) |
| 189 | ;; filter to make customized-value suitable for storing | 177 | ;; filter to make customized-value suitable for storing |
| 190 | (lambda (cus-value) | 178 | (lambda (cus-value) |
| 191 | (cond ((null cus-value) | 179 | (and cus-value |
| 192 | 'unspecified) | 180 | (let ((lwidth (plist-get cus-value :line-width)) |
| 193 | ((eq cus-value 'off) | 181 | (color (plist-get cus-value :color)) |
| 194 | nil) | 182 | (style (plist-get cus-value :style))) |
| 195 | (t | 183 | (cond ((and (null color) (null style)) |
| 196 | (let ((lwidth (plist-get cus-value :line-width)) | 184 | lwidth) |
| 197 | (color (plist-get cus-value :color)) | 185 | ((and (null lwidth) (null style)) |
| 198 | (style (plist-get cus-value :style))) | 186 | ;; actually can't happen, because LWIDTH is always an int |
| 199 | (cond ((and (null color) (null style)) | 187 | color) |
| 200 | lwidth) | 188 | (t |
| 201 | ((and (null lwidth) (null style)) | 189 | ;; Keep as a plist, but remove null entries |
| 202 | ;; actually can't happen, because LWIDTH is always an int | 190 | (nconc (and lwidth `(:line-width ,lwidth)) |
| 203 | color) | 191 | (and color `(:color ,color)) |
| 204 | (t | 192 | (and style `(:style ,style))))))))) |
| 205 | ;; Keep as a plist, but remove null entries | ||
| 206 | (nconc (and lwidth `(:line-width ,lwidth)) | ||
| 207 | (and color `(:color ,color)) | ||
| 208 | (and style `(:style ,style)))))))))) | ||
| 209 | 193 | ||
| 210 | (:inverse-video | 194 | (:inverse-video |
| 211 | (choice :tag "Inverse-video" | 195 | (choice :tag "Inverse-video" |
| 212 | :help-echo "Control whether text should be in inverse-video." | 196 | :help-echo "Control whether text should be in inverse-video." |
| 213 | (const :tag "*" nil) | 197 | (const :tag "Off" nil) |
| 214 | (const :tag "On" t) | 198 | (const :tag "On" t))) |
| 215 | (const :tag "Off" off))) | ||
| 216 | 199 | ||
| 217 | (:foreground | 200 | (:foreground |
| 218 | (choice :tag "Foreground" | 201 | (color :tag "Foreground" |
| 219 | :help-echo "Set foreground color." | 202 | :help-echo "Set foreground color.")) |
| 220 | (const :tag "*" nil) | ||
| 221 | (color :tag "Color"))) | ||
| 222 | 203 | ||
| 223 | (:background | 204 | (:background |
| 224 | (choice :tag "Background" | 205 | (color :tag "Background" |
| 225 | :help-echo "Set background color." | 206 | :help-echo "Set background color.")) |
| 226 | (const :tag "*" nil) | ||
| 227 | (color :tag "Color"))) | ||
| 228 | 207 | ||
| 229 | (:stipple | 208 | (:stipple |
| 230 | (choice :tag "Stipple" | 209 | (choice :tag "Stipple" |
| 231 | :help-echo "Background bit-mask" | 210 | :help-echo "Background bit-mask" |
| 232 | (const :tag "*" nil) | 211 | (const :tag "None" nil) |
| 233 | (const :tag "None" off) | ||
| 234 | (file :tag "File" | 212 | (file :tag "File" |
| 235 | :help-echo "Name of bitmap file." | 213 | :help-echo "Name of bitmap file." |
| 236 | :must-match t))) | 214 | :must-match t))) |