Mercurial > hg > xemacs-beta
diff lisp/bytecomp/bytecomp.el @ 22:8fc7fe29b841 r19-15b94
Import from CVS: tag r19-15b94
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:50:29 +0200 |
parents | 859a2309aef8 |
children | 131b0175ea99 |
line wrap: on
line diff
--- a/lisp/bytecomp/bytecomp.el Mon Aug 13 08:50:06 2007 +0200 +++ b/lisp/bytecomp/bytecomp.el Mon Aug 13 08:50:29 2007 +0200 @@ -103,6 +103,8 @@ ;;; a macro to a lambda or vice versa, ;;; or redefined to take other args) ;;; 'obsolete (obsolete variables and functions) +;;; 'pedantic (references to Emacs-compatible +;;; symbols) ;;; (RMS calls the following option byte-compile-compatibility but ;;; our name is better) ;;; byte-compile-emacs18-compatibility Whether the compiler should @@ -353,6 +355,7 @@ redefine function cell redefined from a macro to a lambda or vice versa, or redefined to take a different number of arguments. obsolete use of an obsolete function or variable. + pedantic warn of use of compatible symbols. The default set is specified by `byte-compile-default-warnings' and normally encompasses all possible warnings. @@ -951,6 +954,16 @@ (car new) (format "use %s instead." (car new))))) (funcall (or (cdr new) 'byte-compile-normal-call) form))) + +;;; Used by make-obsolete. +(defun byte-compile-compatible (form) + (let ((new (get (car form) 'byte-compatible-info))) + (if (memq 'pedantic byte-compile-warnings) + (byte-compile-warn "%s is provided for compatibility; %s" (car form) + (if (stringp (car new)) + (car new) + (format "use %s instead." (car new))))) + (funcall (or (cdr new) 'byte-compile-normal-call) form))) ;; Compiler options @@ -2583,6 +2596,13 @@ (if (stringp ob) ob (format "use %s instead." ob))))) + (if (and (get var 'byte-compatible-variable) + (memq 'pedantic byte-compile-warnings)) + (let ((ob (get var 'byte-compatible-variable))) + (byte-compile-warn "%s is provided for compatibility; %s" var + (if (stringp ob) + ob + (format "use %s instead." ob))))) (if (memq 'free-vars byte-compile-warnings) (if (eq base-op 'byte-varbind) (setq byte-compile-bound-variables