From daad00fc06cc055034094e8a1941c6d22967e6bd Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sun, 16 Aug 2009 05:25:21 +0000 Subject: [PATCH] * facemenu.el (facemenu-read-color): Use a completion function that accepts any defined color, such as RGB triplets (Bug#3677). --- lisp/ChangeLog | 3 +++ lisp/facemenu.el | 16 +++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6961e82c6d2..c47ebd92123 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2009-08-16 Chong Yidong + * facemenu.el (facemenu-read-color): Use a completion function + that accepts any defined color, such as RGB triplets (Bug#3677). + * files.el (get-free-disk-space): Change fallback default directory to /. Expand DIR argument before switching to fallback. Suggested by Kevin Ryde (Bug#2631, Bug#3911). diff --git a/lisp/facemenu.el b/lisp/facemenu.el index a9f4f729edd..7da1c37fcbe 100644 --- a/lisp/facemenu.el +++ b/lisp/facemenu.el @@ -460,11 +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) - (require-match (not (eq window-system 'ns))) - (col (completing-read (or prompt "Color: ") - (or facemenu-color-alist - (defined-colors)) - nil require-match))) + (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))) -- 2.39.2