comparison lisp/emacs-lisp/byte-run.el @ 55405:79eecb3f0e5a

(make-obsolete, make-obsolete-variable): Make argument names match their use in docstring.
author Juanma Barranquero <lekktu@gmail.com>
date Fri, 07 May 2004 00:58:54 +0000
parents 1376729a93a7
children a7bed417c2e6 4c90ffeb71c5
comparison
equal deleted inserted replaced
55404:14a47b65c288 55405:79eecb3f0e5a
74 `(prog1 74 `(prog1
75 (defun ,name ,arglist ,@body) 75 (defun ,name ,arglist ,@body)
76 (eval-and-compile 76 (eval-and-compile
77 (put ',name 'byte-optimizer 'byte-compile-inline-expand)))) 77 (put ',name 'byte-optimizer 'byte-compile-inline-expand))))
78 78
79 (defun make-obsolete (fn new &optional when) 79 (defun make-obsolete (function new &optional when)
80 "Make the byte-compiler warn that FUNCTION is obsolete. 80 "Make the byte-compiler warn that FUNCTION is obsolete.
81 The warning will say that NEW should be used instead. 81 The warning will say that NEW should be used instead.
82 If NEW is a string, that is the `use instead' message. 82 If NEW is a string, that is the `use instead' message.
83 If provided, WHEN should be a string indicating when the function 83 If provided, WHEN should be a string indicating when the function
84 was first made obsolete, for example a date or a release number." 84 was first made obsolete, for example a date or a release number."
85 (interactive "aMake function obsolete: \nxObsoletion replacement: ") 85 (interactive "aMake function obsolete: \nxObsoletion replacement: ")
86 (let ((handler (get fn 'byte-compile))) 86 (let ((handler (get function 'byte-compile)))
87 (if (eq 'byte-compile-obsolete handler) 87 (if (eq 'byte-compile-obsolete handler)
88 (setq handler (nth 1 (get fn 'byte-obsolete-info))) 88 (setq handler (nth 1 (get function 'byte-obsolete-info)))
89 (put fn 'byte-compile 'byte-compile-obsolete)) 89 (put function 'byte-compile 'byte-compile-obsolete))
90 (put fn 'byte-obsolete-info (list new handler when))) 90 (put function 'byte-obsolete-info (list new handler when)))
91 fn) 91 function)
92 92
93 (defun make-obsolete-variable (var new &optional when) 93 (defun make-obsolete-variable (variable new &optional when)
94 "Make the byte-compiler warn that VARIABLE is obsolete. 94 "Make the byte-compiler warn that VARIABLE is obsolete.
95 The warning will say that NEW should be used instead. 95 The warning will say that NEW should be used instead.
96 If NEW is a string, that is the `use instead' message. 96 If NEW is a string, that is the `use instead' message.
97 If provided, WHEN should be a string indicating when the variable 97 If provided, WHEN should be a string indicating when the variable
98 was first made obsolete, for example a date or a release number." 98 was first made obsolete, for example a date or a release number."
100 (list 100 (list
101 (let ((str (completing-read "Make variable obsolete: " obarray 'boundp t))) 101 (let ((str (completing-read "Make variable obsolete: " obarray 'boundp t)))
102 (if (equal str "") (error "")) 102 (if (equal str "") (error ""))
103 (intern str)) 103 (intern str))
104 (car (read-from-string (read-string "Obsoletion replacement: "))))) 104 (car (read-from-string (read-string "Obsoletion replacement: ")))))
105 (put var 'byte-obsolete-variable (cons new when)) 105 (put variable 'byte-obsolete-variable (cons new when))
106 var) 106 variable)
107 107
108 (put 'dont-compile 'lisp-indent-hook 0) 108 (put 'dont-compile 'lisp-indent-hook 0)
109 (defmacro dont-compile (&rest body) 109 (defmacro dont-compile (&rest body)
110 "Like `progn', but the body always runs interpreted (not compiled). 110 "Like `progn', but the body always runs interpreted (not compiled).
111 If you think you need this, you're probably making a mistake somewhere." 111 If you think you need this, you're probably making a mistake somewhere."