209
|
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
|
272
|
23 ;; along with XEmacs; see the file COPYING. If not, write to the
|
209
|
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
|
272
|
57 setting NEWVAR and marks OLDVAR as obsolete.
|
209
|
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
|
|
78 (defun x-display-color-p (&optional device)
|
272
|
79 "Return t if DEVICE is a color device."
|
209
|
80 (eq 'color (device-class device)))
|
|
81 (make-compatible 'x-display-color-p 'device-class)
|
|
82
|
|
83 (define-function 'x-color-display-p 'x-display-color-p)
|
|
84 (make-compatible 'x-display-color-p 'device-class)
|
|
85
|
|
86 (defun x-display-grayscale-p (&optional device)
|
272
|
87 "Return t if DEVICE is a grayscale device."
|
209
|
88 (eq 'grayscale (device-class device)))
|
|
89 (make-compatible 'x-display-grayscale-p 'device-class)
|
|
90
|
|
91 (define-function 'x-grayscale-display-p 'x-display-grayscale-p)
|
|
92 (make-compatible 'x-display-grayscale-p 'device-class)
|
|
93
|
284
|
94 (define-compatible-function-alias 'x-display-pixel-width 'device-pixel-width)
|
|
95 (define-compatible-function-alias 'x-display-pixel-height 'device-pixel-height)
|
|
96 (define-compatible-function-alias 'x-display-planes 'device-bitplanes)
|
|
97 (define-compatible-function-alias 'x-display-color-cells 'device-color-cells)
|
209
|
98
|
|
99 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; events
|
|
100
|
|
101 (define-obsolete-function-alias 'menu-event-p 'misc-user-event-p)
|
|
102 (make-obsolete-variable 'unread-command-char 'unread-command-events)
|
|
103
|
|
104 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; extents
|
|
105
|
|
106 (make-obsolete 'set-window-dot 'set-window-point)
|
|
107
|
|
108 (define-obsolete-function-alias 'extent-buffer 'extent-object)
|
|
109
|
|
110 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; frames
|
|
111 (defun frame-first-window (frame)
|
272
|
112 "Return the topmost, leftmost window of FRAME.
|
209
|
113 If omitted, FRAME defaults to the currently selected frame."
|
|
114 (frame-highest-window frame 0))
|
|
115 (make-compatible 'frame-first-window 'frame-highest-window)
|
|
116
|
|
117 (define-obsolete-variable-alias 'initial-frame-alist 'initial-frame-plist)
|
|
118 (define-obsolete-variable-alias 'minibuffer-frame-alist
|
|
119 'minibuffer-frame-plist)
|
|
120 (define-obsolete-variable-alias 'pop-up-frame-alist 'pop-up-frame-plist)
|
|
121 (define-obsolete-variable-alias 'special-display-frame-alist
|
|
122 'special-display-frame-plist)
|
|
123
|
|
124 ;; Defined in C.
|
|
125
|
|
126 (define-obsolete-variable-alias 'default-frame-alist 'default-frame-plist)
|
|
127 (define-obsolete-variable-alias 'default-x-frame-alist 'default-x-frame-plist)
|
|
128 (define-obsolete-variable-alias 'default-tty-frame-alist
|
|
129 'default-tty-frame-plist)
|
|
130
|
|
131 (make-compatible 'frame-parameters 'frame-property)
|
|
132 (defun frame-parameters (&optional frame)
|
|
133 "Return the parameters-alist of frame FRAME.
|
|
134 It is a list of elements of the form (PARM . VALUE), where PARM is a symbol.
|
|
135 The meaningful PARMs depend on the kind of frame.
|
|
136 If FRAME is omitted, return information on the currently selected frame.
|
|
137
|
|
138 See the variables `default-frame-plist', `default-x-frame-plist', and
|
|
139 `default-tty-frame-plist' for a description of the parameters meaningful
|
|
140 for particular types of frames."
|
|
141 (or frame (setq frame (selected-frame)))
|
|
142 ;; #### This relies on a `copy-sequence' of the user properties in
|
|
143 ;; `frame-properties'. Removing that would make `frame-properties' more
|
|
144 ;; efficient but this function less efficient, as we couldn't be
|
|
145 ;; destructive. Since most callers now use `frame-parameters', we'll
|
|
146 ;; do it this way. Should probably change this at some point in the
|
|
147 ;; future.
|
|
148 (destructive-plist-to-alist (frame-properties frame)))
|
|
149
|
|
150 (make-compatible 'modify-frame-parameters 'set-frame-properties)
|
|
151 (defun modify-frame-parameters (frame alist)
|
|
152 "Modify the properties of frame FRAME according to ALIST.
|
|
153 ALIST is an alist of properties to change and their new values.
|
|
154 Each element of ALIST has the form (PARM . VALUE), where PARM is a symbol.
|
|
155 The meaningful PARMs depend on the kind of frame.
|
|
156
|
|
157 See `set-frame-properties' for built-in property names."
|
|
158 ;; it would be nice to be destructive here but that's not safe.
|
|
159 (set-frame-properties frame (alist-to-plist alist)))
|
|
160
|
|
161 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; faces
|
|
162
|
|
163 (define-obsolete-function-alias 'list-faces-display 'edit-faces)
|
|
164 (define-obsolete-function-alias 'list-faces 'face-list)
|
|
165
|
274
|
166 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; paths
|
|
167
|
|
168 (defvar Info-default-directory-list nil
|
|
169 "This used to be the initial value of Info-directory-list.
|
|
170 If you want to change the locations where XEmacs looks for info files,
|
|
171 set Info-directory-list.")
|
|
172 (make-obsolete-variable 'Info-default-directory-list 'Info-directory-list)
|
|
173
|
209
|
174 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; hooks
|
|
175
|
371
|
176 (make-compatible-variable 'lisp-indent-hook 'lisp-indent-function)
|
|
177 (make-compatible-variable 'comment-indent-hook 'comment-indent-function)
|
209
|
178 (make-obsolete-variable 'temp-buffer-show-hook
|
|
179 'temp-buffer-show-function)
|
|
180 (make-obsolete-variable 'inhibit-local-variables
|
|
181 "use `enable-local-variables' (with the reversed sense).")
|
|
182 (make-obsolete-variable 'suspend-hooks 'suspend-hook)
|
|
183 (make-obsolete-variable 'first-change-function 'first-change-hook)
|
|
184 (make-obsolete-variable 'before-change-function
|
|
185 "use before-change-functions; which is a list of functions rather than a single function.")
|
|
186 (make-obsolete-variable 'after-change-function
|
|
187 "use after-change-functions; which is a list of functions rather than a single function.")
|
|
188
|
|
189 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; insertion and deletion
|
|
190
|
|
191 (define-compatible-function-alias 'insert-and-inherit 'insert)
|
|
192 (define-compatible-function-alias 'insert-before-markers-and-inherit
|
|
193 'insert-before-markers)
|
|
194
|
|
195 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; keymaps
|
|
196
|
|
197 (defun keymap-parent (keymap)
|
272
|
198 "Return the first parent of the given keymap."
|
209
|
199 (car (keymap-parents keymap)))
|
|
200 (make-compatible 'keymap-parent 'keymap-parents)
|
|
201
|
|
202 (defun set-keymap-parent (keymap parent)
|
272
|
203 "Make the given keymap have (only) the given parent."
|
209
|
204 (set-keymap-parents keymap (if parent (list parent) '()))
|
|
205 parent)
|
|
206 (make-compatible 'set-keymap-parent 'set-keymap-parents)
|
|
207
|
|
208 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; menu stuff
|
|
209
|
|
210 (defun add-menu-item (menu-path item-name function enabled-p &optional before)
|
|
211 "Obsolete. See the function `add-menu-button'."
|
|
212 (or item-name (error "must specify an item name"))
|
|
213 (add-menu-button menu-path (vector item-name function enabled-p) before))
|
|
214 (make-obsolete 'add-menu-item 'add-menu-button)
|
|
215
|
|
216 (defun add-menu (menu-path menu-name menu-items &optional before)
|
|
217 "See the function `add-submenu'."
|
|
218 (or menu-name (error (gettext "must specify a menu name")))
|
|
219 (or menu-items (error (gettext "must specify some menu items")))
|
|
220 (add-submenu menu-path (cons menu-name menu-items) before))
|
|
221 ;; Can't make this obsolete. easymenu depends on it.
|
|
222 (make-compatible 'add-menu 'add-submenu)
|
|
223
|
|
224 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; minibuffer
|
|
225
|
|
226 (define-compatible-function-alias 'read-minibuffer
|
|
227 'read-expression) ; misleading name
|
|
228 (define-compatible-function-alias 'read-input 'read-string)
|
|
229
|
|
230 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; misc
|
|
231
|
|
232 ;; (defun user-original-login-name ()
|
|
233 ;; "Return user's login name from original login.
|
|
234 ;; This tries to remain unaffected by `su', by looking in environment variables."
|
|
235 ;; (or (getenv "LOGNAME") (getenv "USER") (user-login-name)))
|
|
236 (define-obsolete-function-alias 'user-original-login-name 'user-login-name)
|
|
237
|
|
238 ; old names
|
|
239 (define-obsolete-function-alias 'show-buffer 'set-window-buffer)
|
|
240 (define-obsolete-function-alias 'buffer-flush-undo 'buffer-disable-undo)
|
371
|
241 (make-compatible 'eval-current-buffer 'eval-buffer)
|
|
242 (define-compatible-function-alias 'byte-code-function-p
|
209
|
243 'compiled-function-p) ;FSFmacs
|
|
244
|
|
245 ;; too bad there's not a way to check for aref, assq, and nconc
|
|
246 ;; being called on the values of functions known to return keymaps,
|
|
247 ;; or known to return vectors of events instead of strings...
|
|
248
|
|
249 (make-obsolete-variable 'executing-macro 'executing-kbd-macro)
|
|
250
|
|
251 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; modeline
|
|
252
|
|
253 (define-compatible-function-alias 'redraw-mode-line 'redraw-modeline)
|
|
254 (define-compatible-function-alias 'force-mode-line-update
|
|
255 'redraw-modeline) ;; FSF compatibility
|
|
256 (define-compatible-variable-alias 'mode-line-map 'modeline-map)
|
|
257 (define-compatible-variable-alias 'mode-line-buffer-identification
|
|
258 'modeline-buffer-identification)
|
|
259 (define-compatible-variable-alias 'mode-line-process 'modeline-process)
|
|
260 (define-compatible-variable-alias 'mode-line-modified 'modeline-modified)
|
|
261 (make-compatible-variable 'mode-line-inverse-video
|
|
262 "use set-face-highlight-p and set-face-reverse-p")
|
|
263 (define-compatible-variable-alias 'default-mode-line-format
|
|
264 'default-modeline-format)
|
|
265 (define-compatible-variable-alias 'mode-line-format 'modeline-format)
|
|
266 (define-compatible-variable-alias 'mode-line-menu 'modeline-menu)
|
|
267
|
|
268 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; mouse
|
|
269
|
|
270 ;;; (defun mouse-eval-last-sexpr (event)
|
|
271 ;;; (interactive "@e")
|
|
272 ;;; (save-excursion
|
|
273 ;;; (mouse-set-point event)
|
|
274 ;;; (eval-last-sexp nil)))
|
|
275
|
|
276 (define-obsolete-function-alias 'mouse-eval-last-sexpr 'mouse-eval-sexp)
|
|
277
|
|
278 (defun read-mouse-position (frame)
|
|
279 (cdr (mouse-position (frame-device frame))))
|
|
280 (make-obsolete 'read-mouse-position 'mouse-position)
|
|
281
|
|
282 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; redisplay
|
|
283
|
|
284 (defun redraw-display (&optional device)
|
|
285 (if (eq device t)
|
|
286 (mapcar 'redisplay-device (device-list))
|
|
287 (redisplay-device device)))
|
|
288
|
|
289 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; window-system objects
|
|
290
|
|
291 ;; the functionality of column.el has been moved into C
|
371
|
292 ;; Function obsoleted for XEmacs 20.0/February 1997.
|
209
|
293 (defalias 'display-column-mode 'column-number-mode)
|
|
294
|
|
295 (defun x-color-values (color &optional frame)
|
|
296 "Return a description of the color named COLOR on frame FRAME.
|
|
297 The value is a list of integer RGB values--(RED GREEN BLUE).
|
|
298 These values appear to range from 0 to 65280 or 65535, depending
|
|
299 on the system; white is (65280 65280 65280) or (65535 65535 65535).
|
|
300 If FRAME is omitted or nil, use the selected frame."
|
|
301 (color-instance-rgb-components (make-color-instance color)))
|
|
302 (make-compatible 'x-color-values 'color-instance-rgb-components)
|
|
303
|
|
304 ;; Two loser functions which shouldn't be used.
|
|
305 (make-obsolete 'following-char 'char-after)
|
|
306 (make-obsolete 'preceding-char 'char-before)
|
|
307
|
|
308
|
|
309 ;; The following several functions are useful in GNU Emacs 20 because
|
|
310 ;; of the multibyte "characters" the internal representation of which
|
|
311 ;; leaks into Lisp. In XEmacs/Mule they are trivial and unnecessary.
|
|
312 ;; We provide them for compatibility reasons solely.
|
|
313
|
|
314 (defun string-to-sequence (string type)
|
|
315 "Convert STRING to a sequence of TYPE which contains characters in STRING.
|
|
316 TYPE should be `list' or `vector'.
|
|
317 Multibyte characters are concerned."
|
|
318 (ecase type
|
|
319 (list
|
|
320 (mapcar #'identity string))
|
|
321 (vector
|
|
322 (mapvector #'identity string))))
|
|
323
|
|
324 (defun string-to-list (string)
|
|
325 "Return a list of characters in STRING."
|
|
326 (mapcar #'identity string))
|
|
327
|
|
328 (defun string-to-vector (string)
|
|
329 "Return a vector of characters in STRING."
|
|
330 (mapvector #'identity string))
|
|
331
|
|
332 (defun store-substring (string idx obj)
|
|
333 "Embed OBJ (string or character) at index IDX of STRING."
|
|
334 (let* ((str (cond ((stringp obj) obj)
|
|
335 ((characterp obj) (char-to-string obj))
|
|
336 (t (error
|
|
337 "Invalid argument (should be string or character): %s"
|
|
338 obj))))
|
|
339 (string-len (length string))
|
|
340 (len (length str))
|
|
341 (i 0))
|
|
342 (while (and (< i len) (< idx string-len))
|
|
343 (aset string idx (aref str i))
|
|
344 (setq idx (1+ idx) i (1+ i)))
|
|
345 string))
|
|
346
|
|
347 ;; ### This function is not compatible with FSF in some cases. Hard
|
|
348 ;; to fix, because it is hard to trace the logic of the FSF function.
|
371
|
349 ;; In case we need the exact behaviour, we can always copy the FSF
|
209
|
350 ;; version, which is very long and does lots of unnecessary stuff.
|
|
351 (defun truncate-string-to-width (str end-column &optional start-column padding)
|
|
352 "Truncate string STR to end at column END-COLUMN.
|
|
353 The optional 2nd arg START-COLUMN, if non-nil, specifies
|
|
354 the starting column; that means to return the characters occupying
|
|
355 columns START-COLUMN ... END-COLUMN of STR.
|
|
356
|
|
357 The optional 3rd arg PADDING, if non-nil, specifies a padding character
|
|
358 to add at the end of the result if STR doesn't reach column END-COLUMN,
|
|
359 or if END-COLUMN comes in the middle of a character in STR.
|
|
360 PADDING is also added at the beginning of the result
|
|
361 if column START-COLUMN appears in the middle of a character in STR.
|
|
362
|
|
363 If PADDING is nil, no padding is added in these cases, so
|
|
364 the resulting string may be narrower than END-COLUMN."
|
|
365 (or start-column
|
|
366 (setq start-column 0))
|
|
367 (let ((len (length str)))
|
|
368 (concat (substring str (min start-column len) (min end-column len))
|
|
369 (and padding (> end-column len)
|
|
370 (make-string (- end-column len) padding)))))
|
|
371
|
|
372 (defalias 'truncate-string 'truncate-string-to-width)
|
|
373 (make-obsolete 'truncate-string 'truncate-string-to-width)
|
|
374
|
|
375 ;; Keywords already do The Right Thing in XEmacs
|
|
376 (make-compatible 'define-widget-keywords "Just use them")
|
|
377
|
|
378 (make-obsolete 'function-called-at-point 'function-at-point)
|
|
379
|
|
380 ;;; obsolete.el ends here
|