comparison lisp/obsolete.el @ 5175:dc94bf0afa37

rearrange stuff in obsolete.el -------------------- ChangeLog entries follow: -------------------- lisp/ChangeLog addition: 2010-02-22 Ben Wing <ben@xemacs.org> * obsolete.el: * obsolete.el ('show-buffer): New. * obsolete.el ('buffer-flush-undo): New. * obsolete.el (buffer-local-value): New. * obsolete.el (Info-default-directory-list): Removed. * obsolete.el (x-color-values): New. * obsolete.el (mswindows-color-list): * obsolete.el (init-file-user): Removed. * obsolete.el ('pui-add-install-directory): Removed. * obsolete.el (line-beginning-position): * obsolete.el ('line-beginning-position): New. * obsolete.el ('line-end-position): New. * obsolete.el (obsolete-throw): New. * obsolete.el ('cl-mapc): New. * obsolete.el ('byte-code-function-p): New. * obsolete.el ('interactive-form): New. * obsolete.el ('assq-delete-all): New. * obsolete.el (makehash): New. * obsolete.el ('user-original-login-name): Removed. * obsolete.el ('isearch-yank-x-selection): Removed. * obsolete.el ('isearch-yank-x-clipboard): Removed. * obsolete.el ('display-column-mode): New. Rearrange; create some new categories out of "misc" stuff, put categories in alphabetical order, move remaning "misc" stuff to bottom.
author Ben Wing <ben@xemacs.org>
date Mon, 22 Feb 2010 06:43:21 -0600
parents c17c857e20bf
children 9fa29ec759e3
comparison
equal deleted inserted replaced
5054:24372c7e0e8f 5175:dc94bf0afa37
1 ;;; obsolete.el --- obsoleteness support 1 ;;; obsolete.el --- obsoleteness support
2 2
3 ;; Copyright (C) 1985-1994, 1997 Free Software Foundation, Inc. 3 ;; Copyright (C) 1985-1994, 1997 Free Software Foundation, Inc.
4 ;; Copyright (C) 1994, 1995 Amdahl Corporation. 4 ;; Copyright (C) 1994, 1995 Amdahl Corporation.
5 ;; Copyright (C) 1995 Sun Microsystems. 5 ;; Copyright (C) 1995 Sun Microsystems.
6 ;; Copyright (C) 2002, 2004 Ben Wing. 6 ;; Copyright (C) 2002, 2004, 2010 Ben Wing.
7 7
8 ;; Maintainer: XEmacs Development Team 8 ;; Maintainer: XEmacs Development Team
9 ;; Keywords: internal, dumped 9 ;; Keywords: internal, dumped
10 10
11 ;; This file is part of XEmacs. 11 ;; This file is part of XEmacs.
70 This makes referencing or setting OLDVAR equivalent to referencing or 70 This makes referencing or setting OLDVAR equivalent to referencing or
71 setting NEWVAR and marks OLDVAR as provided for compatibility only." 71 setting NEWVAR and marks OLDVAR as provided for compatibility only."
72 (defvaralias oldvar newvar) 72 (defvaralias oldvar newvar)
73 (make-compatible-variable oldvar newvar)) 73 (make-compatible-variable oldvar newvar))
74 74
75 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; buffers
76
77 (define-obsolete-function-alias 'show-buffer 'set-window-buffer)
78 (define-obsolete-function-alias 'buffer-flush-undo 'buffer-disable-undo)
79 (make-compatible 'eval-current-buffer 'eval-buffer)
80
81 (defun buffer-local-value (variable buffer)
82 "Return the value of VARIABLE in BUFFER.
83 If VARIABLE does not have a buffer-local binding in BUFFER, the value
84 is the default binding of variable."
85 (symbol-value-in-buffer variable buffer))
86 (make-compatible 'buffer-local-value 'symbol-value-in-buffer)
87
75 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; device stuff 88 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; device stuff
76 89
77 (make-compatible-variable 'window-system "use (console-type)") 90 (make-compatible-variable 'window-system "use (console-type)")
78 91
79 (defun x-display-color-p (&optional device) 92 (defun x-display-color-p (&optional device)
109 (define-obsolete-function-alias 'extent-buffer 'extent-object) 122 (define-obsolete-function-alias 'extent-buffer 'extent-object)
110 (define-compatible-variable-alias 'parse-sexp-lookup-properties 123 (define-compatible-variable-alias 'parse-sexp-lookup-properties
111 'lookup-syntax-properties) 124 'lookup-syntax-properties)
112 125
113 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; frames 126 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; frames
127
114 (defun frame-first-window (frame) 128 (defun frame-first-window (frame)
115 "Return the topmost, leftmost window of FRAME. 129 "Return the topmost, leftmost window of FRAME.
116 If omitted, FRAME defaults to the currently selected frame." 130 If omitted, FRAME defaults to the currently selected frame."
117 (frame-highest-window frame 0)) 131 (frame-highest-window frame 0))
118 (make-compatible 'frame-first-window 'frame-highest-window) 132 (make-compatible 'frame-first-window 'frame-highest-window)
170 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; faces 184 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; faces
171 185
172 (define-obsolete-function-alias 'list-faces-display 'edit-faces) 186 (define-obsolete-function-alias 'list-faces-display 'edit-faces)
173 (define-obsolete-function-alias 'list-faces 'face-list) 187 (define-obsolete-function-alias 'list-faces 'face-list)
174 188
175 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; paths 189 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; fonts and colors
176 190
177 (defvar Info-default-directory-list nil 191 (defun x-color-values (color &optional frame)
178 "This used to be the initial value of Info-directory-list. 192 "Return a description of the color named COLOR on frame FRAME.
179 If you want to change the locations where XEmacs looks for info files, 193 The value is a list of integer RGB values--(RED GREEN BLUE).
180 set Info-directory-list.") 194 These values appear to range from 0 to 65280 or 65535, depending
181 (make-obsolete-variable 'Info-default-directory-list 'Info-directory-list) 195 on the system; white is (65280 65280 65280) or (65535 65535 65535).
182 196 If FRAME is omitted or nil, use the selected frame."
183 (defvar init-file-user nil 197 (color-instance-rgb-components (make-color-instance color)))
184 "This used to be the name of the user whose init file was read at startup.") 198 (make-compatible 'x-color-values 'color-instance-rgb-components)
185 (make-obsolete-variable 'init-file-user 'load-user-init-file-p) 199
186 200 (make-obsolete 'mswindows-color-list 'color-list)
187 (define-obsolete-function-alias 'pui-add-install-directory 201 (make-obsolete 'tty-color-list 'color-list)
188 'pui-set-local-package-get-directory) ; misleading name 202 (make-compatible 'list-fonts 'font-list)
203
189 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; hooks 204 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; hooks
190 205
191 (make-compatible-variable 'lisp-indent-hook 'lisp-indent-function) 206 (make-compatible-variable 'lisp-indent-hook 'lisp-indent-function)
192 (make-compatible-variable 'comment-indent-hook 'comment-indent-function) 207 (make-compatible-variable 'comment-indent-hook 'comment-indent-function)
193 (make-obsolete-variable 'temp-buffer-show-hook 208 (make-obsolete-variable 'temp-buffer-show-hook
199 (make-obsolete-variable 'before-change-function 214 (make-obsolete-variable 'before-change-function
200 "use before-change-functions; which is a list of functions rather than a single function.") 215 "use before-change-functions; which is a list of functions rather than a single function.")
201 (make-obsolete-variable 'after-change-function 216 (make-obsolete-variable 'after-change-function
202 "use after-change-functions; which is a list of functions rather than a single function.") 217 "use after-change-functions; which is a list of functions rather than a single function.")
203 218
204 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; insertion and deletion 219 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; insertion, deletion, movement
205 220
206 (define-compatible-function-alias 'insert-and-inherit 'insert) 221 (define-compatible-function-alias 'insert-and-inherit 'insert)
207 (define-compatible-function-alias 'insert-before-markers-and-inherit 222 (define-compatible-function-alias 'insert-before-markers-and-inherit
208 'insert-before-markers) 223 'insert-before-markers)
209 224
210 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; keymaps 225 (define-compatible-function-alias 'line-beginning-position 'point-at-bol)
226 (define-compatible-function-alias 'line-end-position 'point-at-eol)
227
228 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; Lisp engine, basic Lisp stuff
229
230 (make-obsolete 'function-called-at-point 'function-at-point)
231
232 ;; As of 21.5, #'throw is a special operator. This makes bytecode using it
233 ;; compiled for 21.4 fail; making this function available works around that.
234 (defun obsolete-throw (tag value)
235 "Ugly compatibility hack.
236
237 See the implementation of #'funcall in eval.c. This should be removed once
238 we no longer encounter bytecode from 21.4."
239 (throw tag value))
240
241 (make-obsolete
242 'obsolete-throw
243 "it says `obsolete' in the name, you know you shouldn't be using this.")
244
245 (define-compatible-function-alias 'cl-mapc 'mapc)
246
247 ; old names
248 (define-compatible-function-alias 'byte-code-function-p
249 'compiled-function-p) ;FSFmacs
250
251 (define-compatible-function-alias 'interactive-form
252 'function-interactive) ;GNU 21.1
253 (define-compatible-function-alias 'assq-delete-all
254 'remassq) ;GNU 21.1
255
256 (defun makehash (&optional test)
257 "Create a new hash table.
258 Optional first argument TEST specifies how to compare keys in the table.
259 Predefined tests are `eq', `eql', and `equal'. Default is `eql'."
260 (make-hash-table :test test))
261 (make-compatible 'makehash 'make-hash-table)
262
263 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; keys, keymaps
211 264
212 (defun keymap-parent (keymap) 265 (defun keymap-parent (keymap)
213 "Return the first parent of the given keymap." 266 "Return the first parent of the given keymap."
214 (car (keymap-parents keymap))) 267 (car (keymap-parents keymap)))
215 (make-compatible 'keymap-parent 'keymap-parents) 268 (make-compatible 'keymap-parent 'keymap-parents)
217 (defun set-keymap-parent (keymap parent) 270 (defun set-keymap-parent (keymap parent)
218 "Make the given keymap have (only) the given parent." 271 "Make the given keymap have (only) the given parent."
219 (set-keymap-parents keymap (if parent (list parent) '())) 272 (set-keymap-parents keymap (if parent (list parent) '()))
220 parent) 273 parent)
221 (make-compatible 'set-keymap-parent 'set-keymap-parents) 274 (make-compatible 'set-keymap-parent 'set-keymap-parents)
275
276 ;; too bad there's not a way to check for aref, assq, and nconc
277 ;; being called on the values of functions known to return keymaps,
278 ;; or known to return vectors of events instead of strings...
279
280 ;;; Yes there is; make compiler macros for aref, assq, nconc, checking that
281 ;;; the car of the relevant argument is sane.
282
283 (make-obsolete-variable 'executing-macro 'executing-kbd-macro)
222 284
223 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; menu stuff 285 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; menu stuff
224 286
225 (defun add-menu-item (menu-path item-name function enabled-p &optional before) 287 (defun add-menu-item (menu-path item-name function enabled-p &optional before)
226 "Obsolete. See the function `add-menu-button'." 288 "Obsolete. See the function `add-menu-button'."
248 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; minibuffer 310 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; minibuffer
249 311
250 (define-compatible-function-alias 'read-minibuffer 312 (define-compatible-function-alias 'read-minibuffer
251 'read-expression) ; misleading name 313 'read-expression) ; misleading name
252 (define-compatible-function-alias 'read-input 'read-string) 314 (define-compatible-function-alias 'read-input 'read-string)
253
254 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; misc
255
256 ;; (defun user-original-login-name ()
257 ;; "Return user's login name from original login.
258 ;; This tries to remain unaffected by `su', by looking in environment variables."
259 ;; (or (getenv "LOGNAME") (getenv "USER") (user-login-name)))
260 (define-obsolete-function-alias 'user-original-login-name 'user-login-name)
261
262 ; old names
263 (define-obsolete-function-alias 'show-buffer 'set-window-buffer)
264 (define-obsolete-function-alias 'buffer-flush-undo 'buffer-disable-undo)
265 (make-compatible 'eval-current-buffer 'eval-buffer)
266 (define-compatible-function-alias 'byte-code-function-p
267 'compiled-function-p) ;FSFmacs
268
269 (define-obsolete-function-alias 'isearch-yank-x-selection
270 'isearch-yank-selection)
271 (define-obsolete-function-alias 'isearch-yank-x-clipboard
272 'isearch-yank-clipboard)
273
274 ;; too bad there's not a way to check for aref, assq, and nconc
275 ;; being called on the values of functions known to return keymaps,
276 ;; or known to return vectors of events instead of strings...
277
278 ;;; Yes there is; make compiler macros for aref, assq, nconc, checking that
279 ;;; the car of the relevant argument is sane.
280
281 (make-obsolete-variable 'executing-macro 'executing-kbd-macro)
282
283 (define-compatible-function-alias 'interactive-form
284 'function-interactive) ;GNU 21.1
285 (define-compatible-function-alias 'assq-delete-all
286 'remassq) ;GNU 21.1
287
288 (defun makehash (&optional test)
289 "Create a new hash table.
290 Optional first argument TEST specifies how to compare keys in the table.
291 Predefined tests are `eq', `eql', and `equal'. Default is `eql'."
292 (make-hash-table :test test))
293 (make-compatible 'makehash 'make-hash-table)
294
295 (defun buffer-local-value (variable buffer)
296 "Return the value of VARIABLE in BUFFER.
297 If VARIABLE does not have a buffer-local binding in BUFFER, the value
298 is the default binding of variable."
299 (symbol-value-in-buffer variable buffer))
300 (make-compatible 'buffer-local-value 'symbol-value-in-buffer)
301
302 (define-compatible-function-alias 'line-beginning-position 'point-at-bol)
303 (define-compatible-function-alias 'line-end-position 'point-at-eol)
304 315
305 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; modeline 316 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; modeline
306 317
307 (define-compatible-function-alias 'redraw-mode-line 'redraw-modeline) 318 (define-compatible-function-alias 'redraw-mode-line 'redraw-modeline)
308 (define-compatible-function-alias 'force-mode-line-update 319 (define-compatible-function-alias 'force-mode-line-update
331 342
332 (defun read-mouse-position (frame) 343 (defun read-mouse-position (frame)
333 (cdr (mouse-position (frame-device frame)))) 344 (cdr (mouse-position (frame-device frame))))
334 (make-obsolete 'read-mouse-position 'mouse-position) 345 (make-obsolete 'read-mouse-position 'mouse-position)
335 346
347 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; paths
348
349 (defvar Info-default-directory-list nil
350 "This used to be the initial value of Info-directory-list.
351 If you want to change the locations where XEmacs looks for info files,
352 set Info-directory-list.")
353 (make-obsolete-variable 'Info-default-directory-list 'Info-directory-list)
354
355 (defvar init-file-user nil
356 "This used to be the name of the user whose init file was read at startup.")
357 (make-obsolete-variable 'init-file-user 'load-user-init-file-p)
358
359 (define-obsolete-function-alias 'pui-add-install-directory
360 'pui-set-local-package-get-directory) ; misleading name
361
336 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; redisplay 362 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; redisplay
337 363
338 (defun redraw-display (&optional device) 364 (defun redraw-display (&optional device)
339 (if (eq device t) 365 (if (eq device t)
340 (mapcar 'redisplay-device (device-list)) 366 (mapcar 'redisplay-device (device-list))
341 (redisplay-device device))) 367 (redisplay-device device)))
342 368
343 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; strings 369 ;; the functionality of column.el has been moved into C
370 ;; Function obsoleted for XEmacs 20.0/February 1997.
371 (defalias 'display-column-mode 'column-number-mode)
372
373 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; selections
374
375 (define-obsolete-function-alias 'isearch-yank-x-selection
376 'isearch-yank-selection)
377 (define-obsolete-function-alias 'isearch-yank-x-clipboard
378 'isearch-yank-clipboard)
379
380 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; text and strings
344 381
345 (define-obsolete-function-alias 'sref 'aref) 382 (define-obsolete-function-alias 'sref 'aref)
346 383
347 (defun char-bytes (character) 384 (defun char-bytes (character)
348 "Return number of bytes a CHARACTER occupies in a string or buffer. 385 "Return number of bytes a CHARACTER occupies in a string or buffer.
368 "use (delq 'ascii (charsets-in-region START END)) instead.") 405 "use (delq 'ascii (charsets-in-region START END)) instead.")
369 406
370 ;; < 21.5 compatibility, eg. https://bugzilla.redhat.com/201524#c2 407 ;; < 21.5 compatibility, eg. https://bugzilla.redhat.com/201524#c2
371 (define-obsolete-function-alias 'string-to-char-list 'string-to-list) 408 (define-obsolete-function-alias 'string-to-char-list 'string-to-list)
372 409
373 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; window-system objects
374
375 ;; the functionality of column.el has been moved into C
376 ;; Function obsoleted for XEmacs 20.0/February 1997.
377 (defalias 'display-column-mode 'column-number-mode)
378
379 (defun x-color-values (color &optional frame)
380 "Return a description of the color named COLOR on frame FRAME.
381 The value is a list of integer RGB values--(RED GREEN BLUE).
382 These values appear to range from 0 to 65280 or 65535, depending
383 on the system; white is (65280 65280 65280) or (65535 65535 65535).
384 If FRAME is omitted or nil, use the selected frame."
385 (color-instance-rgb-components (make-color-instance color)))
386 (make-compatible 'x-color-values 'color-instance-rgb-components)
387
388 (make-obsolete 'mswindows-color-list 'color-list)
389 (make-obsolete 'tty-color-list 'color-list)
390 (make-compatible 'list-fonts 'font-list)
391
392 ;; Two loser functions which shouldn't be used. 410 ;; Two loser functions which shouldn't be used.
393 (make-obsolete 'following-char 'char-after) 411 (make-obsolete 'following-char 'char-after)
394 (make-obsolete 'preceding-char 'char-before) 412 (make-obsolete 'preceding-char 'char-before)
395 413
414
415 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; misc
416
417 ;; (defun user-original-login-name ()
418 ;; "Return user's login name from original login.
419 ;; This tries to remain unaffected by `su', by looking in environment variables."
420 ;; (or (getenv "LOGNAME") (getenv "USER") (user-login-name)))
421 (define-obsolete-function-alias 'user-original-login-name 'user-login-name)
422
396 ;; Keywords already do The Right Thing in XEmacs 423 ;; Keywords already do The Right Thing in XEmacs
397 (make-compatible 'define-widget-keywords "Just use them") 424 (make-compatible 'define-widget-keywords "Just use them")
398 425
399 (make-obsolete 'function-called-at-point 'function-at-point)
400
401 ;; As of 21.5, #'throw is a special operator. This makes bytecode using it
402 ;; compiled for 21.4 fail; making this function available works around that.
403 (defun obsolete-throw (tag value)
404 "Ugly compatibility hack.
405
406 See the implementation of #'funcall in eval.c. This should be removed once
407 we no longer encounter bytecode from 21.4."
408 (throw tag value))
409
410 (make-obsolete
411 'obsolete-throw
412 "it says `obsolete' in the name, you know you shouldn't be using this.")
413
414 (define-compatible-function-alias 'cl-mapc 'mapc)
415 426
416 (provide 'obsolete) 427 (provide 'obsolete)
417 ;;; obsolete.el ends here 428 ;;; obsolete.el ends here