aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2006-01-13 02:30:03 +0000
committerChong Yidong2006-01-13 02:30:03 +0000
commit4c92479f1bd20db9cf21221f5bae1d2b03b370b9 (patch)
treef6d0eeaa7646ab7d0b9f7973e2bafe3a6808d36a
parent6c847613ac55427747a8e1425f04a6271b424da2 (diff)
downloademacs-4c92479f1bd20db9cf21221f5bae1d2b03b370b9.tar.gz
emacs-4c92479f1bd20db9cf21221f5bae1d2b03b370b9.zip
* cus-theme.el (custom-theme-add-variable, custom-theme-add-face):
Don't add widget if setting undefined.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/cus-theme.el54
2 files changed, 35 insertions, 24 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ae43e2639a4..30101821a60 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12006-01-12 Chong Yidong <cyd@stupidchicken.com>
2
3 * cus-theme.el (custom-theme-add-variable, custom-theme-add-face):
4 Don't add widget if setting undefined.
5
12006-01-12 John Paul Wallington <jpw@pobox.com> 62006-01-12 John Paul Wallington <jpw@pobox.com>
2 7
3 * help-fns.el (describe-variable): Remove newlines from void 8 * help-fns.el (describe-variable): Remove newlines from void
diff --git a/lisp/cus-theme.el b/lisp/cus-theme.el
index 0a421da925c..afb760a7d4e 100644
--- a/lisp/cus-theme.el
+++ b/lisp/cus-theme.el
@@ -156,18 +156,21 @@ the directory " custom-theme-directory "\n\n")
156 (interactive "vVariable name: ") 156 (interactive "vVariable name: ")
157 (save-excursion 157 (save-excursion
158 (goto-char custom-theme-insert-variable-marker) 158 (goto-char custom-theme-insert-variable-marker)
159 (if (assq symbol custom-theme-variables) 159 (cond ((assq symbol custom-theme-variables)
160 (message "%s is already in the theme" (symbol-name symbol)) 160 (message "%s is already in the theme" (symbol-name symbol)))
161 (widget-insert "\n") 161 ((not (boundp symbol))
162 (let ((widget (widget-create 'custom-variable 162 (message "%s is not defined as a variable" (symbol-name symbol)))
163 :tag (custom-unlispify-tag-name symbol) 163 (t
164 :custom-level 0 164 (widget-insert "\n")
165 :action 'custom-theme-variable-action 165 (let ((widget (widget-create 'custom-variable
166 :custom-state 'unknown 166 :tag (custom-unlispify-tag-name symbol)
167 :value symbol))) 167 :custom-level 0
168 (push (cons symbol widget) custom-theme-variables) 168 :action 'custom-theme-variable-action
169 (custom-magic-reset widget)) 169 :custom-state 'unknown
170 (widget-setup)))) 170 :value symbol)))
171 (push (cons symbol widget) custom-theme-variables)
172 (custom-magic-reset widget))
173 (widget-setup)))))
171 174
172(defvar custom-theme-variable-menu 175(defvar custom-theme-variable-menu
173 `(("Reset to Current" custom-redraw 176 `(("Reset to Current" custom-redraw
@@ -222,18 +225,21 @@ Optional EVENT is the location for the menu."
222 (interactive (list (read-face-name "Face name" nil nil))) 225 (interactive (list (read-face-name "Face name" nil nil)))
223 (save-excursion 226 (save-excursion
224 (goto-char custom-theme-insert-face-marker) 227 (goto-char custom-theme-insert-face-marker)
225 (if (assq symbol custom-theme-faces) 228 (cond ((assq symbol custom-theme-faces)
226 (message "%s is already in the theme" (symbol-name symbol)) 229 (message "%s is already in the theme" (symbol-name symbol)))
227 (widget-insert "\n") 230 ((not (facep symbol))
228 (let ((widget (widget-create 'custom-face 231 (message "%s is not defined as a face" (symbol-name symbol)))
229 :tag (custom-unlispify-tag-name symbol) 232 (t
230 :custom-level 0 233 (widget-insert "\n")
231 :action 'custom-theme-face-action 234 (let ((widget (widget-create 'custom-face
232 :custom-state 'unknown 235 :tag (custom-unlispify-tag-name symbol)
233 :value symbol))) 236 :custom-level 0
234 (push (cons symbol widget) custom-theme-faces) 237 :action 'custom-theme-face-action
235 (custom-magic-reset widget) 238 :custom-state 'unknown
236 (widget-setup))))) 239 :value symbol)))
240 (push (cons symbol widget) custom-theme-faces)
241 (custom-magic-reset widget)
242 (widget-setup))))))
237 243
238(defvar custom-theme-face-menu 244(defvar custom-theme-face-menu
239 `(("Reset to Theme Value" custom-face-reset-theme 245 `(("Reset to Theme Value" custom-face-reset-theme