]> git.eshelyaron.com Git - emacs.git/commitdiff
* cus-theme.el (custom-theme-add-variable, custom-theme-add-face):
authorChong Yidong <cyd@stupidchicken.com>
Fri, 13 Jan 2006 02:30:03 +0000 (02:30 +0000)
committerChong Yidong <cyd@stupidchicken.com>
Fri, 13 Jan 2006 02:30:03 +0000 (02:30 +0000)
Don't add widget if setting undefined.

lisp/ChangeLog
lisp/cus-theme.el

index ae43e2639a40a1368d639b157e13ed9bb70902bc..30101821a60d09147b16353497424044db3f583e 100644 (file)
@@ -1,3 +1,8 @@
+2006-01-12  Chong Yidong  <cyd@stupidchicken.com>
+
+       * cus-theme.el (custom-theme-add-variable, custom-theme-add-face):
+       Don't add widget if setting undefined.
+
 2006-01-12  John Paul Wallington  <jpw@pobox.com>
 
        * help-fns.el (describe-variable): Remove newlines from void
index 0a421da925c53f6a91ea556eb725b3e70ab8f166..afb760a7d4e303c5bcd13c92d9f01c73997b5231 100644 (file)
@@ -156,18 +156,21 @@ the directory " custom-theme-directory "\n\n")
   (interactive "vVariable name: ")
   (save-excursion
     (goto-char custom-theme-insert-variable-marker)
-    (if (assq symbol custom-theme-variables)
-       (message "%s is already in the theme" (symbol-name symbol))
-      (widget-insert "\n")
-      (let ((widget (widget-create 'custom-variable
-                                  :tag (custom-unlispify-tag-name symbol)
-                                  :custom-level 0
-                                  :action 'custom-theme-variable-action
-                                  :custom-state 'unknown
-                                  :value symbol)))
-       (push (cons symbol widget) custom-theme-variables)
-       (custom-magic-reset widget))
-      (widget-setup))))
+    (cond ((assq symbol custom-theme-variables)
+          (message "%s is already in the theme" (symbol-name symbol)))
+         ((not (boundp symbol))
+          (message "%s is not defined as a variable" (symbol-name symbol)))
+         (t
+          (widget-insert "\n")
+          (let ((widget (widget-create 'custom-variable
+                                       :tag (custom-unlispify-tag-name symbol)
+                                       :custom-level 0
+                                       :action 'custom-theme-variable-action
+                                       :custom-state 'unknown
+                                       :value symbol)))
+            (push (cons symbol widget) custom-theme-variables)
+            (custom-magic-reset widget))
+          (widget-setup)))))
 
 (defvar custom-theme-variable-menu
   `(("Reset to Current" custom-redraw
@@ -222,18 +225,21 @@ Optional EVENT is the location for the menu."
   (interactive (list (read-face-name "Face name" nil nil)))
   (save-excursion
     (goto-char custom-theme-insert-face-marker)
-    (if (assq symbol custom-theme-faces)
-       (message "%s is already in the theme" (symbol-name symbol))
-      (widget-insert "\n")
-      (let ((widget (widget-create 'custom-face
-                                  :tag (custom-unlispify-tag-name symbol)
-                                  :custom-level 0
-                                  :action 'custom-theme-face-action
-                                  :custom-state 'unknown
-                                  :value symbol)))
-       (push (cons symbol widget) custom-theme-faces)
-       (custom-magic-reset widget)
-       (widget-setup)))))
+    (cond ((assq symbol custom-theme-faces)
+          (message "%s is already in the theme" (symbol-name symbol)))
+         ((not (facep symbol))
+          (message "%s is not defined as a face" (symbol-name symbol)))
+         (t
+          (widget-insert "\n")
+          (let ((widget (widget-create 'custom-face
+                                       :tag (custom-unlispify-tag-name symbol)
+                                       :custom-level 0
+                                       :action 'custom-theme-face-action
+                                       :custom-state 'unknown
+                                       :value symbol)))
+            (push (cons symbol widget) custom-theme-faces)
+            (custom-magic-reset widget)
+            (widget-setup))))))
 
 (defvar custom-theme-face-menu
   `(("Reset to Theme Value" custom-face-reset-theme