]> code.delx.au - gnu-emacs/blobdiff - lisp/facemenu.el
* mail/sendmail.el (send-mail-function):
[gnu-emacs] / lisp / facemenu.el
index 39d518cf52d880e7e56f7f74b5850f09d423e823..7da1c37fcbe3fdf6b8a027cb2c36a7a31d4805a3 100644 (file)
@@ -1,7 +1,7 @@
 ;;; facemenu.el --- create a face menu for interactively adding fonts to text
 
 ;; Copyright (C) 1994, 1995, 1996, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;;   2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 
 ;; Author: Boris Goldowsky <boris@gnu.org>
 ;; Keywords: faces
@@ -120,7 +120,7 @@ If you change this variable after loading facemenu.el, you will need to call
   :group 'facemenu)
 
 (defcustom facemenu-new-faces-at-end t
-  "*Where in the menu to insert newly-created faces.
+  "Where in the menu to insert newly-created faces.
 This should be nil to put them at the top of the menu, or t to put them
 just before \"Other\" at the end."
   :type 'boolean
@@ -136,7 +136,7 @@ just before \"Other\" at the end."
                        "22.1,\n  and has no effect on the Face menu")
 
 (defcustom facemenu-listed-faces nil
-  "*List of faces to include in the Face menu.
+  "List of faces to include in the Face menu.
 Each element should be a symbol, the name of a face.
 The \"basic \" faces in `facemenu-keybindings' are automatically
 added to the Face menu, and need not be in this list.
@@ -460,10 +460,17 @@ These special properties include `invisible', `intangible' and `read-only'."
 (defun facemenu-read-color (&optional prompt)
   "Read a color using the minibuffer."
   (let* ((completion-ignore-case t)
-        (col (completing-read (or prompt "Color: ")
-                              (or facemenu-color-alist
-                                  (defined-colors))
-                              nil t)))
+        (color-list (or facemenu-color-alist (defined-colors)))
+        (completer
+         (lambda (string pred all-completions)
+           (if all-completions
+               (or (all-completions string color-list pred)
+                   (if (color-defined-p string)
+                       (list string)))
+             (or (try-completion string color-list pred)
+                 (if (color-defined-p string)
+                     string)))))
+        (col (completing-read (or prompt "Color: ") completer nil t)))
     (if (equal "" col)
        nil
       col)))
@@ -536,8 +543,8 @@ a list of colors that the current display can handle."
         (l list))
     (while (cdr l)
       (if (and (facemenu-color-equal (car (car l)) (car (car (cdr l))))
-              (not (if (boundp 'w32-default-color-map)
-                       (not (assoc (car (car l)) w32-default-color-map)))))
+              (not (if (fboundp 'w32-default-color-map)
+                       (not (assoc (car (car l)) (w32-default-color-map))))))
          (progn
            (setcdr (car l) (cons (car (car (cdr l))) (cdr (car l))))
            (setcdr l (cdr (cdr l))))