Mercurial > hg > xemacs-beta
comparison lisp/x11/x-misc.el @ 0:376386a54a3c r19-14
Import from CVS: tag r19-14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:45:50 +0200 |
parents | |
children | 131b0175ea99 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:376386a54a3c |
---|---|
1 ;;; x-misc.el --- miscellaneous X functions. | |
2 | |
3 ;;; Copyright (C) 1995 Sun Microsystems. | |
4 ;;; Copyright (C) 1995, 1996 Ben Wing. | |
5 | |
6 ;; Author: Ben Wing <wing@666.com> | |
7 | |
8 ;; This file is part of XEmacs. | |
9 | |
10 ;; XEmacs is free software; you can redistribute it and/or modify it | |
11 ;; under the terms of the GNU General Public License as published by | |
12 ;; the Free Software Foundation; either version 2, or (at your option) | |
13 ;; any later version. | |
14 | |
15 ;; XEmacs is distributed in the hope that it will be useful, but | |
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
18 ;; General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
21 ;; along with XEmacs; see the file COPYING. If not, write to the Free | |
22 ;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
23 | |
24 (defun x-bogosity-check-resource (name class type) | |
25 "Check for a bogus resource specification." | |
26 (let ((bogus (x-get-resource | |
27 (concat "__no-such-friggin-locale__." name) | |
28 (concat "__No-such-friggin-widget__." class) | |
29 type 'global nil t))) | |
30 (if bogus | |
31 (display-warning | |
32 'resource | |
33 (format "Bad resource specification encountered: something like | |
34 Emacs*%s: %s | |
35 You should replace the * with a . in order to get proper behavior when | |
36 you use the specifier and/or `set-face-*' functions." name bogus))))) | |
37 | |
38 (defun x-init-specifier-from-resources (specifier type locale | |
39 &rest resource-list) | |
40 "Initialize a specifier from the resource database. | |
41 LOCALE specifies the locale that is to be initialized and should be | |
42 a frame, a device, or 'global. TYPE is the type of the resource and | |
43 should be one of 'string, 'boolean, 'integer, or 'natnum. The | |
44 remaining args should be conses of names and classes of resources | |
45 to be examined. The first resource with a value specified becomes | |
46 the spec for SPECIFIER in LOCALE. (However, if SPECIFIER already | |
47 has a spec in LOCALE, nothing is done.) Finally, if LOCALE is 'global, | |
48 a check is done for bogus resource specifications." | |
49 (if (eq locale 'global) | |
50 (mapcar #'(lambda (x) | |
51 (x-bogosity-check-resource (car x) (cdr x) type)) | |
52 resource-list)) | |
53 (if (not (specifier-spec-list specifier locale)) | |
54 (catch 'done | |
55 (while resource-list | |
56 (let* ((name (caar resource-list)) | |
57 (class (cdar resource-list)) | |
58 (resource | |
59 (x-get-resource name class type locale nil t))) | |
60 (if resource | |
61 (progn | |
62 (add-spec-to-specifier specifier resource locale) | |
63 (throw 'done t)))) | |
64 (setq resource-list (cdr resource-list)))))) | |
65 | |
66 (defun x-get-resource-and-bogosity-check (name class type &optional locale) | |
67 (x-bogosity-check-resource name class type) | |
68 (x-get-resource name class type locale nil t)) | |
69 | |
70 ;; #### this function is not necessary. | |
71 (defun x-get-resource-and-maybe-bogosity-check (name class type &optional | |
72 locale) | |
73 (if (eq locale 'global) | |
74 (x-bogosity-check-resource name class type)) | |
75 (x-get-resource name class type locale nil t)) | |
76 | |
77 | |
78 |