diff 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
line wrap: on
line diff
--- a/lisp/byte-run.el	Thu Jun 01 03:35:31 2000 +0000
+++ b/lisp/byte-run.el	Thu Jun 01 04:58:08 2000 +0000
@@ -76,29 +76,33 @@
 	      (list 'put (list 'quote name)
 		    ''byte-optimizer ''byte-compile-inline-expand))))
 
-(defun make-obsolete (fn new)
+(defun make-obsolete (fn new &optional when)
   "Make the byte-compiler warn that FUNCTION is obsolete.
 The warning will say that NEW should be used instead.
-If NEW is a string, that is the `use instead' message."
+If NEW is a string, that is the `use instead' message.
+If provided, WHEN should be a string indicating when the function
+was first made obsolete, for example a date or a release number."
   (interactive "aMake function obsolete: \nxObsoletion replacement: ")
   (let ((handler (get fn 'byte-compile)))
     (if (eq 'byte-compile-obsolete handler)
-	(setcar (get fn 'byte-obsolete-info) new)
-      (put fn 'byte-obsolete-info (cons new handler))
-      (put fn 'byte-compile 'byte-compile-obsolete)))
+	(setq handler (nth 1 (get fn 'byte-obsolete-info)))
+      (put fn 'byte-compile 'byte-compile-obsolete))
+    (put fn 'byte-obsolete-info (list new handler when)))
   fn)
 
-(defun make-obsolete-variable (var new)
+(defun make-obsolete-variable (var new &optional when)
   "Make the byte-compiler warn that VARIABLE is obsolete,
 and NEW should be used instead.  If NEW is a string, then that is the
-`use instead' message."
+`use instead' message.
+If provided, WHEN should be a string indicating when the variable
+was first made obsolete, for example a date or a release number."
   (interactive
    (list
     (let ((str (completing-read "Make variable obsolete: " obarray 'boundp t)))
       (if (equal str "") (error ""))
       (intern str))
     (car (read-from-string (read-string "Obsoletion replacement: ")))))
-  (put var 'byte-obsolete-variable new)
+  (put var 'byte-obsolete-variable (cons new when))
   var)
 
 (put 'dont-compile 'lisp-indent-hook 0)