/[emacs]/emacs/lisp/emacs-lisp/byte-run.el
ViewVC logotype

Diff of /emacs/lisp/emacs-lisp/byte-run.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.13 by rms, Thu May 19 15:39:56 2005 UTC revision 1.14 by lektu, Tue Jun 14 15:50:22 2005 UTC
# Line 100  The return value of this function is not Line 100  The return value of this function is not
100       (eval-and-compile       (eval-and-compile
101         (put ',name 'byte-optimizer 'byte-compile-inline-expand))))         (put ',name 'byte-optimizer 'byte-compile-inline-expand))))
102    
103  (defun make-obsolete (function new &optional when)  (defun make-obsolete (obsolete-name current-name &optional when)
104    "Make the byte-compiler warn that FUNCTION is obsolete.    "Make the byte-compiler warn that OBSOLETE-NAME is obsolete.
105  The warning will say that NEW should be used instead.  The warning will say that CURRENT-NAME should be used instead.
106  If NEW is a string, that is the `use instead' message.  If CURRENT-NAME is a string, that is the `use instead' message.
107  If provided, WHEN should be a string indicating when the function  If provided, WHEN should be a string indicating when the function
108  was first made obsolete, for example a date or a release number."  was first made obsolete, for example a date or a release number."
109    (interactive "aMake function obsolete: \nxObsoletion replacement: ")    (interactive "aMake function obsolete: \nxObsoletion replacement: ")
110    (let ((handler (get function 'byte-compile)))    (let ((handler (get obsolete-name 'byte-compile)))
111      (if (eq 'byte-compile-obsolete handler)      (if (eq 'byte-compile-obsolete handler)
112          (setq handler (nth 1 (get function 'byte-obsolete-info)))          (setq handler (nth 1 (get obsolete-name 'byte-obsolete-info)))
113        (put function 'byte-compile 'byte-compile-obsolete))        (put obsolete-name 'byte-compile 'byte-compile-obsolete))
114      (put function 'byte-obsolete-info (list new handler when)))      (put obsolete-name 'byte-obsolete-info (list current-name handler when)))
115    function)    obsolete-name)
116    
117  (defmacro define-obsolete-function-alias (function new  (defmacro define-obsolete-function-alias (obsolete-name current-name
118                                                     &optional when docstring)                                                     &optional when docstring)
119    "Set FUNCTION's function definition to NEW and mark it obsolete.    "Set OBSOLETE-NAME's function definition to CURRENT-NAME and mark it obsolete.
120    
121  \(define-obsolete-function-alias 'old-fun 'new-fun \"22.1\" \"old-fun's doc.\")  \(define-obsolete-function-alias 'old-fun 'new-fun \"22.1\" \"old-fun's doc.\")
122    
# Line 127  is equivalent to the following two lines Line 127  is equivalent to the following two lines
127    
128  See the docstrings of `defalias' and `make-obsolete' for more details."  See the docstrings of `defalias' and `make-obsolete' for more details."
129    `(progn    `(progn
130       (defalias ,function ,new ,docstring)       (defalias ,obsolete-name ,current-name ,docstring)
131       (make-obsolete ,function ,new ,when)))       (make-obsolete ,obsolete-name ,current-name ,when)))
132    
133  (defun make-obsolete-variable (variable new &optional when)  (defun make-obsolete-variable (obsolete-name current-name &optional when)
134    "Make the byte-compiler warn that VARIABLE is obsolete.    "Make the byte-compiler warn that OBSOLETE-NAME is obsolete.
135  The warning will say that NEW should be used instead.  The warning will say that CURRENT-NAME should be used instead.
136  If NEW is a string, that is the `use instead' message.  If CURRENT-NAME is a string, that is the `use instead' message.
137  If provided, WHEN should be a string indicating when the variable  If provided, WHEN should be a string indicating when the variable
138  was first made obsolete, for example a date or a release number."  was first made obsolete, for example a date or a release number."
139    (interactive    (interactive
# Line 142  was first made obsolete, for example a d Line 142  was first made obsolete, for example a d
142        (if (equal str "") (error ""))        (if (equal str "") (error ""))
143        (intern str))        (intern str))
144      (car (read-from-string (read-string "Obsoletion replacement: ")))))      (car (read-from-string (read-string "Obsoletion replacement: ")))))
145    (put variable 'byte-obsolete-variable (cons new when))    (put obsolete-name 'byte-obsolete-variable (cons current-name when))
146    variable)    obsolete-name)
147    
148  (defmacro define-obsolete-variable-alias (variable new  (defmacro define-obsolete-variable-alias (obsolete-name current-name
149                                                   &optional when docstring)                                                   &optional when docstring)
150    "Make VARIABLE a variable alias for NEW and mark it obsolete.    "Make OBSOLETE-NAME a variable alias for CURRENT-NAME and mark it obsolete.
151    
152  \(define-obsolete-variable-alias 'old-var 'new-var \"22.1\" \"old-var's doc.\")  \(define-obsolete-variable-alias 'old-var 'new-var \"22.1\" \"old-var's doc.\")
153    
# Line 159  is equivalent to the following two lines Line 159  is equivalent to the following two lines
159  See the docstrings of `defvaralias' and `make-obsolete-variable' or  See the docstrings of `defvaralias' and `make-obsolete-variable' or
160  Info node `(elisp)Variable Aliases' for more details."  Info node `(elisp)Variable Aliases' for more details."
161    `(progn    `(progn
162       (defvaralias ,variable ,new ,docstring)       (defvaralias ,obsolete-name ,current-name ,docstring)
163        (make-obsolete-variable ,variable ,new ,when)))        (make-obsolete-variable ,obsolete-name ,current-name ,when)))
164    
165  (defmacro dont-compile (&rest body)  (defmacro dont-compile (&rest body)
166    "Like `progn', but the body always runs interpreted (not compiled).    "Like `progn', but the body always runs interpreted (not compiled).

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26