annotate lisp/w3/w3-sysdp.el @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents c53a95d3c46d
children 1ce6082ce73f
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
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
3 ;; Copyright (C) 1995 Ben Wing.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
5 ;; Author: Ben Wing <wing@666.com>
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; Keywords: lisp, tools
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
7 ;; Version: 0.001
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
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
53 ;; DO NOT load this file with `require'.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
54 ;; DO NOT put a `provide' statement in this file.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
55
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 ;; 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
57 ;; so that string comparisons to other versions work properly.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
59 (defconst sysdep-potential-version "0.002")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
60
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
61 (if (and (boundp 'sysdep-version)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
62 (not (string-lessp sysdep-version sysdep-potential-version)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
63 ;; if a more recent version of sysdep was already loaded,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
64 ;; or if the same package is loaded again, don't load.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
65 nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
66
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
67 (defconst sysdep-version sysdep-potential-version)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 ;; this macro means: define the function, but only if either it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 ;; wasn't bound before, or the supplied binding comes from an older
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 ;; version of sysdep.el. That way, user-supplied bindings don't
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 ;; get overridden.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 ;; note: sysdep-defalias is often more useful than this function,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 ;; esp. since you can do load-time conditionalizing and can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 ;; optionally leave the function undefined. (e.g. frame functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 ;; in v18.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (defmacro sysdep-defun (function &rest everything-else)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
80 (` (cond ((or (not (fboundp (quote (, function))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
81 (get (quote (, function)) 'sysdep-defined-this))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
82 (put (quote (, function)) 'sysdep-defined-this t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 (defun (, function) (,@ everything-else))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 (defmacro sysdep-defvar (function &rest everything-else)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
86 (` (cond ((or (not (boundp (quote (, function))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
87 (get (quote (, function)) 'sysdep-defined-this))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 (put (quote (, function)) 'sysdep-defined-this t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (defvar (, function) (,@ everything-else))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 (defmacro sysdep-defconst (function &rest everything-else)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
92 (` (cond ((or (not (boundp (quote (, function))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
93 (get (quote (, function)) 'sysdep-defined-this))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (put (quote (, function)) 'sysdep-defined-this t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 (defconst (, function) (,@ everything-else))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 ;; similar for fset and defalias. No need to quote as the argument
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 ;; is already quoted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (defmacro sysdep-fset (function def)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
101 (` (cond ((and (or (not (fboundp (, function)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
102 (get (, function) 'sysdep-defined-this))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 (, def))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 (put (, function) 'sysdep-defined-this t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (fset (, function) (, def))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 (defmacro sysdep-defalias (function def)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
108 (` (cond ((and (or (not (fboundp (, function)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
109 (get (, function) 'sysdep-defined-this))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 (, def)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 (or (listp (, def))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 (and (symbolp (, def))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 (fboundp (, def)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 (put (, function) 'sysdep-defined-this t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 (defalias (, function) (, def))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 ;; bootstrapping: defalias and define-function don't exist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 ;; in older versions of lemacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 (sysdep-fset 'defalias 'fset)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 (sysdep-defalias 'define-function 'defalias)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 ;; useful ways of determining what version is running
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 ;; emacs-major-version and emacs-minor-version are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 ;; already defined in recent versions of FSF Emacs and XEmacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 (sysdep-defconst emacs-major-version
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 ;; will string-match ever fail? If so, assume 19.0.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 ;; (should we assume 18.something?)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 (if (string-match "^[0-9]+" emacs-version)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 (string-to-int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 (substring emacs-version
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 (match-beginning 0) (match-end 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 19))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 (sysdep-defconst emacs-minor-version
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 (if (string-match "^[0-9]+\\.\\([0-9]+\\)" emacs-version)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 (string-to-int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 (substring emacs-version
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 (match-beginning 1) (match-end 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 (sysdep-defconst sysdep-running-xemacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 (or (string-match "Lucid" emacs-version)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 (string-match "XEmacs" emacs-version)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 (sysdep-defconst window-system nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 (sysdep-defconst window-system-version 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 (sysdep-defvar list-buffers-directory nil)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
151 (sysdep-defvar x-library-search-path (`
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
152 ("/usr/X11R6/lib/X11/"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 "/usr/X11R5/lib/X11/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 "/usr/lib/X11R6/X11/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 "/usr/lib/X11R5/X11/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 "/usr/local/X11R6/lib/X11/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 "/usr/local/X11R5/lib/X11/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 "/usr/local/lib/X11R6/X11/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 "/usr/local/lib/X11R5/X11/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 "/usr/X11/lib/X11/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 "/usr/lib/X11/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 "/usr/local/lib/X11/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 "/usr/X386/lib/X11/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 "/usr/x386/lib/X11/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 "/usr/XFree86/lib/X11/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 "/usr/unsupported/lib/X11/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 "/usr/athena/lib/X11/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 "/usr/local/x11r5/lib/X11/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 "/usr/lpp/Xamples/lib/X11/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 "/usr/openwin/lib/X11/"
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
171 "/usr/openwin/share/lib/X11/"
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
172 (, data-directory)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
173 )
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
174 )
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 "Search path used for X11 libraries.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 ;; frame-related stuff.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 (sysdep-defalias 'buffer-dedicated-frame 'buffer-dedicated-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 (sysdep-defalias 'deiconify-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 (cond ((fboundp 'deiconify-screen) 'deiconify-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 ;; make-frame-visible will be defined as necessary
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 (t 'make-frame-visible)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 (sysdep-defalias 'delete-frame 'delete-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 (sysdep-defalias 'event-frame 'event-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 (sysdep-defalias 'event-glyph-extent 'event-glyph)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 (sysdep-defalias 'find-file-other-frame 'find-file-other-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 (sysdep-defalias 'find-file-read-only-other-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 'find-file-read-only-other-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 (sysdep-defalias 'frame-height 'screen-height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 (sysdep-defalias 'frame-iconified-p 'screen-iconified-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 (sysdep-defalias 'frame-left-margin-width 'screen-left-margin-width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 (sysdep-defalias 'frame-list 'screen-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 (sysdep-defalias 'frame-live-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 (cond ((fboundp 'screen-live-p) 'screen-live-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 ((fboundp 'live-screen-p) 'live-screen-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 ;; #### not sure if this is correct (this is for Epoch)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 ;; but gnuserv.el uses it this way
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 ((fboundp 'screenp) 'screenp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (sysdep-defalias 'frame-name 'screen-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 (sysdep-defalias 'frame-parameters 'screen-parameters)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 (sysdep-defalias 'frame-pixel-height 'screen-pixel-height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 (sysdep-defalias 'frame-pixel-width 'screen-pixel-width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 (sysdep-defalias 'frame-right-margin-width 'screen-right-margin-width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 (sysdep-defalias 'frame-root-window 'screen-root-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 (sysdep-defalias 'frame-selected-window 'screen-selected-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 (sysdep-defalias 'frame-totally-visible-p 'screen-totally-visible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 (sysdep-defalias 'frame-visible-p 'screen-visible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 (sysdep-defalias 'frame-width 'screen-width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 (sysdep-defalias 'framep 'screenp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 (sysdep-defalias 'get-frame-for-buffer 'get-screen-for-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 (sysdep-defalias 'get-frame-for-buffer-noselect 'get-screen-for-buffer-noselect)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 (sysdep-defalias 'get-other-frame 'get-other-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 (sysdep-defalias 'iconify-frame 'iconify-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 (sysdep-defalias 'lower-frame 'lower-screen)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
216 (sysdep-defalias 'mail-other-frame 'mail-other-screen)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 (sysdep-defalias 'make-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 (cond ((fboundp 'make-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 (function (lambda (&optional parameters device)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 (make-screen parameters))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 ((fboundp 'x-create-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 (function (lambda (&optional parameters device)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 (x-create-screen parameters))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 (sysdep-defalias 'make-frame-invisible 'make-screen-invisible)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 (sysdep-defalias 'make-frame-visible
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 (cond ((fboundp 'make-screen-visible) 'make-screen-visible)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 ((fboundp 'mapraised-screen) 'mapraised-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 ((fboundp 'x-remap-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 (lambda (&optional x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 (x-remap-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 (accept-process-output)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 (sysdep-defalias 'modify-frame-parameters 'modify-screen-parameters)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 (sysdep-defalias 'new-frame 'new-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 (sysdep-defalias 'next-frame 'next-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 (sysdep-defalias 'next-multiframe-window 'next-multiscreen-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 (sysdep-defalias 'other-frame 'other-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 (sysdep-defalias 'previous-frame 'previous-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 (sysdep-defalias 'previous-multiframe-window 'previous-multiscreen-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 (sysdep-defalias 'raise-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 (cond ((fboundp 'raise-screen) 'raise-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 ((fboundp 'mapraise-screen) 'mapraise-screen)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 (sysdep-defalias 'redraw-frame 'redraw-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 (sysdep-defalias 'select-frame 'select-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 (sysdep-defalias 'selected-frame 'selected-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 (sysdep-defalias 'set-buffer-dedicated-frame 'set-buffer-dedicated-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 (sysdep-defalias 'set-frame-height 'set-screen-height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 (sysdep-defalias 'set-frame-left-margin-width 'set-screen-left-margin-width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 (sysdep-defalias 'set-frame-position 'set-screen-position)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 (sysdep-defalias 'set-frame-right-margin-width 'set-screen-right-margin-width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 (sysdep-defalias 'set-frame-size 'set-screen-size)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 (sysdep-defalias 'set-frame-width 'set-screen-width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 (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
255 (sysdep-defalias 'switch-to-buffer-other-frame 'switch-to-buffer-other-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (sysdep-defalias 'visible-frame-list 'visible-screen-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 (sysdep-defalias 'window-frame 'window-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 (sysdep-defalias 'x-create-frame 'x-create-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 (sysdep-defalias 'x-set-frame-icon-pixmap 'x-set-screen-icon-pixmap)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 (sysdep-defalias 'x-set-frame-pointer 'x-set-screen-pointer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 (sysdep-defalias 'x-display-color-p 'x-color-display-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 (sysdep-defalias 'x-display-grayscale-p 'x-grayscale-display-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 (sysdep-defalias 'menu-event-p 'misc-user-event-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
265 (sysdep-defun add-submenu (menu-path submenu &optional before)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
266 "Add a menu to the menubar or one of its submenus.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
267 If the named menu exists already, it is changed.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
268 MENU-PATH identifies the menu under which the new menu should be inserted.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
269 It is a list of strings; for example, (\"File\") names the top-level \"File\"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
270 menu. (\"File\" \"Foo\") names a hypothetical submenu of \"File\".
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
271 If MENU-PATH is nil, then the menu will be added to the menubar itself.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
272 SUBMENU is the new menu to add.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
273 See the documentation of `current-menubar' for the syntax.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
274 BEFORE, if provided, is the name of a menu before which this menu should
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
275 be added, if this menu is not on its parent already. If the menu is already
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
276 present, it will not be moved."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
277 (add-menu menu-path (car submenu) (cdr submenu) before))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
279 (sysdep-defun add-menu-button (menu-path menu-leaf &optional before)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
280 "Add a menu item to some menu, creating the menu first if necessary.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
281 If the named item exists already, it is changed.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
282 MENU-PATH identifies the menu under which the new menu item should be inserted.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
283 It is a list of strings; for example, (\"File\") names the top-level \"File\"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
284 menu. (\"File\" \"Foo\") names a hypothetical submenu of \"File\".
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
285 MENU-LEAF is a menubar leaf node. See the documentation of `current-menubar'.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
286 BEFORE, if provided, is the name of a menu item before which this item should
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
287 be added, if this item is not on the menu already. If the item is already
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
288 present, it will not be moved."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
289 (add-menu-item menu-path (aref menu-leaf 0) (aref menu-leaf 1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
290 (aref menu-leaf 2) before))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 (sysdep-defun make-glyph (&optional spec-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 (if (and spec-list (cdr-safe (assq 'x spec-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 (make-pixmap (cdr-safe (assq 'x spec-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 (sysdep-defalias 'face-list 'list-faces)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
298 (sysdep-defun facep (face)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
299 "Return t if X is a face name or an internal face vector."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
300 ;; CAUTION!!! This is Emacs 19.x, for x <= 28, specific
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
301 ;; I know of no version of Lucid Emacs or XEmacs that did not have
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
302 ;; facep. Even if they did, they are unsupported, so big deal.
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
303 (and (or (internal-facep face)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
304 (and (symbolp face) (assq face global-face-data)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
305 t))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
306
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 (sysdep-defun set-face-property (face property value &optional locale
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 tag-set how-to-add)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 "Change a property of FACE."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 (and (symbolp face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 (put face property value)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 (sysdep-defun face-property (face property &optional locale tag-set exact-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 "Return FACE's value of the given PROPERTY."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 (and (symbolp face) (get face property)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
317 ;; Property list functions
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
318 ;;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
319 (sysdep-defun plist-put (plist prop val)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
320 "Change value in PLIST of PROP to VAL.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
321 PLIST is a property list, which is a list of the form
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
322 (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
323 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
324 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
325 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
326 The PLIST is modified by side effects."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
327 (let ((node (memq prop plist)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
328 (if node
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
329 (setcar (cdr node) val)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
330 (setq plist (cons prop (cons val plist))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
331 plist))
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-get (plist prop)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
334 "Extract a value from a property list.
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...). This function returns the value
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
337 corresponding to the given PROP, or nil if PROP is not
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
338 one of the properties on the list."
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
339 (car-safe (cdr-safe (memq prop plist))))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
340
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 ;; Device functions
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
342 ;; By wmperry@cs.indiana.edu
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 ;; This is a complete implementation of all the device-* functions found in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 ;; XEmacs 19.14. A 'device' for Emacs 19 is just a frame, from which we can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 ;; determine the connection to an X display, etc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 (sysdep-defalias 'selected-device 'ignore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 (sysdep-defalias 'device-or-frame-p 'framep)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 (sysdep-defalias 'device-console 'ignore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 (sysdep-defalias 'device-sound-enabled-p 'ignore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 (sysdep-defalias 'device-live-p 'frame-live-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 (sysdep-defalias 'devicep 'framep)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 (sysdep-defalias 'frame-device 'identity)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (sysdep-defalias 'redisplay-device 'redraw-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 (sysdep-defalias 'redraw-device 'redraw-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 (sysdep-defalias 'select-device 'select-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (sysdep-defalias 'set-device-class 'ignore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 (sysdep-defun make-device (type connection &optional props)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 "Create a new device of type TYPE, attached to connection CONNECTION.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 The valid values for CONNECTION are device-specific; however,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 CONNECTION is generally a string. (Specifically, for X devices,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 CONNECTION should be a display specification such as \"foo:0\", and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 for TTY devices, CONNECTION should be the filename of a TTY device
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 file, such as \"/dev/ttyp4\", or nil to refer to XEmacs' standard
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 input/output.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 PROPS, if specified, should be a plist of properties controlling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 device creation.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 If CONNECTION specifies an already-existing device connection, that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 device is simply returned; no new device is created, and PROPS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 have no effect."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 ((and (eq type 'x) connection)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
377 (make-frame-on-display display props))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 ((eq type 'x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 (make-frame props))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 ((eq type 'tty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 (error "Unsupported device-type: %s" type))))
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 make-frame-on-device (type connection &optional props)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 "Create a frame of type TYPE on CONNECTION.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 TYPE should be a symbol naming the device type, i.e. one of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 x An X display. CONNECTION should be a standard display string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 such as \"unix:0\", or nil for the display specified on the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 command line or in the DISPLAY environment variable. Only if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 support for X was compiled into XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 tty A standard TTY connection or terminal. CONNECTION should be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 a TTY device name such as \"/dev/ttyp2\" (as determined by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 the Unix command `tty') or nil for XEmacs' standard input
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 and output (usually the TTY in which XEmacs started). Only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 if support for TTY's was compiled into XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 ns A connection to a machine running the NeXTstep windowing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 system. Not currently implemented.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 win32 A connection to a machine running Microsoft Windows NT or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 Windows 95. Not currently implemented.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 pc A direct-write MS-DOS frame. Not currently implemented.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
404 PROPS should be a plist of properties, as in the call to `make-frame'.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 If a connection to CONNECTION already exists, it is reused; otherwise,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 a new connection is opened."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 (make-device type connection props))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 (sysdep-defun make-tty-device (&optional tty terminal-type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 "Create a new device on TTY.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 TTY should be the name of a tty device file (e.g. \"/dev/ttyp3\" under
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 SunOS et al.), as returned by the `tty' command. A value of nil means
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 use the stdin and stdout as passed to XEmacs from the shell.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 If TERMINAL-TYPE is non-nil, it should be a string specifying the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 type of the terminal attached to the specified tty. If it is nil,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 the terminal type will be inferred from the TERM environment variable."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 (make-device 'tty tty (list 'terminal-type terminal-type)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 (sysdep-defun make-x-device (&optional display)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 (make-device 'x display))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 (sysdep-defun set-device-selected-frame (device frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 "Set the selected frame of device object DEVICE to FRAME.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 If DEVICE is nil, the selected device is used.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 If DEVICE is the selected device, this makes FRAME the selected frame."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 (select-frame frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 (sysdep-defun set-device-baud-rate (device rate)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 "Set the output baud rate of DEVICE to RATE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 On most systems, changing this value will affect the amount of padding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 and other strategic decisions made during redisplay."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 (setq baud-rate rate))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 (sysdep-defun dfw-device (obj)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 "Given a device, frame, or window, return the associated device.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 Return nil otherwise."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 ((windowp obj)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 (window-frame obj))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 ((framep obj)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 obj)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 (sysdep-defun event-device (event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 "Return the device that EVENT occurred on.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 This will be nil for some types of events (e.g. keyboard and eval events)."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 (dfw-device (posn-window (event-start event))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 (sysdep-defun find-device (connection &optional type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 "Look for an existing device attached to connection CONNECTION.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 Return the device if found; otherwise, return nil.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 If TYPE is specified, only return devices of that type; otherwise,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 return devices of any type. (It is possible, although unlikely,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 that two devices of different types could have the same connection
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 name; in such a case, the first device found is returned.)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 (let ((devices (device-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 (retval nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 (while (and devices (not nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 (if (equal connection (device-connection (car devices)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 (setq retval (car devices)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 (setq devices (cdr devices)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 retval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 (sysdep-defalias 'get-device 'find-device)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 (sysdep-defun device-baud-rate (&optional device)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 "Return the output baud rate of DEVICE."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 baud-rate)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 (sysdep-defun device-on-window-system-p (&optional device)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 "Return non-nil if DEVICE is on a window system.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 This generally means that there is support for the mouse, the menubar,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 the toolbar, glyphs, etc."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 (and (cdr-safe (assq 'display (frame-parameters device))) t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 (sysdep-defun device-name (&optional device)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 "Return the name of the specified device."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 ;; doesn't handle the 19.29 multiple X display stuff yet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 ;; doesn't handle NeXTStep either
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 ((null window-system) "stdio")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 ((getenv "DISPLAY")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 (let ((str (getenv "DISPLAY"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 (x (1- (length (getenv "DISPLAY"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 (y 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 (while (/= y x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 (if (or (= (aref str y) ?:)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 (= (aref str y) ?.))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 (aset str y ?-))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 (setq y (1+ y)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 str))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 (t "stdio")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 (sysdep-defun device-connection (&optional device)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 "Return the connection of the specified device.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 DEVICE defaults to the selected device if omitted"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 (or (cdr-safe (assq 'display (frame-parameters device))) "stdio"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 (sysdep-defun device-frame-list (&optional device)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 "Return a list of all frames on DEVICE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 If DEVICE is nil, the selected device will be used."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 (let ((desired (device-connection device)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 (filtered-frame-list (function (lambda (x) (equal (device-connection x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 desired))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 (sysdep-defun device-list ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 "Return a list of all devices"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 (let ((seen nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 (cur nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 (conn nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 (retval nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 (not-heard (frame-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 (while not-heard
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 (setq cur (car not-heard)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 conn (device-connection cur)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 not-heard (cdr not-heard))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 (if (member conn seen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 nil ; Already got it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 (setq seen (cons conn seen) ; Whoo hoo, a new one!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 retval (cons cur retval))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 retval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 (sysdep-defvar delete-device-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 "Function or functions to call when a device is deleted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 One argument, the to-be-deleted device.")
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-defun delete-device (device &optional force)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 "Delete DEVICE, permanently eliminating it from use.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 Normally, you cannot delete the last non-minibuffer-only frame (you must
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 use `save-buffers-kill-emacs' or `kill-emacs'). However, if optional
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 second argument FORCE is non-nil, you can delete the last frame. (This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 will automatically call `save-buffers-kill-emacs'.)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 (let ((frames (device-frame-list device)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 (run-hook-with-args 'delete-device-hook device)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 (while frames
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 (delete-frame (car frames) force)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 (setq frames (cdr frames)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 (sysdep-defalias 'device-color-cells
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 ((null window-system) 'ignore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 ((fboundp 'display-color-cells) 'display-color-cells)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 ((fboundp 'x-display-color-cells) 'x-display-color-cells)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 ((fboundp 'ns-display-color-cells) 'ns-display-color-celles)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 (t 'ignore)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 (sysdep-defun try-font-name (fontname &rest args)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
550 (car-safe (x-list-fonts fontname)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 (sysdep-defalias 'device-pixel-width
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 (cond
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
554 ((and (eq window-system 'x) (fboundp 'x-display-pixel-width))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 'x-display-pixel-width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 ((and (eq window-system 'ns) (fboundp 'ns-display-pixel-width))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 'ns-display-pixel-width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 (t 'ignore)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 (sysdep-defalias 'device-pixel-height
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 (cond
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
562 ((and (eq window-system 'x) (fboundp 'x-display-pixel-height))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 'x-display-pixel-height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 ((and (eq window-system 'ns) (fboundp 'ns-display-pixel-height))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 'ns-display-pixel-height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 (t 'ignore)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 (sysdep-defalias 'device-mm-width
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 (cond
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
570 ((and (eq window-system 'x) (fboundp 'x-display-mm-width))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 'x-display-mm-width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 ((and (eq window-system 'ns) (fboundp 'ns-display-mm-width))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 'ns-display-mm-width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 (t 'ignore)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 (sysdep-defalias 'device-mm-height
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 (cond
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
578 ((and (eq window-system 'x) (fboundp 'x-display-mm-height))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 'x-display-mm-height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 ((and (eq window-system 'ns) (fboundp 'ns-display-mm-height))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 'ns-display-mm-height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 (t 'ignore)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 (sysdep-defalias 'device-bitplanes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 (cond
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
586 ((and (eq window-system 'x) (fboundp 'x-display-planes))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 'x-display-planes)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 ((and (eq window-system 'ns) (fboundp 'ns-display-planes))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 'ns-display-planes)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 (t 'ignore)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 (sysdep-defalias 'device-class
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 (cond
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
594 ;; First, Xwindows
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 ((and (eq window-system 'x) (fboundp 'x-display-visual-class))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 (lambda (&optional device)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 (let ((val (symbol-name (x-display-visual-class device))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 ((string-match "color" val) 'color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 ((string-match "gray-scale" val) 'grayscale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 (t 'mono))))))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
603 ;; Now, Presentation-Manager under OS/2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
604 ((and (eq window-system 'pm) (fboundp 'pm-display-visual-class))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
605 (function
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
606 (lambda (&optional device)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
607 (let ((val (symbol-name (pm-display-visual-class device))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
608 (cond
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
609 ((string-match "color" val) 'color)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
610 ((string-match "gray-scale" val) 'grayscale)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
611 (t 'mono))))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
612 ;; A slightly different way of doing it under OS/2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
613 ((and (eq window-system 'pm) (fboundp 'pm-display-color-p))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
614 (function
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
615 (lambda (&optional device)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
616 (if (pm-display-color-p)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
617 'color
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
618 'mono))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 ((fboundp 'number-of-colors)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 (lambda (&optional device)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 (if (= 2 (number-of-colors))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 'mono
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 'color))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 ((and (eq window-system 'x) (fboundp 'x-color-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 (lambda (&optional device)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 (if (x-color-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 'color
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 'mono))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 ((and (eq window-system 'ns) (fboundp 'ns-display-visual-class))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 (lambda (&optional device)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 (let ((val (symbol-name (ns-display-visual-class))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 ((string-match "color" val) 'color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 ((string-match "gray-scale" val) 'grayscale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 (t 'mono))))))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
639 (t (function (lambda (&optional device) 'mono)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 (sysdep-defun device-class-list ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 "Returns a list of valid device classes."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 (list 'color 'grayscale 'mono))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 (sysdep-defun valid-device-class-p (class)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 "Given a CLASS, return t if it is valid.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 Valid classes are 'color, 'grayscale, and 'mono."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 (memq class (device-class-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 (sysdep-defun device-or-frame-type (device-or-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 "Return the type (e.g. `x' or `tty') of DEVICE-OR-FRAME.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 DEVICE-OR-FRAME should be a device or a frame object. See `device-type'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 for a description of the possible types."
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
654 (if (or (cdr-safe (assq 'display (frame-parameters device-or-frame)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
655 (cdr-safe (assq 'window-id (frame-parameters device-or-frame))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 window-system
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 'tty))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 (sysdep-defun device-type (&optional device)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 "Return the type of the specified device (e.g. `x' or `tty').
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 Value is `tty' for a tty device (a character-only terminal),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 `x' for a device which is a connection to an X server,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 'ns' for a device which is a connection to a NeXTStep dps server,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 'win32' for a Windows-NT window,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 'pm' for an OS/2 Presentation Manager window,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 'intuition' for an Amiga screen"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 (device-or-frame-type device))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 (sysdep-defun device-type-list ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 "Return a list of valid console types."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 (if window-system
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 (list window-system 'tty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 (list 'tty)))
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 valid-device-type-p (type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 "Given a TYPE, return t if it is valid."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 (memq type (device-type-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
679
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 ;; Extent stuff
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 (sysdep-fset 'delete-extent 'delete-overlay)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 (sysdep-fset 'extent-end-position 'overlay-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 (sysdep-fset 'extent-start-position 'overlay-start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 (sysdep-fset 'set-extent-endpoints 'move-overlay)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
685 (sysdep-fset 'set-extent-property 'overlay-put)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
686 (sysdep-fset 'make-extent 'make-overlay)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 (sysdep-defun extent-property (extent property &optional default)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689 (or (overlay-get extent property) default))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 (sysdep-defun extent-at (pos &optional object property before at-flag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 (let ((tmp (overlays-at (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693 ovls)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 (if property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 (while tmp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 (if (extent-property (car tmp) property)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 (setq ovls (cons (car tmp) ovls)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 (setq tmp (cdr tmp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 (setq ovls tmp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 tmp nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701 (car-safe
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 (sort ovls
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 (lambda (a b)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 (< (- (extent-end-position a) (extent-start-position a))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 (- (extent-end-position b) (extent-start-position b)))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 (sysdep-defun overlays-in (beg end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 "Return a list of the overlays that overlap the region BEG ... END.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 Overlap means that at least one character is contained within the overlay
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 and also contained within the specified region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 Empty overlays are included in the result if they are located at BEG
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 or between BEG and END."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 (let ((ovls (overlay-lists))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 tmp retval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 (if (< end beg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 (setq tmp end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 end beg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719 beg tmp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 (setq ovls (nconc (car ovls) (cdr ovls)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 (while ovls
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 (setq tmp (car ovls)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 ovls (cdr ovls))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 (if (or (and (<= (overlay-start tmp) end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 (>= (overlay-start tmp) beg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 (and (<= (overlay-end tmp) end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 (>= (overlay-end tmp) beg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 (setq retval (cons tmp retval))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 retval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 (sysdep-defun map-extents (function &optional object from to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 maparg flags property value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 (let ((tmp (overlays-in (or from (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 (or to (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 ovls)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 (if property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 (while tmp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 (if (extent-property (car tmp) property)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 (setq ovls (cons (car tmp) ovls)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 (setq tmp (cdr tmp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 (setq ovls tmp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 tmp nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 (catch 'done
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 (while ovls
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 (setq tmp (funcall function (car ovls) maparg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 ovls (cdr ovls))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 (if tmp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 (throw 'done tmp))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 ;; misc
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
751 (sysdep-fset 'make-local-hook 'make-local-variable)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
752
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
753 (sysdep-defun buffer-substring-no-properties (beg end)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
754 "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
755 (format "%s" (buffer-substring beg end)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
756
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 (sysdep-defun symbol-value-in-buffer (symbol buffer &optional unbound-value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 "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
759 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761 (if (not (boundp symbol))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 unbound-value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 (symbol-value symbol))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 (sysdep-defun insert-file-contents-literally
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 (file &optional visit beg end replace)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767 "Like `insert-file-contents', q.v., but only reads in the file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 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
769 to advanced Emacs features, such as file-name-handlers, format decoding,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770 find-file-hooks, etc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771 This function ensures that none of these modifications will take place."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772 (let ((file-name-handler-alist nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773 (find-file-hooks nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774 (insert-file-contents file visit beg end replace)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776 (sysdep-defun alist-to-plist (alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777 "Convert association list ALIST into the equivalent property-list form.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 The plist is returned. This converts from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780 \((a . 1) (b . 2) (c . 3))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782 into
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784 \(a 1 b 2 c 3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 The original alist is not modified. See also `destructive-alist-to-plist'."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787 (let (plist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 (while alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789 (let ((el (car alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790 (setq plist (cons (cdr el) (cons (car el) plist))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 (setq alist (cdr alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792 (nreverse plist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 (sysdep-defun add-minor-mode (toggle name &optional keymap after toggle-fun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 "Add a minor mode to `minor-mode-alist' and `minor-mode-map-alist'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796 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
797 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
798 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
799 mode is active, and AFTER is the toggling symbol used for another minor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800 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
801 minor-mode alists. TOGGLE-FUN specifies an interactive function that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 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
803 button2 is pressed on the mode, and when button3 is pressed somewhere
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 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
805 interactive function, TOGGLE is used as the toggle function.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807 Example: (add-minor-mode 'view-minor-mode \" View\" view-mode-map)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 (if (not (assq toggle minor-mode-alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809 (setq minor-mode-alist (cons (list toggle name) minor-mode-alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 (if (and keymap (not (assq toggle minor-mode-map-alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 (setq minor-mode-map-alist (cons (cons toggle keymap)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812 minor-mode-map-alist))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 (sysdep-defvar x-font-regexp-foundry-and-family
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815 (let ((- "[-?]")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816 (foundry "[^-]+")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817 (family "[^-]+")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 (concat "\\`[-?*]" foundry - "\\(" family "\\)" -)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 (sysdep-defun match-string (num &optional string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 "Return string of text matched by last search.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 NUM specifies which parenthesized expression in the last regexp.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 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
825 Zero means the entire text matched by the whole regexp or whole string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 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
827 (if (match-beginning num)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 (if string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 (substring string (match-beginning num) (match-end num))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830 (buffer-substring (match-beginning num) (match-end num)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 (sysdep-defun add-hook (hook-var function &optional at-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 "Add a function to a hook.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 First argument HOOK-VAR (a symbol) is the name of a hook, second
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 argument FUNCTION is the function to add.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 Third (optional) argument AT-END means to add the function at the end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 of the hook list instead of the beginning. If the function is already
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 present, this has no effect.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 Returns nil if FUNCTION was already present in HOOK-VAR, else new
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 value of HOOK-VAR."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841 (if (not (boundp hook-var)) (set hook-var nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 (let ((old (symbol-value hook-var)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 (if (or (not (listp old)) (eq (car old) 'lambda))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 (setq old (list old)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 (if (member function old)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 (set hook-var
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 (if at-end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 (append old (list function)) ; don't nconc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 (cons function old))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 (sysdep-defalias 'valid-color-name-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 ((fboundp 'x-valid-color-name-p) ; XEmacs/Lucid
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855 'x-valid-color-name-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856 ((and window-system
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857 (fboundp 'color-defined-p)) ; NS/Emacs 19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 'color-defined-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 ((and window-system
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
860 (fboundp 'pm-color-defined-p))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
861 'pm-color-defined-p)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
862 ((and window-system
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 (fboundp 'x-color-defined-p)) ; Emacs 19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864 'x-color-defined-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865 ((fboundp 'get-color) ; Epoch
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 (function (lambda (color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867 (let ((x (get-color color)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 (if x
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 (setq x (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 (free-color x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871 t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 x))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 (t 'identity))) ; All others
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875 ;; Misc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 (sysdep-defun split-string (string pattern)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 "Return a list of substrings of STRING which are separated by PATTERN."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 (let (parts (start 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 (while (string-match pattern string start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 (setq parts (cons (substring string start (match-beginning 0)) parts)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 start (match-end 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 (nreverse (cons (substring string start) parts))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 (sysdep-defun member (elt list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886 (while (and list (not (equal elt (car list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 (setq list (cdr list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 (sysdep-defun rassoc (key list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891 (let ((found nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892 (while (and list (not found))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 (if (equal (cdr (car list)) key) (setq found (car list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 (setq list (cdr list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 found))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 (sysdep-defun display-error (error-object stream)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 "Display `error-object' on `stream' in a user-friendly way."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 (funcall (or (let ((type (car-safe error-object)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900 (catch 'error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 (and (consp error-object)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902 (symbolp type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 ;;(stringp (get type 'error-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904 (consp (get type 'error-conditions))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 (let ((tail (cdr error-object)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906 (while (not (null tail))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907 (if (consp tail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908 (setq tail (cdr tail))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909 (throw 'error nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911 ;; (check-type condition condition)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912 (get type 'error-conditions)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 ;; Search class hierarchy
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914 (let ((tail (get type 'error-conditions)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 (while (not (null tail))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 (cond ((not (and (consp tail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917 (symbolp (car tail))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 (throw 'error nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 ((get (car tail) 'display-error)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920 (throw 'error (get (car tail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921 'display-error)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923 (setq tail (cdr tail)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 ;; Default method
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 (lambda (error-object stream)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 (let ((type (car error-object))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928 (tail (cdr error-object))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 (first t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 (if (eq type 'error)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 (progn (princ (car tail) stream)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932 (setq tail (cdr tail)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 (princ (or (get type 'error-message) type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 stream))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935 (while tail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 (princ (if first ": " ", ") stream)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937 (prin1 (car tail) stream)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938 (setq tail (cdr tail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939 first nil)))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941 (lambda (error-object stream)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 (princ "Peculiar error " stream)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 (prin1 error-object stream))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 error-object stream))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 (sysdep-defun find-face (face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 (car-safe (memq face (face-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
949 (sysdep-defun set-marker-insertion-type (marker type)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
950 "Set the insertion-type of MARKER to TYPE.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
951 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
952 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
953 nil)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
954
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 ;; window functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957 ;; not defined in v18
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958 (sysdep-defun eval-buffer (bufname &optional printflag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960 (set-buffer bufname)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961 (eval-current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963 (sysdep-defun window-minibuffer-p (window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964 "Returns non-nil if WINDOW is a minibuffer window."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965 (eq window (minibuffer-window)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967 (sysdep-defun window-live-p (window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968 "Returns t if OBJ is a window which is currently visible."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 (and (windowp window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970 (window-point window)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
972 ;; this parenthesis closes the if statement at the top of the file.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
973
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
974 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
975
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
976 ;; DO NOT put a provide statement here. This file should never be
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
977 ;; loaded with `require'. Use `load-library' instead.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 36
diff changeset
978
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979 ;;; sysdep.el ends here
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981 ;;;(sysdep.el) Local Variables:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982 ;;;(sysdep.el) eval: (put 'sysdep-defun 'lisp-indent-function 'defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 ;;;(sysdep.el) eval: (put 'sysdep-defalias 'lisp-indent-function 'defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984 ;;;(sysdep.el) eval: (put 'sysdep-defconst 'lisp-indent-function 'defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985 ;;;(sysdep.el) eval: (put 'sysdep-defvar 'lisp-indent-function 'defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986 ;;;(sysdep.el) End: