Mercurial > emacs
comparison lisp/byte-run.el @ 29352:fa490904bee0
* byte-run.el (make-obsolete, make-obsolete-variable):
Add an optional WHEN argument and change the format of the
symbol-property information.
* emacs-lisp/bytecomp.el (byte-compile-log): Don't quote lambda.
(byte-compile-obsolete, byte-compile-variable-ref): Understand the
new obsolete-symbol-property format and print WHEN if it is provided.
(make-obsolete): Update the calls to use the third argument.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Thu, 01 Jun 2000 04:58:08 +0000 |
parents | cc3f3c1ea725 |
children | 37645a051842 |
comparison
equal
deleted
inserted
replaced
29351:bd27c111b184 | 29352:fa490904bee0 |
---|---|
74 (cons 'defun (cons name (cons arglist body))) | 74 (cons 'defun (cons name (cons arglist body))) |
75 (list 'eval-and-compile | 75 (list 'eval-and-compile |
76 (list 'put (list 'quote name) | 76 (list 'put (list 'quote name) |
77 ''byte-optimizer ''byte-compile-inline-expand)))) | 77 ''byte-optimizer ''byte-compile-inline-expand)))) |
78 | 78 |
79 (defun make-obsolete (fn new) | 79 (defun make-obsolete (fn 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 | |
84 was first made obsolete, for example a date or a release number." | |
83 (interactive "aMake function obsolete: \nxObsoletion replacement: ") | 85 (interactive "aMake function obsolete: \nxObsoletion replacement: ") |
84 (let ((handler (get fn 'byte-compile))) | 86 (let ((handler (get fn 'byte-compile))) |
85 (if (eq 'byte-compile-obsolete handler) | 87 (if (eq 'byte-compile-obsolete handler) |
86 (setcar (get fn 'byte-obsolete-info) new) | 88 (setq handler (nth 1 (get fn 'byte-obsolete-info))) |
87 (put fn 'byte-obsolete-info (cons new handler)) | 89 (put fn 'byte-compile 'byte-compile-obsolete)) |
88 (put fn 'byte-compile 'byte-compile-obsolete))) | 90 (put fn 'byte-obsolete-info (list new handler when))) |
89 fn) | 91 fn) |
90 | 92 |
91 (defun make-obsolete-variable (var new) | 93 (defun make-obsolete-variable (var new &optional when) |
92 "Make the byte-compiler warn that VARIABLE is obsolete, | 94 "Make the byte-compiler warn that VARIABLE is obsolete, |
93 and NEW should be used instead. If NEW is a string, then that is the | 95 and NEW should be used instead. If NEW is a string, then that is the |
94 `use instead' message." | 96 `use instead' message. |
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." | |
95 (interactive | 99 (interactive |
96 (list | 100 (list |
97 (let ((str (completing-read "Make variable obsolete: " obarray 'boundp t))) | 101 (let ((str (completing-read "Make variable obsolete: " obarray 'boundp t))) |
98 (if (equal str "") (error "")) | 102 (if (equal str "") (error "")) |
99 (intern str)) | 103 (intern str)) |
100 (car (read-from-string (read-string "Obsoletion replacement: "))))) | 104 (car (read-from-string (read-string "Obsoletion replacement: "))))) |
101 (put var 'byte-obsolete-variable new) | 105 (put var 'byte-obsolete-variable (cons new when)) |
102 var) | 106 var) |
103 | 107 |
104 (put 'dont-compile 'lisp-indent-hook 0) | 108 (put 'dont-compile 'lisp-indent-hook 0) |
105 (defmacro dont-compile (&rest body) | 109 (defmacro dont-compile (&rest body) |
106 "Like `progn', but the body always runs interpreted (not compiled). | 110 "Like `progn', but the body always runs interpreted (not compiled). |