Mercurial > hg > xemacs-beta
comparison lisp/obsolete.el @ 209:41ff10fd062f r20-4b3
Import from CVS: tag r20-4b3
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:04:58 +0200 |
parents | |
children | c5d627a313b1 |
comparison
equal
deleted
inserted
replaced
208:f427b8ec4379 | 209:41ff10fd062f |
---|---|
1 ;;; obsolete.el --- obsoleteness support | |
2 | |
3 ;; Copyright (C) 1985-1994, 1997 Free Software Foundation, Inc. | |
4 ;; Copyright (C) 1994, 1995 Amdahl Corporation. | |
5 ;; Copyright (C) 1995 Sun Microsystems. | |
6 | |
7 ;; Maintainer: XEmacs Development Team | |
8 ;; Keywords: internal, dumped | |
9 | |
10 ;; This file is part of XEmacs. | |
11 | |
12 ;; XEmacs is free software; you can redistribute it and/or modify it | |
13 ;; under the terms of the GNU General Public License as published by | |
14 ;; the Free Software Foundation; either version 2, or (at your option) | |
15 ;; any later version. | |
16 | |
17 ;; XEmacs is distributed in the hope that it will be useful, but | |
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
20 ;; General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
23 ;; along with XEmacs; see the file COPYING. If not, write to the | |
24 ;; Free Software Foundation, 59 Temple Place - Suite 330, | |
25 ;; Boston, MA 02111-1307, USA. | |
26 | |
27 ;;; Synched up with: Not in FSF. | |
28 | |
29 ;;; Commentary: | |
30 | |
31 ;; This file is dumped with XEmacs. | |
32 | |
33 ;; The obsoleteness support used to be scattered throughout various | |
34 ;; source files. We put the stuff in one place to remove the junkiness | |
35 ;; from other source files and to facilitate creating/updating things | |
36 ;; like sysdep.el. | |
37 | |
38 ;;; Code: | |
39 | |
40 (defsubst define-obsolete-function-alias (oldfun newfun) | |
41 "Define OLDFUN as an obsolete alias for function NEWFUN. | |
42 This makes calling OLDFUN equivalent to calling NEWFUN and marks OLDFUN | |
43 as obsolete." | |
44 (define-function oldfun newfun) | |
45 (make-obsolete oldfun newfun)) | |
46 | |
47 (defsubst define-compatible-function-alias (oldfun newfun) | |
48 "Define OLDFUN as a compatible alias for function NEWFUN. | |
49 This makes calling OLDFUN equivalent to calling NEWFUN and marks OLDFUN | |
50 as provided for compatibility only." | |
51 (define-function oldfun newfun) | |
52 (make-compatible oldfun newfun)) | |
53 | |
54 (defsubst define-obsolete-variable-alias (oldvar newvar) | |
55 "Define OLDVAR as an obsolete alias for variable NEWVAR. | |
56 This makes referencing or setting OLDVAR equivalent to referencing or | |
57 setting NEWVAR and marks OLDVAR as obsolete. | |
58 If OLDVAR was bound and NEWVAR was not, Set NEWVAR to OLDVAR. | |
59 | |
60 Note: Use this before any other references (defvar/defcustom) to NEWVAR" | |
61 (let ((needs-setting (and (boundp oldvar) (not (boundp newvar)))) | |
62 (value (and (boundp oldvar) (symbol-value oldvar)))) | |
63 (defvaralias oldvar newvar) | |
64 (make-obsolete-variable oldvar newvar) | |
65 (and needs-setting (set newvar value)))) | |
66 | |
67 (defsubst define-compatible-variable-alias (oldvar newvar) | |
68 "Define OLDVAR as a compatible alias for variable NEWVAR. | |
69 This makes referencing or setting OLDVAR equivalent to referencing or | |
70 setting NEWVAR and marks OLDVAR as provided for compatibility only." | |
71 (defvaralias oldvar newvar) | |
72 (make-compatible-variable oldvar newvar)) | |
73 | |
74 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; device stuff | |
75 | |
76 (make-compatible-variable 'window-system "use (console-type)") | |
77 (make-obsolete-variable 'meta-flag | |
78 "use the `set-input-mode' function instead.") | |
79 | |
80 (defun x-display-color-p (&optional device) | |
81 "Returns non-nil if DEVICE is a color device." | |
82 (eq 'color (device-class device))) | |
83 (make-compatible 'x-display-color-p 'device-class) | |
84 | |
85 (define-function 'x-color-display-p 'x-display-color-p) | |
86 (make-compatible 'x-display-color-p 'device-class) | |
87 | |
88 (defun x-display-grayscale-p (&optional device) | |
89 "Returns non-nil if DEVICE is a grayscale device." | |
90 (eq 'grayscale (device-class device))) | |
91 (make-compatible 'x-display-grayscale-p 'device-class) | |
92 | |
93 (define-function 'x-grayscale-display-p 'x-display-grayscale-p) | |
94 (make-compatible 'x-display-grayscale-p 'device-class) | |
95 | |
96 (define-compatible-function-alias 'x-display-pixel-width 'device-pixel-width) | |
97 (define-compatible-function-alias 'x-display-pixel-height | |
98 'device-pixel-height) | |
99 (define-compatible-function-alias 'x-display-planes 'device-bitplanes) | |
100 (define-compatible-function-alias 'x-display-color-cells 'device-color-cells) | |
101 | |
102 (define-obsolete-function-alias 'baud-rate 'device-baud-rate) | |
103 | |
104 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; events | |
105 | |
106 (define-obsolete-function-alias 'menu-event-p 'misc-user-event-p) | |
107 (make-obsolete-variable 'unread-command-char 'unread-command-events) | |
108 (make-obsolete 'sleep-for-millisecs "use sleep-for with a float") | |
109 | |
110 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; extents | |
111 | |
112 (defun extent-data (extent) | |
113 "Obsolete. Returns the `data' property of the given extent." | |
114 (extent-property extent 'data)) | |
115 (make-obsolete 'set-window-dot 'set-window-point) | |
116 | |
117 (defun set-extent-data (extent data) | |
118 "Obsolete. Sets the `data' property of the given extent." | |
119 (set-extent-property extent 'data data)) | |
120 (make-obsolete 'set-extent-data 'set-extent-property) | |
121 | |
122 (define-obsolete-function-alias 'extent-buffer 'extent-object) | |
123 | |
124 (defun set-extent-attribute (extent attr &optional clearp) | |
125 "" ;; obsoleteness info will be displayed, so no need for anything more. | |
126 (cond ((eq attr 'write-protected) | |
127 (set-extent-property extent 'read-only t)) | |
128 ((eq attr 'unhighlight) | |
129 (set-extent-property extent 'mouse-face nil)) | |
130 ((eq attr 'writable) | |
131 (set-extent-property extent 'read-only nil)) | |
132 ((eq attr 'visible) | |
133 (set-extent-property extent 'invisible nil)) | |
134 (t | |
135 (set-extent-property extent attr t)))) | |
136 (make-obsolete 'set-extent-attribute 'set-extent-property) | |
137 | |
138 (defun extent-glyph (extent) | |
139 "" ;; obsoleteness info will be displayed, so no need for anything more. | |
140 (or (extent-begin-glyph extent) | |
141 (extent-end-glyph extent))) | |
142 (make-obsolete 'extent-glyph | |
143 "use `extent-begin-glyph' or `extent-end-glyph' instead.") | |
144 | |
145 (defun extent-layout (extent) | |
146 "" ;; obsoleteness info will be displayed, so no need for anything more. | |
147 (extent-begin-glyph-layout extent)) | |
148 (make-obsolete 'extent-layout | |
149 "use `extent-begin-glyph-layout' or `extent-end-glyph-layout' instead.") | |
150 | |
151 (defun set-extent-layout (extent layout) | |
152 "" ;; obsoleteness info will be displayed, so no need for anything more. | |
153 (set-extent-begin-glyph-layout extent layout)) | |
154 (make-obsolete 'set-extent-layout | |
155 "use `set-extent-begin-glyph-layout' or `set-extent-end-glyph-layout' instead.") | |
156 | |
157 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; frames | |
158 | |
159 (define-obsolete-variable-alias 'select-screen-hook 'select-frame-hook) | |
160 (define-obsolete-variable-alias 'deselect-screen-hook 'deselect-frame-hook) | |
161 (define-obsolete-variable-alias 'auto-raise-screen 'auto-raise-frame) | |
162 (define-obsolete-variable-alias 'auto-lower-screen 'auto-lower-frame) | |
163 (define-obsolete-variable-alias 'get-screen-for-buffer-default-screen-name | |
164 'get-frame-for-buffer-default-frame-name) | |
165 | |
166 (define-obsolete-function-alias 'buffer-dedicated-screen | |
167 'buffer-dedicated-frame) | |
168 (define-obsolete-function-alias 'deiconify-screen 'deiconify-frame) | |
169 (define-obsolete-function-alias 'delete-screen 'delete-frame) | |
170 (define-obsolete-function-alias 'event-screen 'event-frame) | |
171 (define-obsolete-function-alias 'find-file-other-screen 'find-file-other-frame) | |
172 (define-obsolete-function-alias 'find-file-read-only-other-screen | |
173 'find-file-read-only-other-frame) | |
174 (define-obsolete-function-alias 'live-screen-p 'frame-live-p) | |
175 (define-obsolete-function-alias 'screen-height 'frame-height) | |
176 (define-obsolete-function-alias 'screen-iconified-p 'frame-iconified-p) | |
177 (define-obsolete-function-alias 'screen-list 'frame-list) | |
178 (define-obsolete-function-alias 'screen-live-p 'frame-live-p) | |
179 (define-obsolete-function-alias 'screen-name 'frame-name) | |
180 (define-obsolete-function-alias 'screen-parameters 'frame-parameters) | |
181 (define-obsolete-function-alias 'screen-pixel-height 'frame-pixel-height) | |
182 (define-obsolete-function-alias 'screen-pixel-width 'frame-pixel-width) | |
183 (define-obsolete-function-alias 'screen-root-window 'frame-root-window) | |
184 (define-obsolete-function-alias 'screen-selected-window 'frame-selected-window) | |
185 (define-obsolete-function-alias 'screen-totally-visible-p | |
186 'frame-totally-visible-p) | |
187 (define-obsolete-function-alias 'screen-visible-p 'frame-visible-p) | |
188 (define-obsolete-function-alias 'screen-width 'frame-width) | |
189 (define-obsolete-function-alias 'screenp 'framep) | |
190 (define-obsolete-function-alias 'get-screen-for-buffer 'get-frame-for-buffer) | |
191 (define-obsolete-function-alias 'get-screen-for-buffer-noselect | |
192 'get-frame-for-buffer-noselect) | |
193 (define-obsolete-function-alias 'get-other-screen 'get-other-frame) | |
194 (define-obsolete-function-alias 'iconify-screen 'iconify-frame) | |
195 (define-obsolete-function-alias 'lower-screen 'lower-frame) | |
196 (define-obsolete-function-alias 'mail-other-screen 'mail-other-frame) | |
197 (define-obsolete-function-alias 'make-screen 'make-frame) | |
198 (define-obsolete-function-alias 'make-screen-invisible 'make-frame-invisible) | |
199 (define-obsolete-function-alias 'make-screen-visible 'make-frame-visible) | |
200 (define-obsolete-function-alias 'modify-screen-parameters | |
201 'modify-frame-parameters) | |
202 (define-obsolete-function-alias 'new-screen 'new-frame) | |
203 (define-obsolete-function-alias 'next-screen 'next-frame) | |
204 (define-obsolete-function-alias 'next-multiscreen-window | |
205 'next-multiframe-window) | |
206 (define-obsolete-function-alias 'other-screen 'other-frame) | |
207 (define-obsolete-function-alias 'previous-screen 'previous-frame) | |
208 (define-obsolete-function-alias 'previous-multiscreen-window | |
209 'previous-multiframe-window) | |
210 (define-obsolete-function-alias 'raise-screen 'raise-frame) | |
211 (define-obsolete-function-alias 'redraw-screen 'redraw-frame) | |
212 (define-obsolete-function-alias 'select-screen 'select-frame) | |
213 (define-obsolete-function-alias 'selected-screen 'selected-frame) | |
214 (define-obsolete-function-alias 'set-buffer-dedicated-screen | |
215 'set-buffer-dedicated-frame) | |
216 (define-obsolete-function-alias 'set-screen-height 'set-frame-height) | |
217 (define-obsolete-function-alias 'set-screen-position 'set-frame-position) | |
218 (define-obsolete-function-alias 'set-screen-size 'set-frame-size) | |
219 (define-obsolete-function-alias 'set-screen-width 'set-frame-width) | |
220 (define-obsolete-function-alias 'show-temp-buffer-in-current-screen | |
221 'show-temp-buffer-in-current-frame) | |
222 (define-obsolete-function-alias 'switch-to-buffer-other-screen | |
223 'switch-to-buffer-other-frame) | |
224 (define-obsolete-function-alias 'visible-screen-list 'visible-frame-list) | |
225 (define-obsolete-function-alias 'window-screen 'window-frame) | |
226 (define-obsolete-function-alias 'x-set-screen-pointer | |
227 'set-frame-pointer) | |
228 (define-obsolete-function-alias 'x-set-frame-pointer | |
229 'set-frame-pointer) | |
230 | |
231 (define-obsolete-variable-alias 'screen-title-format 'frame-title-format) | |
232 (define-obsolete-variable-alias 'screen-icon-title-format | |
233 'frame-icon-title-format) | |
234 (define-obsolete-variable-alias 'terminal-screen 'terminal-frame) | |
235 (define-obsolete-variable-alias 'delete-screen-hook 'delete-frame-hook) | |
236 (define-obsolete-variable-alias 'create-screen-hook 'create-frame-hook) | |
237 (define-obsolete-variable-alias 'mouse-enter-screen-hook | |
238 'mouse-enter-frame-hook) | |
239 (define-obsolete-variable-alias 'mouse-leave-screen-hook | |
240 'mouse-leave-frame-hook) | |
241 (define-obsolete-variable-alias 'map-screen-hook 'map-frame-hook) | |
242 (define-obsolete-variable-alias 'unmap-screen-hook 'unmap-frame-hook) | |
243 (define-obsolete-variable-alias 'default-screen-alist 'default-frame-alist) | |
244 (define-obsolete-variable-alias 'default-screen-name 'default-frame-name) | |
245 (define-obsolete-variable-alias 'x-screen-defaults 'default-x-frame-alist) | |
246 | |
247 (defun x-create-screen (parms window-id) | |
248 "" | |
249 (if (not (eq 'x (device-type (selected-device)))) | |
250 (error "Cannot create X frames on non-X device")) | |
251 (make-frame (append parms (list (list 'window-id window-id))) | |
252 (selected-device))) | |
253 (make-obsolete 'x-create-screen 'make-frame) | |
254 | |
255 (defun frame-first-window (frame) | |
256 "Returns the topmost, leftmost window of FRAME. | |
257 If omitted, FRAME defaults to the currently selected frame." | |
258 (frame-highest-window frame 0)) | |
259 (make-compatible 'frame-first-window 'frame-highest-window) | |
260 | |
261 (define-obsolete-variable-alias 'initial-frame-alist 'initial-frame-plist) | |
262 (define-obsolete-variable-alias 'minibuffer-frame-alist | |
263 'minibuffer-frame-plist) | |
264 (define-obsolete-variable-alias 'pop-up-frame-alist 'pop-up-frame-plist) | |
265 (define-obsolete-variable-alias 'special-display-frame-alist | |
266 'special-display-frame-plist) | |
267 | |
268 ;; Defined in C. | |
269 | |
270 (define-obsolete-variable-alias 'default-frame-alist 'default-frame-plist) | |
271 (define-obsolete-variable-alias 'default-x-frame-alist 'default-x-frame-plist) | |
272 (define-obsolete-variable-alias 'default-tty-frame-alist | |
273 'default-tty-frame-plist) | |
274 | |
275 (make-compatible 'frame-parameters 'frame-property) | |
276 (defun frame-parameters (&optional frame) | |
277 "Return the parameters-alist of frame FRAME. | |
278 It is a list of elements of the form (PARM . VALUE), where PARM is a symbol. | |
279 The meaningful PARMs depend on the kind of frame. | |
280 If FRAME is omitted, return information on the currently selected frame. | |
281 | |
282 See the variables `default-frame-plist', `default-x-frame-plist', and | |
283 `default-tty-frame-plist' for a description of the parameters meaningful | |
284 for particular types of frames." | |
285 (or frame (setq frame (selected-frame))) | |
286 ;; #### This relies on a `copy-sequence' of the user properties in | |
287 ;; `frame-properties'. Removing that would make `frame-properties' more | |
288 ;; efficient but this function less efficient, as we couldn't be | |
289 ;; destructive. Since most callers now use `frame-parameters', we'll | |
290 ;; do it this way. Should probably change this at some point in the | |
291 ;; future. | |
292 (destructive-plist-to-alist (frame-properties frame))) | |
293 | |
294 (make-compatible 'modify-frame-parameters 'set-frame-properties) | |
295 (defun modify-frame-parameters (frame alist) | |
296 "Modify the properties of frame FRAME according to ALIST. | |
297 ALIST is an alist of properties to change and their new values. | |
298 Each element of ALIST has the form (PARM . VALUE), where PARM is a symbol. | |
299 The meaningful PARMs depend on the kind of frame. | |
300 | |
301 See `set-frame-properties' for built-in property names." | |
302 ;; it would be nice to be destructive here but that's not safe. | |
303 (set-frame-properties frame (alist-to-plist alist))) | |
304 | |
305 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; faces | |
306 | |
307 (define-obsolete-function-alias 'list-faces-display 'edit-faces) | |
308 (define-obsolete-function-alias 'list-faces 'face-list) | |
309 | |
310 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; files | |
311 | |
312 (make-obsolete-variable 'trim-versions-without-asking 'delete-old-versions) | |
313 ;;; Old XEmacs name; kept around for compatibility. | |
314 (define-obsolete-variable-alias 'after-write-file-hooks 'after-save-hook) | |
315 (define-obsolete-function-alias 'truename 'file-truename) | |
316 | |
317 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; hooks | |
318 | |
319 (make-obsolete-variable 'auto-fill-hook 'auto-fill-function) | |
320 (make-obsolete-variable 'blink-paren-hook 'blink-paren-function) | |
321 (make-obsolete-variable 'lisp-indent-hook 'lisp-indent-function) | |
322 (make-obsolete-variable 'comment-indent-hook 'comment-indent-function) | |
323 (make-obsolete-variable 'temp-buffer-show-hook | |
324 'temp-buffer-show-function) | |
325 (make-obsolete-variable 'inhibit-local-variables | |
326 "use `enable-local-variables' (with the reversed sense).") | |
327 (make-obsolete-variable 'suspend-hooks 'suspend-hook) | |
328 (make-obsolete-variable 'first-change-function 'first-change-hook) | |
329 (make-obsolete-variable 'before-change-function | |
330 "use before-change-functions; which is a list of functions rather than a single function.") | |
331 (make-obsolete-variable 'after-change-function | |
332 "use after-change-functions; which is a list of functions rather than a single function.") | |
333 | |
334 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; insertion and deletion | |
335 | |
336 (define-compatible-function-alias 'insert-and-inherit 'insert) | |
337 (define-compatible-function-alias 'insert-before-markers-and-inherit | |
338 'insert-before-markers) | |
339 | |
340 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; keymaps | |
341 | |
342 (defun keymap-parent (keymap) | |
343 "Returns the first parent of the given keymap." | |
344 (car (keymap-parents keymap))) | |
345 (make-compatible 'keymap-parent 'keymap-parents) | |
346 | |
347 (defun set-keymap-parent (keymap parent) | |
348 "Makes the given keymap have (only) the given parent." | |
349 (set-keymap-parents keymap (if parent (list parent) '())) | |
350 parent) | |
351 (make-compatible 'set-keymap-parent 'set-keymap-parents) | |
352 | |
353 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; menu stuff | |
354 | |
355 (defun add-menu-item (menu-path item-name function enabled-p &optional before) | |
356 "Obsolete. See the function `add-menu-button'." | |
357 (or item-name (error "must specify an item name")) | |
358 (add-menu-button menu-path (vector item-name function enabled-p) before)) | |
359 (make-obsolete 'add-menu-item 'add-menu-button) | |
360 | |
361 (defun add-menu (menu-path menu-name menu-items &optional before) | |
362 "See the function `add-submenu'." | |
363 (or menu-name (error (gettext "must specify a menu name"))) | |
364 (or menu-items (error (gettext "must specify some menu items"))) | |
365 (add-submenu menu-path (cons menu-name menu-items) before)) | |
366 ;; Can't make this obsolete. easymenu depends on it. | |
367 (make-compatible 'add-menu 'add-submenu) | |
368 | |
369 (define-obsolete-function-alias 'popup-menu-up-p 'popup-up-p) | |
370 | |
371 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; minibuffer | |
372 | |
373 (define-compatible-function-alias 'read-minibuffer | |
374 'read-expression) ; misleading name | |
375 (define-compatible-function-alias 'read-input 'read-string) | |
376 (make-obsolete 'read-no-blanks-input 'read-string) ; mocklisp crud | |
377 | |
378 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; misc | |
379 | |
380 ;; (defun user-original-login-name () | |
381 ;; "Return user's login name from original login. | |
382 ;; This tries to remain unaffected by `su', by looking in environment variables." | |
383 ;; (or (getenv "LOGNAME") (getenv "USER") (user-login-name))) | |
384 (define-obsolete-function-alias 'user-original-login-name 'user-login-name) | |
385 | |
386 ; old names | |
387 (define-obsolete-function-alias 'wholenump 'natnump) | |
388 (define-obsolete-function-alias 'show-buffer 'set-window-buffer) | |
389 (define-obsolete-function-alias 'buffer-flush-undo 'buffer-disable-undo) | |
390 (define-obsolete-function-alias 'eval-current-buffer 'eval-buffer) | |
391 (define-obsolete-function-alias 'byte-code-function-p | |
392 'compiled-function-p) ;FSFmacs | |
393 | |
394 ;;(make-obsolete 'mod '%) ; mod and % are different now | |
395 | |
396 (make-obsolete 'ring-mod 'mod) | |
397 | |
398 (make-obsolete 'current-time-seconds 'current-time) | |
399 ;; too bad there's not a way to check for aref, assq, and nconc | |
400 ;; being called on the values of functions known to return keymaps, | |
401 ;; or known to return vectors of events instead of strings... | |
402 | |
403 (define-obsolete-function-alias 'run-special-hook-with-args | |
404 'run-hook-with-args-until-success) | |
405 | |
406 (make-obsolete-variable 'executing-macro 'executing-kbd-macro) | |
407 | |
408 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; modeline | |
409 | |
410 (define-compatible-function-alias 'redraw-mode-line 'redraw-modeline) | |
411 (define-compatible-function-alias 'force-mode-line-update | |
412 'redraw-modeline) ;; FSF compatibility | |
413 (define-compatible-variable-alias 'mode-line-map 'modeline-map) | |
414 (define-compatible-variable-alias 'mode-line-buffer-identification | |
415 'modeline-buffer-identification) | |
416 (define-compatible-variable-alias 'mode-line-process 'modeline-process) | |
417 (define-compatible-variable-alias 'mode-line-modified 'modeline-modified) | |
418 (make-compatible-variable 'mode-line-inverse-video | |
419 "use set-face-highlight-p and set-face-reverse-p") | |
420 (define-compatible-variable-alias 'default-mode-line-format | |
421 'default-modeline-format) | |
422 (define-compatible-variable-alias 'mode-line-format 'modeline-format) | |
423 (define-compatible-variable-alias 'mode-line-menu 'modeline-menu) | |
424 | |
425 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; mouse | |
426 | |
427 ;;; (defun mouse-eval-last-sexpr (event) | |
428 ;;; (interactive "@e") | |
429 ;;; (save-excursion | |
430 ;;; (mouse-set-point event) | |
431 ;;; (eval-last-sexp nil))) | |
432 | |
433 (define-obsolete-function-alias 'mouse-eval-last-sexpr 'mouse-eval-sexp) | |
434 | |
435 (defun read-mouse-position (frame) | |
436 (cdr (mouse-position (frame-device frame)))) | |
437 (make-obsolete 'read-mouse-position 'mouse-position) | |
438 | |
439 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; `point' | |
440 | |
441 (define-obsolete-function-alias 'dot 'point) | |
442 (define-obsolete-function-alias 'dot-marker 'point-marker) | |
443 (define-obsolete-function-alias 'dot-min 'point-min) | |
444 (define-obsolete-function-alias 'dot-max 'point-max) | |
445 (define-obsolete-function-alias 'window-dot 'window-point) | |
446 (define-obsolete-function-alias 'set-window-dot 'set-window-point) | |
447 | |
448 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; processes | |
449 | |
450 (define-obsolete-function-alias 'send-string 'process-send-string) | |
451 (define-obsolete-function-alias 'send-region 'process-send-region) | |
452 | |
453 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; redisplay | |
454 | |
455 (defun redraw-display (&optional device) | |
456 (if (eq device t) | |
457 (mapcar 'redisplay-device (device-list)) | |
458 (redisplay-device device))) | |
459 | |
460 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; stuff replaced by specifiers | |
461 | |
462 (defun screen-scrollbar-width (&optional screen) | |
463 ;; specifier-specs is the inverse of set-specifier, but | |
464 ;; the way this function was defined, specifier-instance | |
465 ;; is closer. | |
466 (specifier-instance scrollbar-width (or screen (selected-frame)))) | |
467 (make-obsolete 'screen-scrollbar-width | |
468 "use (specifier-instance scrollbar-width ...).") | |
469 | |
470 (defun set-screen-scrollbar-width (screen value) | |
471 (set-specifier scrollbar-width (cons screen value))) | |
472 (make-obsolete 'set-screen-scrollbar-width | |
473 "use (set-specifier scrollbar-width ...).") | |
474 | |
475 (defun set-screen-left-margin-width (value &optional screen) | |
476 (set-specifier left-margin-width | |
477 (cons (or screen (selected-frame)) value))) | |
478 (make-obsolete 'set-screen-left-margin-width | |
479 "use (set-specifier left-margin-width ...).") | |
480 | |
481 (defun set-screen-right-margin-width (value &optional screen) | |
482 (set-specifier right-margin-width | |
483 (cons (or screen (selected-frame)) value))) | |
484 (make-obsolete 'set-screen-right-margin-width | |
485 "use (set-specifier right-margin-width ...).") | |
486 | |
487 (defun set-buffer-left-margin-width (value &optional buffer) | |
488 (set-specifier left-margin-width (cons (or buffer (current-buffer)) value))) | |
489 (make-obsolete 'set-buffer-left-margin-width | |
490 "use (set-specifier left-margin-width ...).") | |
491 | |
492 (defun set-buffer-right-margin-width (value &optional buffer) | |
493 (set-specifier right-margin-width (cons (or buffer (current-buffer)) value))) | |
494 (make-obsolete 'set-buffer-right-margin-width | |
495 "use (set-specifier right-margin-width ...).") | |
496 | |
497 (defun screen-left-margin-width (&optional screen) | |
498 (specifier-specs left-margin-width (or screen (selected-frame)))) | |
499 (make-obsolete 'screen-left-margin-width | |
500 "use (specifier-specs left-margin-width ...).") | |
501 | |
502 (defun screen-right-margin-width (&optional screen) | |
503 (specifier-specs right-margin-width (or screen (selected-frame)))) | |
504 (make-obsolete 'screen-right-margin-width | |
505 "use (specifier-specs right-margin-width ...).") | |
506 | |
507 (defun buffer-left-margin-width (&optional buffer) | |
508 (specifier-specs left-margin-width (or buffer (current-buffer)))) | |
509 (make-obsolete 'buffer-left-margin-width | |
510 "use (specifier-specs left-margin-width ...).") | |
511 | |
512 (defun buffer-right-margin-width (&optional buffer) | |
513 (specifier-specs right-margin-width (or buffer (current-buffer)))) | |
514 (make-obsolete 'buffer-right-margin-width | |
515 "use (specifier-specs right-margin-width ...).") | |
516 | |
517 (defun x-set-frame-icon-pixmap (frame image-instance &optional mask-ignored) | |
518 "Set the icon of the given frame to the given image instance, | |
519 which should be an image instance object (as returned by | |
520 `make-image-instance'), a glyph object (as returned by `make-glyph'), | |
521 or nil. If a glyph object is given, the glyph will be instantiated on | |
522 the frame to produce an image instance object. | |
523 | |
524 If the given image instance has a mask, that will be used as the icon mask; | |
525 however, not all window managers support this. | |
526 | |
527 The window manager is also not required to support color pixmaps, | |
528 only bitmaps (one plane deep). | |
529 | |
530 Optional third argument is ignored. If you're concerned about this | |
531 incomplete backwards incompatibility, you should convert your code | |
532 to use `frame-icon-glyph' -- you can specify a mask for an XBM file | |
533 using the standard image instantiator format." | |
534 (if (glyphp image-instance) | |
535 (setq image-instance (glyph-image-instance image-instance frame))) | |
536 (set-glyph-image frame-icon-glyph image-instance frame)) | |
537 (make-obsolete 'x-set-frame-icon-pixmap | |
538 "use (set-glyph-image frame-icon-glyph ...).") | |
539 (defalias 'x-set-screen-icon-pixmap 'x-set-frame-icon-pixmap) | |
540 (make-obsolete 'x-set-screen-icon-pixmap | |
541 "use (set-glyph-image frame-icon-glyph ...).") | |
542 | |
543 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; window-system objects | |
544 | |
545 (define-obsolete-function-alias 'pixel-name 'color-name) | |
546 | |
547 ;; compatibility function -- a front-end to make-glyph | |
548 (defun make-pixmap (name &optional locale) | |
549 "Create a glyph with NAME as an image specifier and locale LOCALE. | |
550 The file should be in `XBM' or `XPM' format. | |
551 If the XBMLANGPATH environment variable is set, it will be searched for | |
552 matching files. Next, the directories listed in the `x-bitmap-file-path' | |
553 variable will be searched (this variable is initialized from the | |
554 \"*bitmapFilePath\" resource). Finally, the XEmacs etc/ directory | |
555 (the value of `data-directory') will be searched. | |
556 The file argument may also be a list of the form (width height data) where | |
557 width and height are the size in pixels, and data is a string, containing | |
558 the raw bits of the bitmap. (Bitmaps specified this way can only be one bit | |
559 deep.) | |
560 If compiled with support for XPM, the file argument may also be a string | |
561 which is the contents of an XPM file (that is, a string beginning with the | |
562 characters \"/* XPM */\"; see the XPM documentation). | |
563 The optional second argument is the specifier locale for this pixmap glyph. | |
564 The returned object is a glyph object. To get the actual pixmap object for | |
565 a given frame, use the function `glyph-instance'." | |
566 (if (consp name) | |
567 (setq name (vector 'xbm :data name))) | |
568 (make-glyph name)) | |
569 (make-obsolete 'make-pixmap 'make-glyph) | |
570 | |
571 (defun make-cursor (name &optional fg bg device) | |
572 "Creates a pointer image instance with NAME as an image specifier. | |
573 The optional second and third arguments are the foreground and background | |
574 colors. They may be color name strings or `pixel' objects. | |
575 The optional fourth argument is the device on which to allocate the cursor | |
576 (defaults to the selected device). | |
577 This allocates a new pointer in the X server, and signals an error if the | |
578 pointer is unknown or cannot be allocated. | |
579 | |
580 A pointer name can take many different forms. It can be: | |
581 - any of the standard cursor names from appendix B of the Xlib manual | |
582 (also known as the file <X11/cursorfont.h>) minus the XC_ prefix; | |
583 - the name of a font, and glyph index into it of the form | |
584 \"FONT fontname index [[mask-font] mask-index]\"; | |
585 - the name of a bitmap or pixmap file; | |
586 - or an image instance object, as returned by `make-image-instance'. | |
587 | |
588 If it is an image instance or pixmap file, and that pixmap comes with a | |
589 mask, then that mask will be used. If it is an image instance, it must | |
590 have only one plane, since X pointers may only have two colors. If it is a | |
591 pixmap file, then the file will be read in monochrome. | |
592 | |
593 If it is a bitmap file, and if a bitmap file whose name is the name of the | |
594 pointer with \"msk\" or \"Mask\" appended exists, then that second bitmap | |
595 will be used as the mask. For example, a pair of files might be named | |
596 \"pointer.xbm\" and \"pointer.xbmmsk\". | |
597 | |
598 The returned object is a normal, first-class lisp object. The way you | |
599 `deallocate' the pointer is the way you deallocate any other lisp object: | |
600 you drop all pointers to it and allow it to be garbage collected. When | |
601 these objects are GCed, the underlying X data is deallocated as well." | |
602 ;; #### ignores fg and bg | |
603 (make-image-instance name device '(pointer))) | |
604 (make-obsolete 'make-cursor 'make-image-instance) | |
605 | |
606 (define-obsolete-function-alias 'pixmap-width 'glyph-width) | |
607 (define-obsolete-function-alias 'pixmap-contributes-to-line-height-p | |
608 'glyph-contrib-p-instance) | |
609 (define-obsolete-function-alias 'set-pixmap-contributes-to-line-height | |
610 'set-glyph-contrib-p) | |
611 | |
612 ;; the functionality of column.el has been moved into C | |
613 (defalias 'display-column-mode 'column-number-mode) | |
614 | |
615 (defun x-color-values (color &optional frame) | |
616 "Return a description of the color named COLOR on frame FRAME. | |
617 The value is a list of integer RGB values--(RED GREEN BLUE). | |
618 These values appear to range from 0 to 65280 or 65535, depending | |
619 on the system; white is (65280 65280 65280) or (65535 65535 65535). | |
620 If FRAME is omitted or nil, use the selected frame." | |
621 (color-instance-rgb-components (make-color-instance color))) | |
622 (make-compatible 'x-color-values 'color-instance-rgb-components) | |
623 | |
624 ;; Two loser functions which shouldn't be used. | |
625 (make-obsolete 'following-char 'char-after) | |
626 (make-obsolete 'preceding-char 'char-before) | |
627 | |
628 | |
629 ;; The following several functions are useful in GNU Emacs 20 because | |
630 ;; of the multibyte "characters" the internal representation of which | |
631 ;; leaks into Lisp. In XEmacs/Mule they are trivial and unnecessary. | |
632 ;; We provide them for compatibility reasons solely. | |
633 | |
634 (defun string-to-sequence (string type) | |
635 "Convert STRING to a sequence of TYPE which contains characters in STRING. | |
636 TYPE should be `list' or `vector'. | |
637 Multibyte characters are concerned." | |
638 (ecase type | |
639 (list | |
640 (mapcar #'identity string)) | |
641 (vector | |
642 (mapvector #'identity string)))) | |
643 | |
644 (defun string-to-list (string) | |
645 "Return a list of characters in STRING." | |
646 (mapcar #'identity string)) | |
647 | |
648 (defun string-to-vector (string) | |
649 "Return a vector of characters in STRING." | |
650 (mapvector #'identity string)) | |
651 | |
652 (defun store-substring (string idx obj) | |
653 "Embed OBJ (string or character) at index IDX of STRING." | |
654 (let* ((str (cond ((stringp obj) obj) | |
655 ((characterp obj) (char-to-string obj)) | |
656 (t (error | |
657 "Invalid argument (should be string or character): %s" | |
658 obj)))) | |
659 (string-len (length string)) | |
660 (len (length str)) | |
661 (i 0)) | |
662 (while (and (< i len) (< idx string-len)) | |
663 (aset string idx (aref str i)) | |
664 (setq idx (1+ idx) i (1+ i))) | |
665 string)) | |
666 | |
667 ;; ### This function is not compatible with FSF in some cases. Hard | |
668 ;; to fix, because it is hard to trace the logic of the FSF function. | |
669 ;; In case we need the exact behaviour, we can always copy the FSF | |
670 ;; version, which is very long and does lots of unnecessary stuff. | |
671 (defun truncate-string-to-width (str end-column &optional start-column padding) | |
672 "Truncate string STR to end at column END-COLUMN. | |
673 The optional 2nd arg START-COLUMN, if non-nil, specifies | |
674 the starting column; that means to return the characters occupying | |
675 columns START-COLUMN ... END-COLUMN of STR. | |
676 | |
677 The optional 3rd arg PADDING, if non-nil, specifies a padding character | |
678 to add at the end of the result if STR doesn't reach column END-COLUMN, | |
679 or if END-COLUMN comes in the middle of a character in STR. | |
680 PADDING is also added at the beginning of the result | |
681 if column START-COLUMN appears in the middle of a character in STR. | |
682 | |
683 If PADDING is nil, no padding is added in these cases, so | |
684 the resulting string may be narrower than END-COLUMN." | |
685 (or start-column | |
686 (setq start-column 0)) | |
687 (let ((len (length str))) | |
688 (concat (substring str (min start-column len) (min end-column len)) | |
689 (and padding (> end-column len) | |
690 (make-string (- end-column len) padding))))) | |
691 | |
692 (defalias 'truncate-string 'truncate-string-to-width) | |
693 (make-obsolete 'truncate-string 'truncate-string-to-width) | |
694 | |
695 ;; Keywords already do The Right Thing in XEmacs | |
696 (make-compatible 'define-widget-keywords "Just use them") | |
697 | |
698 (make-obsolete 'function-called-at-point 'function-at-point) | |
699 | |
700 ;;; obsolete.el ends here |