]> code.delx.au - gnu-emacs/blobdiff - lisp/byte-run.el
*** empty log message ***
[gnu-emacs] / lisp / byte-run.el
index 8d5595a8b0a76b6e935151adcd617e3355e31c85..09c59818b223007bc5279d2dbf528209ac7376b2 100644 (file)
@@ -4,6 +4,7 @@
 
 ;; Author: Jamie Zawinski <jwz@lucid.com>
 ;;     Hallvard Furuseth <hbf@ulrik.uio.no>
+;; Maintainer: FSF
 ;; Keywords: internal
 
 ;; This file is part of GNU Emacs.
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to
-;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
 
 ;;; Commentary:
 
-;;; interface to selectively inlining functions.
-;;; This only happens when source-code optimization is turned on.
+;; interface to selectively inlining functions.
+;; This only happens when source-code optimization is turned on.
 
 ;;; Code:
 
              (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)