changeset 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 bd27c111b184
children 42c2692d3933
files lisp/byte-run.el lisp/emacs-lisp/bytecomp.el
diffstat 2 files changed, 58 insertions(+), 44 deletions(-) [+]
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)
--- a/lisp/emacs-lisp/bytecomp.el	Thu Jun 01 03:35:31 2000 +0000
+++ b/lisp/emacs-lisp/bytecomp.el	Thu Jun 01 04:58:08 2000 +0000
@@ -10,7 +10,7 @@
 
 ;;; This version incorporates changes up to version 2.10 of the
 ;;; Zawinski-Furuseth compiler.
-(defconst byte-compile-version "$Revision: 2.69 $")
+(defconst byte-compile-version "$Revision: 2.70 $")
 
 ;; This file is part of GNU Emacs.
 
@@ -806,8 +806,8 @@
 		    (cons 'format
 		      (cons format-string
 			(mapcar
-			 '(lambda (x)
-			    (if (symbolp x) (list 'prin1-to-string x) x))
+			 (lambda (x)
+			   (if (symbolp x) (list 'prin1-to-string x) x))
 			 args)))))))
 
 (defconst byte-compile-last-warned-form nil)
@@ -895,13 +895,16 @@
 
 ;;; Used by make-obsolete.
 (defun byte-compile-obsolete (form)
-  (let ((new (get (car form) 'byte-obsolete-info)))
+  (let* ((new (get (car form) 'byte-obsolete-info))
+	 (handler (nth 1 new))
+	 (when (nth 2 new)))
     (if (memq 'obsolete byte-compile-warnings)
-	(byte-compile-warn "%s is an obsolete function; %s" (car form)
+	(byte-compile-warn "%s is an obsolete function%s; %s" (car form)
+			   (if when (concat " since " when) "")
 			   (if (stringp (car new))
 			       (car new)
-			       (format "use %s instead." (car new)))))
-    (funcall (or (cdr new) 'byte-compile-normal-call) form)))
+			     (format "use %s instead." (car new)))))
+    (funcall (or handler 'byte-compile-normal-call) form)))
 
 ;; Compiler options
 
@@ -2383,11 +2386,13 @@
 			 (prin1-to-string var))
     (if (and (get var 'byte-obsolete-variable)
 	     (memq 'obsolete byte-compile-warnings))
-	(let ((ob (get var 'byte-obsolete-variable)))
-	  (byte-compile-warn "%s is an obsolete variable; %s" var
-			     (if (stringp ob)
-				 ob
-			       (format "use %s instead." ob)))))
+	(let* ((ob (get var 'byte-obsolete-variable))
+	       (when (cdr ob)))
+	  (byte-compile-warn "%s is an obsolete variable%s; %s" var
+			     (if when (concat " since " when) "")
+			     (if (stringp (car ob))
+				 (car ob)
+			       (format "use %s instead." (car ob))))))
     (if (memq 'free-vars byte-compile-warnings)
 	(if (eq base-op 'byte-varbind)
 	    (setq byte-compile-bound-variables
@@ -3551,37 +3556,42 @@
   (kill-emacs 0))
 
 
-(make-obsolete 'dot 'point)
-(make-obsolete 'dot-max 'point-max)
-(make-obsolete 'dot-min 'point-min)
-(make-obsolete 'dot-marker 'point-marker)
-
-(make-obsolete 'buffer-flush-undo 'buffer-disable-undo)
-(make-obsolete 'baud-rate "use the baud-rate variable instead")
-(make-obsolete 'compiled-function-p 'byte-code-function-p)
-(make-obsolete 'define-function 'defalias)
-(make-obsolete-variable 'auto-fill-hook 'auto-fill-function)
-(make-obsolete-variable 'blink-paren-hook 'blink-paren-function)
-(make-obsolete-variable 'lisp-indent-hook 'lisp-indent-function)
+(make-obsolete 'dot 'point		"before 19.15")
+(make-obsolete 'dot-max 'point-max	"before 19.15")
+(make-obsolete 'dot-min 'point-min	"before 19.15")
+(make-obsolete 'dot-marker 'point-marker "before 19.15")
+
+(make-obsolete 'buffer-flush-undo 'buffer-disable-undo "before 19.15")
+(make-obsolete 'baud-rate "use the baud-rate variable instead" "before 19.15")
+(make-obsolete 'compiled-function-p 'byte-code-function-p "before 19.15")
+(make-obsolete 'define-function 'defalias "20.1")
+(make-obsolete-variable 'auto-fill-hook 'auto-fill-function "before 19.15")
+(make-obsolete-variable 'blink-paren-hook 'blink-paren-function "before 19.15")
+(make-obsolete-variable 'lisp-indent-hook 'lisp-indent-function "before 19.15")
 (make-obsolete-variable 'inhibit-local-variables
-		"use enable-local-variables (with the reversed sense).")
+		"use enable-local-variables (with the reversed sense)."
+		"before 19.15")
 (make-obsolete-variable 'unread-command-char
-  "use unread-command-events instead.  That variable is a list of events to reread, so it now uses nil to mean `no event', instead of -1.")
+  "use unread-command-events instead.  That variable is a list of events to reread, so it now uses nil to mean `no event', instead of -1."
+  "before 19.15")
 (make-obsolete-variable 'unread-command-event
-  "use unread-command-events; which is a list of events rather than a single event.")
-(make-obsolete-variable 'suspend-hooks 'suspend-hook)
-(make-obsolete-variable 'comment-indent-hook 'comment-indent-function)
-(make-obsolete-variable 'meta-flag "Use the set-input-mode function instead.")
-(make-obsolete-variable 'executing-macro 'executing-kbd-macro)
+  "use unread-command-events; which is a list of events rather than a single event."
+  "before 19.15")
+(make-obsolete-variable 'suspend-hooks 'suspend-hook "before 19.15")
+(make-obsolete-variable 'comment-indent-hook 'comment-indent-function "before 19.15")
+(make-obsolete-variable 'meta-flag "Use the set-input-mode function instead." "before 19.34")
+(make-obsolete-variable 'executing-macro 'executing-kbd-macro "before 19.34")
 (make-obsolete-variable 'before-change-function
-  "use before-change-functions; which is a list of functions rather than a single function.")
+  "use before-change-functions; which is a list of functions rather than a single function."
+  "before 19.34")
 (make-obsolete-variable 'after-change-function
-  "use after-change-functions; which is a list of functions rather than a single function.")
-(make-obsolete-variable 'font-lock-doc-string-face 'font-lock-string-face)
+  "use after-change-functions; which is a list of functions rather than a single function."
+  "before 19.34")
+(make-obsolete-variable 'font-lock-doc-string-face 'font-lock-string-face "before 19.34")
 (make-obsolete-variable 'post-command-idle-hook
-  "use timers instead, with `run-with-idle-timer'.")
+  "use timers instead, with `run-with-idle-timer'." "before 19.34")
 (make-obsolete-variable 'post-command-idle-delay
-  "use timers instead, with `run-with-idle-timer'.")
+  "use timers instead, with `run-with-idle-timer'." "before 19.34")
 
 (provide 'byte-compile)
 (provide 'bytecomp)