annotate lisp/x-misc.el @ 3240:7a72b53e2c7f

[xemacs-hg @ 2006-02-14 22:51:09 by viteno] Update xemacs_extra_name.
author viteno
date Tue, 14 Feb 2006 22:51:09 +0000
parents 7039e6323819
children e29fcfd8df5f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 ;;; x-misc.el --- miscellaneous X functions.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 ;; Copyright (C) 1997 Free Software Foundation, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 ;; Copyright (C) 1995 Sun Microsystems.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 ;; Copyright (C) 1995, 1996 Ben Wing.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 ;; Author: Ben Wing <ben@xemacs.org>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 ;; Maintainer: XEmacs Development Team
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 ;; Keywords: extensions, dumped
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 ;; This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 ;; XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 ;; under the terms of the GNU General Public License as published by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 ;; the Free Software Foundation; either version 2, or (at your option)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 ;; any later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 ;; XEmacs is distributed in the hope that it will be useful, but
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 ;; General Public License for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 ;; You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 ;; along with XEmacs; see the file COPYING. If not, write to the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 ;; Free Software Foundation, 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 ;; Boston, MA 02111-1307, USA.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 ;;; Commentary:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 ;; This file is dumped with XEmacs (when X support is compiled in).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 ;;; Code:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 442
diff changeset
34 (globally-declare-fboundp
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 442
diff changeset
35 '(x-get-resource))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 442
diff changeset
36
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 (defun x-bogosity-check-resource (name class type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 "Check for a bogus resource specification."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 (let ((bogus (x-get-resource
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 (concat "__no-such-friggin-locale__." name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 (concat "__No-such-friggin-widget__." class)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 type 'global nil t)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 (if bogus
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 (display-warning
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 'resource
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 (format "Bad resource specification encountered: something like
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 Emacs*%s: %s
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 You should replace the * with a . in order to get proper behavior when
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 you use the specifier and/or `set-face-*' functions." name bogus)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 (defun x-init-specifier-from-resources (specifier type locale
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 &rest resource-list)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 "Initialize a specifier from the resource database.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 LOCALE specifies the locale that is to be initialized and should be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 a frame, a device, or 'global. TYPE is the type of the resource and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 should be one of 'string, 'boolean, 'integer, or 'natnum. The
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 remaining args should be conses of names and classes of resources
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 to be examined. The first resource with a value specified becomes
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 the spec for SPECIFIER in LOCALE. (However, if SPECIFIER already
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 has a spec in LOCALE, nothing is done.) Finally, if LOCALE is 'global,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 a check is done for bogus resource specifications."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 (if (eq locale 'global)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 (mapcar #'(lambda (x)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 (x-bogosity-check-resource (car x) (cdr x) type))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 resource-list))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 (if (not (specifier-spec-list specifier locale))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 (catch 'done
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 (while resource-list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 (let* ((name (caar resource-list))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 (class (cdar resource-list))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 (resource
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
72 (x-get-resource name class type locale nil 'warn)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 (if resource
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 (add-spec-to-specifier specifier resource locale)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 (throw 'done t))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 (setq resource-list (cdr resource-list))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 (defun x-get-resource-and-bogosity-check (name class type &optional locale)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 (x-bogosity-check-resource name class type)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
81 (x-get-resource name class type locale nil 'warn))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 (defun x-get-resource-and-maybe-bogosity-check (name class type &optional
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 locale)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 (if (eq locale 'global)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 (x-bogosity-check-resource name class type))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
87 (x-get-resource name class type locale nil 'warn))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 ;;; x-misc.el ends here