annotate lisp/w3/w3-sysdp.el @ 136:b980b6286996 r20-2b2

Import from CVS: tag r20-2b2
author cvs
date Mon, 13 Aug 2007 09:31:12 +0200
parents d2f30a177268
children 318232e2a3f0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; sysdep.el --- consolidate Emacs-version dependencies in one file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
3 ;; Copyright (c) 1995 - 1997 Ben Wing.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
5 ;; Author: Ben Wing <wing@666.com>, William Perry <wmperry@cs.indiana.edu>
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; Keywords: lisp, tools
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
7 ;; Version: 0.003
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;; The purpose of this file is to eliminate the cruftiness that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; would otherwise be required of packages that want to run on multiple
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; versions of Emacs. The idea is that we make it look like we're running
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; the latest version of XEmacs (currently 19.12) by emulating all the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;; missing functions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; #### This file does not currently do any advising but should.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;; Unfortunately, advice.el is a hugely big package. Is any such
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; thing as `advice-lite' possible?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;; #### - This package is great, but its role needs to be thought out a bit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; more. Sysdep will not permit programs written for the old XEmacs API to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;; run on new versions of XEmacs. Sysdep is a backward-compatibility
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;; package for the latest and greatest XEmacs API. It permits programmers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;; to use the latest XEmacs functionality and still have their programs run
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;; on older versions of XEmacs...perhaps even on FSF Emacs. It should NEVER
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 ;; ever need to be loaded in the newest XEmacs. It doesn't even make sense
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;; to put it in the lisp/utils part of the XEmacs distribution because it's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;; real purpose is to be distributed with packages like w3 which take
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;; advantage of the latest and greatest features of XEmacs but still need to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;; be run on older versions. --Stig
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;; Any packages that wish to use this file should load it using
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ;; `load-library'. It will not load itself if a version of sysdep.el
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;; that is at least as recent has already been loaded, but will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 ;; load over an older version of sysdep.el. It will attempt to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ;; not redefine functions that have already been custom-redefined,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 ;; but will redefine a function if the supplied definition came from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 ;; an older version of sysdep.el.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 ;; Packages such as w3 that wish to include this file with the package
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 ;; should rename it to something unique, such as `w3-sysdep.el', and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 ;; load it with `load-library'. That will ensure that no conflicts
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 ;; arise if more than one package in the load path provides a version
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 ;; of sysdep.el. If multiple packages load sysdep.el, the most recent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 ;; version will end up loaded; as long as I'm careful not to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 ;; introduce bugs in previously working definitions, this should work
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 ;; fine.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 ;; You may well discover deficiencies in this file as you use it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 ;; The preferable way of dealing with this is to send me a patch
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 ;; to sysdep.el; that way, the collective body of knowledge gets
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 ;; increased.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 ;; IMPORTANT: leave the version string in the format X.XXX (e.g. 1.001)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 ;; so that string comparisons to other versions work properly.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
56 (defconst sysdep-potential-version "0.003")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 ;; this macro means: define the function, but only if either it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 ;; wasn't bound before, or the supplied binding comes from an older
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 ;; version of sysdep.el. That way, user-supplied bindings don't
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 ;; get overridden.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 ;; note: sysdep-defalias is often more useful than this function,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 ;; esp. since you can do load-time conditionalizing and can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 ;; optionally leave the function undefined. (e.g. frame functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 ;; in v18.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (defmacro sysdep-defun (function &rest everything-else)
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
69 (` (cond ((and (not (fboundp (quote (, function))))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
70 (or
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
71 (not
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
72 (stringp (get (quote (, function)) 'sysdep-defined-this)))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
73 (and (get (quote (, function)) 'sysdep-defined-this)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
74 (string-lessp
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
75 (get (quote (, function)) 'sysdep-defined-this)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
76 sysdep-potential-version))))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
77 (put (quote (, function)) 'sysdep-defined-this
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
78 sysdep-potential-version)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (defun (, function) (,@ everything-else))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (defmacro sysdep-defvar (function &rest everything-else)
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
82 (` (cond ((and (not (boundp (quote (, function))))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
83 (or
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
84 (not
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
85 (stringp (get (quote (, function)) 'sysdep-defined-this)))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
86 (and (get (quote (, function)) 'sysdep-defined-this)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
87 (string-lessp
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
88 (get (quote (, function)) 'sysdep-defined-this)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
89 sysdep-potential-version))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 (put (quote (, function)) 'sysdep-defined-this t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 (defvar (, function) (,@ everything-else))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 (defmacro sysdep-defconst (function &rest everything-else)
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
94 (` (cond ((and (not (boundp (quote (, function))))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
95 (or
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
96 (not
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
97 (stringp (get (quote (, function)) 'sysdep-defined-this)))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
98 (and (get (quote (, function)) 'sysdep-defined-this)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
99 (string-lessp
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
100 (get (quote (, function)) 'sysdep-defined-this)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
101 sysdep-potential-version))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 (put (quote (, function)) 'sysdep-defined-this t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 (defconst (, function) (,@ everything-else))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 ;; similar for fset and defalias. No need to quote as the argument
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 ;; is already quoted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (defmacro sysdep-fset (function def)
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
109 (` (cond ((and (not (fboundp (, function)))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
110 (or (not (stringp
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
111 (get (, function) 'sysdep-defined-this)))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
112 (and (get (, function) 'sysdep-defined-this)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
113 (string-lessp
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
114 (get (, function) 'sysdep-defined-this)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
115 sysdep-potential-version)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 (, def))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 (put (, function) 'sysdep-defined-this t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 (fset (, function) (, def))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 (defmacro sysdep-defalias (function def)
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
121 (` (cond ((and (not (fboundp (, function)))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
122 (or (not (stringp
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
123 (get (, function) 'sysdep-defined-this)))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
124 (and (get (, function) 'sysdep-defined-this)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
125 (string-lessp
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
126 (get (, function) 'sysdep-defined-this)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
127 sysdep-potential-version)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 (, def)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 (or (listp (, def))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 (and (symbolp (, def))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 (fboundp (, def)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 (put (, function) 'sysdep-defined-this t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 (defalias (, function) (, def))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 ;; bootstrapping: defalias and define-function don't exist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 ;; in older versions of lemacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 (sysdep-fset 'defalias 'fset)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 (sysdep-defalias 'define-function 'defalias)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 ;; useful ways of determining what version is running
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 ;; emacs-major-version and emacs-minor-version are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 ;; already defined in recent versions of FSF Emacs and XEmacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 (sysdep-defconst emacs-major-version
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 ;; will string-match ever fail? If so, assume 19.0.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 ;; (should we assume 18.something?)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 (if (string-match "^[0-9]+" emacs-version)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 (string-to-int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 (substring emacs-version
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 (match-beginning 0) (match-end 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 19))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 (sysdep-defconst emacs-minor-version
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 (if (string-match "^[0-9]+\\.\\([0-9]+\\)" emacs-version)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 (string-to-int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 (substring emacs-version
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 (match-beginning 1) (match-end 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 (sysdep-defconst sysdep-running-xemacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 (or (string-match "Lucid" emacs-version)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 (string-match "XEmacs" emacs-version)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 (sysdep-defconst window-system nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 (sysdep-defconst window-system-version 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 (sysdep-defvar list-buffers-directory nil)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
169 (sysdep-defvar x-library-search-path (`
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
170 ("/usr/X11R6/lib/X11/"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 "/usr/X11R5/lib/X11/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 "/usr/lib/X11R6/X11/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 "/usr/lib/X11R5/X11/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 "/usr/local/X11R6/lib/X11/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 "/usr/local/X11R5/lib/X11/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 "/usr/local/lib/X11R6/X11/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 "/usr/local/lib/X11R5/X11/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 "/usr/X11/lib/X11/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 "/usr/lib/X11/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 "/usr/local/lib/X11/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 "/usr/X386/lib/X11/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 "/usr/x386/lib/X11/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 "/usr/XFree86/lib/X11/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 "/usr/unsupported/lib/X11/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 "/usr/athena/lib/X11/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 "/usr/local/x11r5/lib/X11/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 "/usr/lpp/Xamples/lib/X11/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 "/usr/openwin/lib/X11/"
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
189 "/usr/openwin/share/lib/X11/"
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
190 (, data-directory)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
191 )
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
192 )
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 "Search path used for X11 libraries.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 ;; frame-related stuff.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 (sysdep-defalias 'buffer-dedicated-frame 'buffer-dedicated-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 (sysdep-defalias 'deiconify-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 (cond ((fboundp 'deiconify-screen) 'deiconify-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 ;; make-frame-visible will be defined as necessary
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 (t 'make-frame-visible)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 (sysdep-defalias 'delete-frame 'delete-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 (sysdep-defalias 'event-frame 'event-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 (sysdep-defalias 'event-glyph-extent 'event-glyph)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 (sysdep-defalias 'find-file-other-frame 'find-file-other-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 (sysdep-defalias 'find-file-read-only-other-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 'find-file-read-only-other-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 (sysdep-defalias 'frame-height 'screen-height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 (sysdep-defalias 'frame-iconified-p 'screen-iconified-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 (sysdep-defalias 'frame-left-margin-width 'screen-left-margin-width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 (sysdep-defalias 'frame-list 'screen-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 (sysdep-defalias 'frame-live-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 (cond ((fboundp 'screen-live-p) 'screen-live-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 ((fboundp 'live-screen-p) 'live-screen-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 ;; #### not sure if this is correct (this is for Epoch)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 ;; but gnuserv.el uses it this way
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 ((fboundp 'screenp) 'screenp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 (sysdep-defalias 'frame-name 'screen-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 (sysdep-defalias 'frame-parameters 'screen-parameters)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 (sysdep-defalias 'frame-pixel-height 'screen-pixel-height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 (sysdep-defalias 'frame-pixel-width 'screen-pixel-width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 (sysdep-defalias 'frame-right-margin-width 'screen-right-margin-width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 (sysdep-defalias 'frame-root-window 'screen-root-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 (sysdep-defalias 'frame-selected-window 'screen-selected-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 (sysdep-defalias 'frame-totally-visible-p 'screen-totally-visible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 (sysdep-defalias 'frame-visible-p 'screen-visible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 (sysdep-defalias 'frame-width 'screen-width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 (sysdep-defalias 'framep 'screenp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 (sysdep-defalias 'get-frame-for-buffer 'get-screen-for-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 (sysdep-defalias 'get-frame-for-buffer-noselect 'get-screen-for-buffer-noselect)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 (sysdep-defalias 'get-other-frame 'get-other-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 (sysdep-defalias 'iconify-frame 'iconify-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 (sysdep-defalias 'lower-frame 'lower-screen)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
234 (sysdep-defalias 'mail-other-frame 'mail-other-screen)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 (sysdep-defalias 'make-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 (cond ((fboundp 'make-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 (function (lambda (&optional parameters device)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 (make-screen parameters))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 ((fboundp 'x-create-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 (function (lambda (&optional parameters device)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 (x-create-screen parameters))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 (sysdep-defalias 'make-frame-invisible 'make-screen-invisible)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 (sysdep-defalias 'make-frame-visible
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 (cond ((fboundp 'make-screen-visible) 'make-screen-visible)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 ((fboundp 'mapraised-screen) 'mapraised-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 ((fboundp 'x-remap-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 (lambda (&optional x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 (x-remap-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 (accept-process-output)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 (sysdep-defalias 'modify-frame-parameters 'modify-screen-parameters)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 (sysdep-defalias 'new-frame 'new-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 (sysdep-defalias 'next-frame 'next-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 (sysdep-defalias 'next-multiframe-window 'next-multiscreen-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (sysdep-defalias 'other-frame 'other-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 (sysdep-defalias 'previous-frame 'previous-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 (sysdep-defalias 'previous-multiframe-window 'previous-multiscreen-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 (sysdep-defalias 'raise-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 (cond ((fboundp 'raise-screen) 'raise-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 ((fboundp 'mapraise-screen) 'mapraise-screen)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 (sysdep-defalias 'redraw-frame 'redraw-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 (sysdep-defalias 'select-frame 'select-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 (sysdep-defalias 'selected-frame 'selected-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 (sysdep-defalias 'set-buffer-dedicated-frame 'set-buffer-dedicated-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 (sysdep-defalias 'set-frame-height 'set-screen-height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 (sysdep-defalias 'set-frame-left-margin-width 'set-screen-left-margin-width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 (sysdep-defalias 'set-frame-position 'set-screen-position)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 (sysdep-defalias 'set-frame-right-margin-width 'set-screen-right-margin-width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 (sysdep-defalias 'set-frame-size 'set-screen-size)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 (sysdep-defalias 'set-frame-width 'set-screen-width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 (sysdep-defalias 'show-temp-buffer-in-current-frame 'show-temp-buffer-in-current-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 (sysdep-defalias 'switch-to-buffer-other-frame 'switch-to-buffer-other-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 (sysdep-defalias 'visible-frame-list 'visible-screen-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 (sysdep-defalias 'window-frame 'window-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 (sysdep-defalias 'x-create-frame 'x-create-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 (sysdep-defalias 'x-set-frame-icon-pixmap 'x-set-screen-icon-pixmap)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 (sysdep-defalias 'x-set-frame-pointer 'x-set-screen-pointer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 (sysdep-defalias 'x-display-color-p 'x-color-display-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 (sysdep-defalias 'x-display-grayscale-p 'x-grayscale-display-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 (sysdep-defalias 'menu-event-p 'misc-user-event-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
283 ;; WMP - commention these out so that Emacs 19 doesn't get screwed by them.
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
284 ;; In particular, this makes the 'custom' package blow up quite well.
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
285 ;;(sysdep-defun add-submenu (menu-path submenu &optional before)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
286 ;; "Add a menu to the menubar or one of its submenus.
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
287 ;;If the named menu exists already, it is changed.
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
288 ;;MENU-PATH identifies the menu under which the new menu should be inserted.
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
289 ;; It is a list of strings; for example, (\"File\") names the top-level \"File\"
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
290 ;; menu. (\"File\" \"Foo\") names a hypothetical submenu of \"File\".
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
291 ;; If MENU-PATH is nil, then the menu will be added to the menubar itself.
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
292 ;;SUBMENU is the new menu to add.
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
293 ;; See the documentation of `current-menubar' for the syntax.
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
294 ;;BEFORE, if provided, is the name of a menu before which this menu should
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
295 ;; be added, if this menu is not on its parent already. If the menu is already
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
296 ;; present, it will not be moved."
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
297 ;; (add-menu menu-path (car submenu) (cdr submenu) before))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
299 ;;(sysdep-defun add-menu-button (menu-path menu-leaf &optional before)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
300 ;; "Add a menu item to some menu, creating the menu first if necessary.
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
301 ;;If the named item exists already, it is changed.
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
302 ;;MENU-PATH identifies the menu under which the new menu item should be inserted.
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
303 ;; It is a list of strings; for example, (\"File\") names the top-level \"File\"
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
304 ;; menu. (\"File\" \"Foo\") names a hypothetical submenu of \"File\".
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
305 ;;MENU-LEAF is a menubar leaf node. See the documentation of `current-menubar'.
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
306 ;;BEFORE, if provided, is the name of a menu item before which this item should
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
307 ;; be added, if this item is not on the menu already. If the item is already
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
308 ;; present, it will not be moved."
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
309 ;; (add-menu-item menu-path (aref menu-leaf 0) (aref menu-leaf 1)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
310 ;; (aref menu-leaf 2) before))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 (sysdep-defun make-glyph (&optional spec-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 (if (and spec-list (cdr-safe (assq 'x spec-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (make-pixmap (cdr-safe (assq 'x spec-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 (sysdep-defalias 'face-list 'list-faces)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
318 (sysdep-defun set-keymap-parent (keymap new-parent)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
319 (let ((tail keymap))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
320 (while (and tail (cdr tail) (not (eq (car (cdr tail)) 'keymap)))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
321 (setq tail (cdr tail)))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
322 (if tail
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
323 (setcdr tail new-parent))))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
324
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
325 (sysdep-defun buffer-substring-no-properties (st nd)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
326 "Return the characters of part of the buffer, without the text properties.
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
327 The two arguments START and END are character positions;
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
328 they can be in either order."
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
329 (buffer-substring st nd))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
330
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
331 ;; Property list functions
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
332 ;;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
333 (sysdep-defun plist-put (plist prop val)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
334 "Change value in PLIST of PROP to VAL.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
335 PLIST is a property list, which is a list of the form
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
336 (PROP1 VALUE1 PROP2 VALUE2 ...). PROP is a symbol and VAL is any object.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
337 If PROP is already a property on the list, its value is set to VAL,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
338 otherwise the new PROP VAL pair is added. The new plist is returned;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
339 use `(setq x (plist-put x prop val))' to be sure to use the new value.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
340 The PLIST is modified by side effects."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
341 (let ((node (memq prop plist)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
342 (if node
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
343 (setcar (cdr node) val)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
344 (setq plist (cons prop (cons val plist))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
345 plist))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
346
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
347 (sysdep-defun plist-get (plist prop)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
348 "Extract a value from a property list.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
349 PLIST is a property list, which is a list of the form
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
350 (PROP1 VALUE1 PROP2 VALUE2...). This function returns the value
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
351 corresponding to the given PROP, or nil if PROP is not
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
352 one of the properties on the list."
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
353 (while (and plist (not (eq (car plist) prop)))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
354 (setq plist (cdr (cdr plist))))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
355 (and plist (car (cdr plist))))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
356
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 ;; Extent stuff
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 (sysdep-fset 'delete-extent 'delete-overlay)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 (sysdep-fset 'extent-end-position 'overlay-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 (sysdep-fset 'extent-start-position 'overlay-start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 (sysdep-fset 'set-extent-endpoints 'move-overlay)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
362 (sysdep-fset 'set-extent-property 'overlay-put)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
363 (sysdep-fset 'make-extent 'make-overlay)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 (sysdep-defun extent-property (extent property &optional default)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 (or (overlay-get extent property) default))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 (sysdep-defun extent-at (pos &optional object property before at-flag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 (let ((tmp (overlays-at (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 ovls)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 (if property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 (while tmp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 (if (extent-property (car tmp) property)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 (setq ovls (cons (car tmp) ovls)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 (setq tmp (cdr tmp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 (setq ovls tmp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 tmp nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 (car-safe
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 (sort ovls
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 (lambda (a b)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 (< (- (extent-end-position a) (extent-start-position a))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 (- (extent-end-position b) (extent-start-position b)))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 (sysdep-defun overlays-in (beg end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 "Return a list of the overlays that overlap the region BEG ... END.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 Overlap means that at least one character is contained within the overlay
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 and also contained within the specified region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 Empty overlays are included in the result if they are located at BEG
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 or between BEG and END."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 (let ((ovls (overlay-lists))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 tmp retval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 (if (< end beg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 (setq tmp end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 end beg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 beg tmp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 (setq ovls (nconc (car ovls) (cdr ovls)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 (while ovls
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 (setq tmp (car ovls)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 ovls (cdr ovls))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 (if (or (and (<= (overlay-start tmp) end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 (>= (overlay-start tmp) beg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 (and (<= (overlay-end tmp) end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 (>= (overlay-end tmp) beg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 (setq retval (cons tmp retval))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 retval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 (sysdep-defun map-extents (function &optional object from to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 maparg flags property value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 (let ((tmp (overlays-in (or from (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 (or to (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 ovls)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 (if property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 (while tmp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 (if (extent-property (car tmp) property)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 (setq ovls (cons (car tmp) ovls)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 (setq tmp (cdr tmp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 (setq ovls tmp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 tmp nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 (catch 'done
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 (while ovls
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 (setq tmp (funcall function (car ovls) maparg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 ovls (cdr ovls))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 (if tmp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 (throw 'done tmp))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 ;; misc
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
428 (sysdep-fset 'make-local-hook 'make-local-variable)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
429
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
430 (sysdep-defun buffer-substring-no-properties (beg end)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
431 "Return the text from BEG to END, without text properties, as a string."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
432 (format "%s" (buffer-substring beg end)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
433
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 (sysdep-defun symbol-value-in-buffer (symbol buffer &optional unbound-value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 "Return the value of SYMBOL in BUFFER, or UNBOUND-VALUE if it is unbound."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 (if (not (boundp symbol))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 unbound-value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 (symbol-value symbol))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 (sysdep-defun insert-file-contents-literally
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 (file &optional visit beg end replace)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 "Like `insert-file-contents', q.v., but only reads in the file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 A buffer may be modified in several ways after reading into the buffer due
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 to advanced Emacs features, such as file-name-handlers, format decoding,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 find-file-hooks, etc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 This function ensures that none of these modifications will take place."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 (let ((file-name-handler-alist nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 (find-file-hooks nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 (insert-file-contents file visit beg end replace)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 (sysdep-defun alist-to-plist (alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 "Convert association list ALIST into the equivalent property-list form.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 The plist is returned. This converts from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 \((a . 1) (b . 2) (c . 3))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 into
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 \(a 1 b 2 c 3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 The original alist is not modified. See also `destructive-alist-to-plist'."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 (let (plist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 (while alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 (let ((el (car alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 (setq plist (cons (cdr el) (cons (car el) plist))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 (setq alist (cdr alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 (nreverse plist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 (sysdep-defun add-minor-mode (toggle name &optional keymap after toggle-fun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 "Add a minor mode to `minor-mode-alist' and `minor-mode-map-alist'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 TOGGLE is a symbol which is used as the variable which toggle the minor mode,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 NAME is the name that should appear in the modeline (it should be a string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 beginning with a space), KEYMAP is a keymap to make active when the minor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 mode is active, and AFTER is the toggling symbol used for another minor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 mode. If AFTER is non-nil, then it is used to position the new mode in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 minor-mode alists. TOGGLE-FUN specifies an interactive function that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 is called to toggle the mode on and off; this affects what appens when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 button2 is pressed on the mode, and when button3 is pressed somewhere
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 in the list of modes. If TOGGLE-FUN is nil and TOGGLE names an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 interactive function, TOGGLE is used as the toggle function.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 Example: (add-minor-mode 'view-minor-mode \" View\" view-mode-map)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 (if (not (assq toggle minor-mode-alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 (setq minor-mode-alist (cons (list toggle name) minor-mode-alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 (if (and keymap (not (assq toggle minor-mode-map-alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 (setq minor-mode-map-alist (cons (cons toggle keymap)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 minor-mode-map-alist))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 (sysdep-defvar x-font-regexp-foundry-and-family
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 (let ((- "[-?]")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 (foundry "[^-]+")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 (family "[^-]+")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 (concat "\\`[-?*]" foundry - "\\(" family "\\)" -)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 (sysdep-defun match-string (num &optional string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 "Return string of text matched by last search.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 NUM specifies which parenthesized expression in the last regexp.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 Value is nil if NUMth pair didn't match, or there were less than NUM pairs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 Zero means the entire text matched by the whole regexp or whole string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 STRING should be given if the last search was by `string-match' on STRING."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 (if (match-beginning num)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 (if string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 (substring string (match-beginning num) (match-end num))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 (buffer-substring (match-beginning num) (match-end num)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 (sysdep-defun add-hook (hook-var function &optional at-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 "Add a function to a hook.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 First argument HOOK-VAR (a symbol) is the name of a hook, second
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 argument FUNCTION is the function to add.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 Third (optional) argument AT-END means to add the function at the end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 of the hook list instead of the beginning. If the function is already
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 present, this has no effect.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 Returns nil if FUNCTION was already present in HOOK-VAR, else new
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 value of HOOK-VAR."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 (if (not (boundp hook-var)) (set hook-var nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 (let ((old (symbol-value hook-var)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 (if (or (not (listp old)) (eq (car old) 'lambda))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 (setq old (list old)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 (if (member function old)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 (set hook-var
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 (if at-end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 (append old (list function)) ; don't nconc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 (cons function old))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 (sysdep-defalias 'valid-color-name-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 ((fboundp 'x-valid-color-name-p) ; XEmacs/Lucid
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 'x-valid-color-name-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 ((and window-system
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 (fboundp 'color-defined-p)) ; NS/Emacs 19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 'color-defined-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 ((and window-system
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
537 (fboundp 'pm-color-defined-p))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
538 'pm-color-defined-p)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
539 ((and window-system
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 (fboundp 'x-color-defined-p)) ; Emacs 19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 'x-color-defined-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 ((fboundp 'get-color) ; Epoch
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 (function (lambda (color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 (let ((x (get-color color)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 (if x
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 (setq x (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 (free-color x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 x))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 (t 'identity))) ; All others
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 ;; Misc.
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
553 ;; NT doesn't have make-symbolic-link
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
554 (sysdep-defalias 'make-symbolic-link 'copy-file)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
555
122
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 114
diff changeset
556 (sysdep-defun run-hook-with-args-until-success (hook &rest args)
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 114
diff changeset
557 "Run HOOK with the specified arguments ARGS.
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 114
diff changeset
558 HOOK should be a symbol, a hook variable. Its value should
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 114
diff changeset
559 be a list of functions. We call those functions, one by one,
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 114
diff changeset
560 passing arguments ARGS to each of them, until one of them
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 114
diff changeset
561 returns a non-nil value. Then we return that value.
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 114
diff changeset
562 If all the functions return nil, we return nil."
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 114
diff changeset
563 (let ((rval nil)
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 114
diff changeset
564 (todo (and (boundp hook) (symbol-value hook)))
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 114
diff changeset
565 (global (and (boundp hook) (default-value hook)))
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 114
diff changeset
566 (cur nil))
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 114
diff changeset
567 (while (and (setq cur (car todo)) (not rval))
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 114
diff changeset
568 (setq todo (cdr todo))
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 114
diff changeset
569 (if (eq cur t)
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 114
diff changeset
570 (if global
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 114
diff changeset
571 (setq todo (append global todo)))
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 114
diff changeset
572 (setq rval (apply cur args))))))
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 114
diff changeset
573
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 (sysdep-defun split-string (string pattern)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 "Return a list of substrings of STRING which are separated by PATTERN."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 (let (parts (start 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 (while (string-match pattern string start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 (setq parts (cons (substring string start (match-beginning 0)) parts)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 start (match-end 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 (nreverse (cons (substring string start) parts))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 (sysdep-defun member (elt list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 (while (and list (not (equal elt (car list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 (setq list (cdr list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 (sysdep-defun rassoc (key list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 (let ((found nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 (while (and list (not found))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 (if (equal (cdr (car list)) key) (setq found (car list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 (setq list (cdr list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 found))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 (sysdep-defun display-error (error-object stream)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 "Display `error-object' on `stream' in a user-friendly way."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 (funcall (or (let ((type (car-safe error-object)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 (catch 'error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 (and (consp error-object)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 (symbolp type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 ;;(stringp (get type 'error-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 (consp (get type 'error-conditions))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 (let ((tail (cdr error-object)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 (while (not (null tail))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 (if (consp tail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 (setq tail (cdr tail))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 (throw 'error nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 ;; (check-type condition condition)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 (get type 'error-conditions)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 ;; Search class hierarchy
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 (let ((tail (get type 'error-conditions)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 (while (not (null tail))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 (cond ((not (and (consp tail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 (symbolp (car tail))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 (throw 'error nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 ((get (car tail) 'display-error)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 (throw 'error (get (car tail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 'display-error)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 (setq tail (cdr tail)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 ;; Default method
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 (lambda (error-object stream)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 (let ((type (car error-object))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 (tail (cdr error-object))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 (first t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 (if (eq type 'error)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 (progn (princ (car tail) stream)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 (setq tail (cdr tail)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 (princ (or (get type 'error-message) type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 stream))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 (while tail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 (princ (if first ": " ", ") stream)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 (prin1 (car tail) stream)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 (setq tail (cdr tail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 first nil)))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 (lambda (error-object stream)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 (princ "Peculiar error " stream)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 (prin1 error-object stream))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 error-object stream))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
644 (sysdep-defun decode-time (&optional specified-time)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
645 (let* ((date (current-time-string specified-time))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
646 (dateinfo (and date (timezone-parse-date date)))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
647 (timeinfo (and dateinfo (timezone-parse-time (aref dateinfo 3)))))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
648 (list (aref timeinfo 2) (aref timeinfo 1)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
649 (aref timeinfo 0) (aref dateinfo 2)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
650 (aref dateinfo 1) (aref dateinfo 0)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
651 "unknown" nil 0)))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
652
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 (sysdep-defun find-face (face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 (car-safe (memq face (face-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
656 (sysdep-defun set-marker-insertion-type (marker type)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
657 "Set the insertion-type of MARKER to TYPE.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
658 If TYPE is t, it means the marker advances when you insert text at it.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
659 If TYPE is nil, it means the marker stays behind when you insert text at it."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
660 nil)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
661
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 ;; window functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 ;; not defined in v18
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 (sysdep-defun eval-buffer (bufname &optional printflag)
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
666 (interactive)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 (set-buffer bufname)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 (eval-current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 (sysdep-defun window-minibuffer-p (window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 "Returns non-nil if WINDOW is a minibuffer window."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 (eq window (minibuffer-window)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 (sysdep-defun window-live-p (window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 "Returns t if OBJ is a window which is currently visible."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 (and (windowp window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 (window-point window)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
680 (provide 'w3-sysdp)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 ;;; sysdep.el ends here
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 ;;;(sysdep.el) Local Variables:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 ;;;(sysdep.el) eval: (put 'sysdep-defun 'lisp-indent-function 'defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 ;;;(sysdep.el) eval: (put 'sysdep-defalias 'lisp-indent-function 'defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 ;;;(sysdep.el) eval: (put 'sysdep-defconst 'lisp-indent-function 'defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 ;;;(sysdep.el) eval: (put 'sysdep-defvar 'lisp-indent-function 'defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 ;;;(sysdep.el) End: