Mercurial > hg > xemacs-beta
comparison lisp/bytecomp-runtime.el @ 2444:0e3842cd22e2
[xemacs-hg @ 2004-12-17 18:11:26 by scop]
Add 3rd arg to make-obsolete(-variable) <1103137950.3587.138.camel@bobcat.mine.nu>
author | scop |
---|---|
date | Fri, 17 Dec 2004 18:11:47 +0000 |
parents | a28c97bd4634 |
children | 018e13fdeaeb |
comparison
equal
deleted
inserted
replaced
2443:5e53a2606f16 | 2444:0e3842cd22e2 |
---|---|
90 ; Instead of the above line, FSF has this: | 90 ; Instead of the above line, FSF has this: |
91 ; (list 'eval-and-compile | 91 ; (list 'eval-and-compile |
92 ; (list 'put (list 'quote name) | 92 ; (list 'put (list 'quote name) |
93 ; ''byte-optimizer ''byte-compile-inline-expand)))) | 93 ; ''byte-optimizer ''byte-compile-inline-expand)))) |
94 | 94 |
95 (defun make-obsolete (fn new) | 95 (defun make-obsolete (fn new &optional when) |
96 "Make the byte-compiler warn that function FN is obsolete. | 96 "Make the byte-compiler warn that function FN is obsolete. |
97 The warning will say that NEW should be used instead. | 97 The warning will say that NEW should be used instead. |
98 If NEW is a string, that is the `use instead' message." | 98 If NEW is a string, that is the `use instead' message. |
99 If provided, WHEN should be a string indicating when the function | |
100 was first made obsolete, for example a date or a release number." | |
99 (interactive "aMake function obsolete: \nxObsoletion replacement: ") | 101 (interactive "aMake function obsolete: \nxObsoletion replacement: ") |
100 (let ((handler (get fn 'byte-compile))) | 102 (let ((handler (get fn 'byte-compile))) |
101 (if (eq 'byte-compile-obsolete handler) | 103 (if (eq 'byte-compile-obsolete handler) |
102 (setcar (get fn 'byte-obsolete-info) new) | 104 (setcar (get fn 'byte-obsolete-info) new) |
103 (put fn 'byte-obsolete-info (cons new handler)) | 105 (put fn 'byte-obsolete-info (cons new handler)) |
104 (put fn 'byte-compile 'byte-compile-obsolete))) | 106 (put fn 'byte-compile 'byte-compile-obsolete))) |
105 fn) | 107 fn) |
106 | 108 |
107 (defun make-obsolete-variable (var new) | 109 (defun make-obsolete-variable (var new &optional when) |
108 "Make the byte-compiler warn that variable VAR is obsolete, | 110 "Make the byte-compiler warn that variable VAR is obsolete, |
109 and NEW should be used instead. If NEW is a string, then that is the | 111 and NEW should be used instead. If NEW is a string, then that is the |
110 `use instead' message." | 112 `use instead' message. |
113 If provided, WHEN should be a string indicating when the variable | |
114 was first made obsolete, for example a date or a release number." | |
111 (interactive | 115 (interactive |
112 (list | 116 (list |
113 (let ((str (completing-read "Make variable obsolete: " obarray 'boundp t))) | 117 (let ((str (completing-read "Make variable obsolete: " obarray 'boundp t))) |
114 (if (equal str "") (error "")) | 118 (if (equal str "") (error "")) |
115 (intern str)) | 119 (intern str)) |