Mercurial > hg > xemacs-beta
comparison lisp/minibuf.el @ 2527:491f8cf78a9c
[xemacs-hg @ 2005-01-28 02:58:38 by ben]
Abstract font-list/color-list
font-menu.el, font.el, frame.el, gtk-font-menu.el, minibuf.el, msw-faces.el, msw-font-menu.el, obsolete.el, x-faces.el, x-font-menu.el: list-fonts->font-list. Create color-list. Abstract out
x/msw-specific versions and obsolete the x/msw-specific Lisp
functions.
console-impl.h, objects-gtk.c, objects-msw.c, objects-tty.c, objects-x.c, objects.c: list-fonts->font-list. Create color-list. Abstract out
x/msw-specific versions and obsolete the x/msw-specific Lisp
functions.
author | ben |
---|---|
date | Fri, 28 Jan 2005 02:58:52 +0000 |
parents | cb22c508fb00 |
children | 139afe9fb2ee |
comparison
equal
deleted
inserted
replaced
2526:902d5bd9b75c | 2527:491f8cf78a9c |
---|---|
2179 | 2179 |
2180 (defun read-face (prompt &optional must-match) | 2180 (defun read-face (prompt &optional must-match) |
2181 "Read the name of a face from the minibuffer and return it as a symbol." | 2181 "Read the name of a face from the minibuffer and return it as a symbol." |
2182 (intern (completing-read prompt obarray 'find-face must-match))) | 2182 (intern (completing-read prompt obarray 'find-face must-match))) |
2183 | 2183 |
2184 ;; #### - wrong place for this variable? Exactly. We probably want | |
2185 ;; `color-list' to be a console method, so `tty-color-list' becomes | |
2186 ;; obsolete, and `read-color-completion-table' conses (mapcar #'list | |
2187 ;; (color-list)), optionally caching the results. | |
2188 | |
2189 ;; Ben wanted all of the possibilities from the `configure' script used | |
2190 ;; here, but I think this is way too many. I already trimmed the R4 variants | |
2191 ;; and a few obvious losers from the list. --Stig | |
2192 (defvar x-library-search-path '("/usr/X11R6/lib/X11/" | |
2193 "/usr/X11R5/lib/X11/" | |
2194 "/usr/lib/X11R6/X11/" | |
2195 "/usr/lib/X11R5/X11/" | |
2196 "/usr/local/X11R6/lib/X11/" | |
2197 "/usr/local/X11R5/lib/X11/" | |
2198 "/usr/local/lib/X11R6/X11/" | |
2199 "/usr/local/lib/X11R5/X11/" | |
2200 "/usr/X11/lib/X11/" | |
2201 "/usr/lib/X11/" | |
2202 "/usr/local/lib/X11/" | |
2203 "/usr/X386/lib/X11/" | |
2204 "/usr/x386/lib/X11/" | |
2205 "/usr/XFree86/lib/X11/" | |
2206 "/usr/unsupported/lib/X11/" | |
2207 "/usr/athena/lib/X11/" | |
2208 "/usr/local/x11r5/lib/X11/" | |
2209 "/usr/lpp/Xamples/lib/X11/" | |
2210 "/usr/openwin/lib/X11/" | |
2211 "/usr/openwin/share/lib/X11/") | |
2212 "Search path used by `read-color' to find rgb.txt.") | |
2213 | |
2214 (defvar x-read-color-completion-table) | |
2215 | |
2216 (defun read-color-completion-table () | 2184 (defun read-color-completion-table () |
2217 (case (device-type) | 2185 (mapcar #'list (color-list))) |
2218 ;; #### Evil device-type dependency | |
2219 ((x gtk) | |
2220 (if (boundp 'x-read-color-completion-table) | |
2221 x-read-color-completion-table | |
2222 (let ((rgb-file (locate-file "rgb.txt" x-library-search-path)) | |
2223 clist color p) | |
2224 (if (not rgb-file) | |
2225 ;; prevents multiple searches for rgb.txt if we can't find it | |
2226 (setq x-read-color-completion-table nil) | |
2227 (with-current-buffer (get-buffer-create " *colors*") | |
2228 (reset-buffer (current-buffer)) | |
2229 (insert-file-contents rgb-file) | |
2230 (while (not (eobp)) | |
2231 ;; skip over comments | |
2232 (while (looking-at "^!") | |
2233 (end-of-line) | |
2234 (forward-char 1)) | |
2235 (skip-chars-forward "0-9 \t") | |
2236 (setq p (point)) | |
2237 (end-of-line) | |
2238 (setq color (buffer-substring p (point)) | |
2239 clist (cons (list color) clist)) | |
2240 ;; Ugh. If we want to be able to complete the lowercase form | |
2241 ;; of the color name, we need to add it twice! Yuck. | |
2242 (let ((dcase (downcase color))) | |
2243 (or (string= dcase color) | |
2244 (push (list dcase) clist))) | |
2245 (forward-char 1)) | |
2246 (kill-buffer (current-buffer)))) | |
2247 (setq x-read-color-completion-table clist) | |
2248 x-read-color-completion-table))) | |
2249 (mswindows | |
2250 (mapcar #'list (declare-fboundp (mswindows-color-list)))) | |
2251 (tty | |
2252 (mapcar #'list (declare-fboundp (tty-color-list)))))) | |
2253 | 2186 |
2254 (defun read-color (prompt &optional must-match initial-contents) | 2187 (defun read-color (prompt &optional must-match initial-contents) |
2255 "Read the name of a color from the minibuffer. | 2188 "Read the name of a color from the minibuffer. |
2256 On X devices, this uses `x-library-search-path' to find rgb.txt in order | 2189 On X devices, this uses `x-library-search-path' to find rgb.txt in order |
2257 to build a completion table. | 2190 to build a completion table. |