comparison lisp/wid-edit.el @ 37220:bd650fe3380e

(widget-color-sample-face-get): Don't make faces for undefined colors.
author Gerd Moellmann <gerd@gnu.org>
date Thu, 05 Apr 2001 15:57:16 +0000
parents 24ded05f613e
children c6078ee53ddf
comparison
equal deleted inserted replaced
37219:78542938ed28 37220:bd650fe3380e
1 ;;; wid-edit.el --- Functions for creating and using widgets -*-byte-compile-dynamic: t;-*- 1 ;;; wid-edit.el --- Functions for creating and using widgets -*-byte-compile-dynamic: t;-*-
2 ;; 2 ;;
3 ;; Copyright (C) 1996, 1997, 1999, 2000 Free Software Foundation, Inc. 3 ;; Copyright (C) 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
4 ;; 4 ;;
5 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk> 5 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
6 ;; Maintainer: FSF 6 ;; Maintainer: FSF
7 ;; Keywords: extensions 7 ;; Keywords: extensions
8 8
3396 (message "Making completion list...done"))))) 3396 (message "Making completion list...done")))))
3397 3397
3398 (defun widget-color-sample-face-get (widget) 3398 (defun widget-color-sample-face-get (widget)
3399 (let* ((value (condition-case nil 3399 (let* ((value (condition-case nil
3400 (widget-value widget) 3400 (widget-value widget)
3401 (error (widget-get widget :value)))) 3401 (error (widget-get widget :value)))))
3402 (symbol (intern (concat "fg:" value)))) 3402 (if (color-defined-p value)
3403 (condition-case nil 3403 (let ((symbol (intern (concat "fg:" value))))
3404 (facemenu-get-face symbol) 3404 (condition-case nil
3405 (error 'default)))) 3405 (facemenu-get-face symbol)
3406 (error 'default)))
3407 'default)))
3406 3408
3407 (defun widget-color-action (widget &optional event) 3409 (defun widget-color-action (widget &optional event)
3408 "Prompt for a color." 3410 "Prompt for a color."
3409 (let* ((tag (widget-apply widget :menu-tag-get)) 3411 (let* ((tag (widget-apply widget :menu-tag-get))
3410 (prompt (concat tag ": ")) 3412 (prompt (concat tag ": "))