aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2009-08-16 05:25:21 +0000
committerChong Yidong2009-08-16 05:25:21 +0000
commitdaad00fc06cc055034094e8a1941c6d22967e6bd (patch)
tree09e8501410ec8b4a463286040aae1c74c12f1838
parent2ec536de9457ca2460592c1996f443eafb3dbd20 (diff)
downloademacs-daad00fc06cc055034094e8a1941c6d22967e6bd.tar.gz
emacs-daad00fc06cc055034094e8a1941c6d22967e6bd.zip
* facemenu.el (facemenu-read-color): Use a completion function
that accepts any defined color, such as RGB triplets (Bug#3677).
-rw-r--r--lisp/ChangeLog3
-rw-r--r--lisp/facemenu.el16
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 @@
12009-08-16 Chong Yidong <cyd@stupidchicken.com> 12009-08-16 Chong Yidong <cyd@stupidchicken.com>
2 2
3 * facemenu.el (facemenu-read-color): Use a completion function
4 that accepts any defined color, such as RGB triplets (Bug#3677).
5
3 * files.el (get-free-disk-space): Change fallback default 6 * files.el (get-free-disk-space): Change fallback default
4 directory to /. Expand DIR argument before switching to fallback. 7 directory to /. Expand DIR argument before switching to fallback.
5 Suggested by Kevin Ryde (Bug#2631, Bug#3911). 8 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'."
460(defun facemenu-read-color (&optional prompt) 460(defun facemenu-read-color (&optional prompt)
461 "Read a color using the minibuffer." 461 "Read a color using the minibuffer."
462 (let* ((completion-ignore-case t) 462 (let* ((completion-ignore-case t)
463 (require-match (not (eq window-system 'ns))) 463 (color-list (or facemenu-color-alist (defined-colors)))
464 (col (completing-read (or prompt "Color: ") 464 (completer
465 (or facemenu-color-alist 465 (lambda (string pred all-completions)
466 (defined-colors)) 466 (if all-completions
467 nil require-match))) 467 (or (all-completions string color-list pred)
468 (if (color-defined-p string)
469 (list string)))
470 (or (try-completion string color-list pred)
471 (if (color-defined-p string)
472 string)))))
473 (col (completing-read (or prompt "Color: ") completer nil t)))
468 (if (equal "" col) 474 (if (equal "" col)
469 nil 475 nil
470 col))) 476 col)))