aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/NEWS2
-rw-r--r--lisp/ChangeLog23
-rw-r--r--lisp/emacs-lisp/byte-run.el26
-rw-r--r--lisp/emacs-lisp/bytecomp.el30
-rw-r--r--lisp/help-fns.el16
5 files changed, 68 insertions, 29 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 9003f42ee96..1f39f8171e0 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -246,6 +246,8 @@ Command*'.
246 246
247* Lisp changes in Emacs 23.2 247* Lisp changes in Emacs 23.2
248 248
249** New function set-advertised-calling-convention makes it possible
250to obsolete arguments as well as make some arguments mandatory.
249** eval-next-after-load is obsolete. 251** eval-next-after-load is obsolete.
250** New hook `after-load-functions' run after loading an Elisp file. 252** New hook `after-load-functions' run after loading an Elisp file.
251 253
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 3bfd9c70ff4..505f9b847c6 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,15 @@
12009-10-01 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * emacs-lisp/byte-run.el (advertised-signature-table): New var.
4 (set-advertised-calling-convention): New function.
5 (make-obsolete, define-obsolete-function-alias)
6 (make-obsolete-variable, define-obsolete-variable-alias):
7 Make the optional-ness of `when' obsolete.
8 (define-obsolete-face-alias): Make `when' non-optional.
9 * help-fns.el (help-function-arglist):
10 * emacs-lisp/bytecomp.el (byte-compile-fdefinition):
11 Use advertised-signature-table.
12
12009-10-01 Michael Albinus <michael.albinus@gmx.de> 132009-10-01 Michael Albinus <michael.albinus@gmx.de>
2 14
3 * files.el (delete-directory): New defun. The original function 15 * files.el (delete-directory): New defun. The original function
@@ -11,16 +23,15 @@
11 23
12 * net/tramp.el (tramp-handle-make-directory): Flush upper 24 * net/tramp.el (tramp-handle-make-directory): Flush upper
13 directory's file properties. 25 directory's file properties.
14 (tramp-handle-delete-directory): Handle optional parameter 26 (tramp-handle-delete-directory): Handle optional parameter RECURSIVE.
15 RECURSIVE.
16 (tramp-handle-dired-recursive-delete-directory): Flush directory 27 (tramp-handle-dired-recursive-delete-directory): Flush directory
17 properties after the remove command only. 28 properties after the remove command only.
18 29
19 * net/tramp-fish.el (tramp-fish-handle-delete-directory): Handle 30 * net/tramp-fish.el (tramp-fish-handle-delete-directory):
20 optional parameter RECURSIVE. 31 Handle optional parameter RECURSIVE.
21 32
22 * net/tramp-gvfs.el (tramp-gvfs-handle-delete-directory): Handle 33 * net/tramp-gvfs.el (tramp-gvfs-handle-delete-directory):
23 optional parameter RECURSIVE. 34 Handle optional parameter RECURSIVE.
24 35
25 * net/tramp-smb.el (tramp-smb-errors): Add error message for 36 * net/tramp-smb.el (tramp-smb-errors): Add error message for
26 connection timeout. 37 connection timeout.
diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el
index b6408f2c14c..7c3ea62f3ec 100644
--- a/lisp/emacs-lisp/byte-run.el
+++ b/lisp/emacs-lisp/byte-run.el
@@ -106,6 +106,15 @@ The return value of this function is not used."
106 (eval-and-compile 106 (eval-and-compile
107 (put ',name 'byte-optimizer 'byte-compile-inline-expand)))) 107 (put ',name 'byte-optimizer 'byte-compile-inline-expand))))
108 108
109(defvar advertised-signature-table (make-hash-table :test 'eq :weakness 'key))
110
111(defun set-advertised-calling-convention (function signature)
112 "Set the advertised SIGNATURE of FUNCTION.
113This will allow the byte-compiler to warn the programmer when she uses
114an obsolete calling convention."
115 (puthash (indirect-function function) signature
116 advertised-signature-table))
117
109(defun make-obsolete (obsolete-name current-name &optional when) 118(defun make-obsolete (obsolete-name current-name &optional when)
110 "Make the byte-compiler warn that OBSOLETE-NAME is obsolete. 119 "Make the byte-compiler warn that OBSOLETE-NAME is obsolete.
111The warning will say that CURRENT-NAME should be used instead. 120The warning will say that CURRENT-NAME should be used instead.
@@ -120,6 +129,9 @@ was first made obsolete, for example a date or a release number."
120 (put obsolete-name 'byte-compile 'byte-compile-obsolete)) 129 (put obsolete-name 'byte-compile 'byte-compile-obsolete))
121 (put obsolete-name 'byte-obsolete-info (list current-name handler when))) 130 (put obsolete-name 'byte-obsolete-info (list current-name handler when)))
122 obsolete-name) 131 obsolete-name)
132(set-advertised-calling-convention
133 ;; New code should always provide the `when' argument.
134 'make-obsolete '(obsolete-name current-name when))
123 135
124(defmacro define-obsolete-function-alias (obsolete-name current-name 136(defmacro define-obsolete-function-alias (obsolete-name current-name
125 &optional when docstring) 137 &optional when docstring)
@@ -137,6 +149,10 @@ See the docstrings of `defalias' and `make-obsolete' for more details."
137 `(progn 149 `(progn
138 (defalias ,obsolete-name ,current-name ,docstring) 150 (defalias ,obsolete-name ,current-name ,docstring)
139 (make-obsolete ,obsolete-name ,current-name ,when))) 151 (make-obsolete ,obsolete-name ,current-name ,when)))
152(set-advertised-calling-convention
153 ;; New code should always provide the `when' argument.
154 'define-obsolete-function-alias
155 '(obsolete-name current-name when &optional docstring))
140 156
141(defun make-obsolete-variable (obsolete-name current-name &optional when) 157(defun make-obsolete-variable (obsolete-name current-name &optional when)
142 "Make the byte-compiler warn that OBSOLETE-NAME is obsolete. 158 "Make the byte-compiler warn that OBSOLETE-NAME is obsolete.
@@ -152,6 +168,9 @@ was first made obsolete, for example a date or a release number."
152 (car (read-from-string (read-string "Obsoletion replacement: "))))) 168 (car (read-from-string (read-string "Obsoletion replacement: ")))))
153 (put obsolete-name 'byte-obsolete-variable (cons current-name when)) 169 (put obsolete-name 'byte-obsolete-variable (cons current-name when))
154 obsolete-name) 170 obsolete-name)
171(set-advertised-calling-convention
172 ;; New code should always provide the `when' argument.
173 'make-obsolete-variable '(obsolete-name current-name when))
155 174
156(defmacro define-obsolete-variable-alias (obsolete-name current-name 175(defmacro define-obsolete-variable-alias (obsolete-name current-name
157 &optional when docstring) 176 &optional when docstring)
@@ -179,14 +198,17 @@ Info node `(elisp)Variable Aliases' for more details."
179 `(progn 198 `(progn
180 (defvaralias ,obsolete-name ,current-name ,docstring) 199 (defvaralias ,obsolete-name ,current-name ,docstring)
181 (make-obsolete-variable ,obsolete-name ,current-name ,when))) 200 (make-obsolete-variable ,obsolete-name ,current-name ,when)))
201(set-advertised-calling-convention
202 ;; New code should always provide the `when' argument.
203 'define-obsolete-variable-alias
204 '(obsolete-name current-name when &optional docstring))
182 205
183;; FIXME This is only defined in this file because the variable- and 206;; FIXME This is only defined in this file because the variable- and
184;; function- versions are too. Unlike those two, this one is not used 207;; function- versions are too. Unlike those two, this one is not used
185;; by the byte-compiler (would be nice if it could warn about obsolete 208;; by the byte-compiler (would be nice if it could warn about obsolete
186;; faces, but it doesn't really do anything special with faces). 209;; faces, but it doesn't really do anything special with faces).
187;; It only really affects M-x describe-face output. 210;; It only really affects M-x describe-face output.
188(defmacro define-obsolete-face-alias (obsolete-face current-face 211(defmacro define-obsolete-face-alias (obsolete-face current-face when)
189 &optional when)
190 "Make OBSOLETE-FACE a face alias for CURRENT-FACE and mark it obsolete. 212 "Make OBSOLETE-FACE a face alias for CURRENT-FACE and mark it obsolete.
191The optional string WHEN gives the Emacs version where OBSOLETE-FACE 213The optional string WHEN gives the Emacs version where OBSOLETE-FACE
192became obsolete." 214became obsolete."
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 79e0885137b..f411576c883 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -1230,11 +1230,11 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'."
1230 1230
1231;;; sanity-checking arglists 1231;;; sanity-checking arglists
1232 1232
1233;; If a function has an entry saying (FUNCTION . t).
1234;; that means we know it is defined but we don't know how.
1235;; If a function has an entry saying (FUNCTION . nil),
1236;; that means treat it as not defined.
1237(defun byte-compile-fdefinition (name macro-p) 1233(defun byte-compile-fdefinition (name macro-p)
1234 ;; If a function has an entry saying (FUNCTION . t).
1235 ;; that means we know it is defined but we don't know how.
1236 ;; If a function has an entry saying (FUNCTION . nil),
1237 ;; that means treat it as not defined.
1238 (let* ((list (if macro-p 1238 (let* ((list (if macro-p
1239 byte-compile-macro-environment 1239 byte-compile-macro-environment
1240 byte-compile-function-environment)) 1240 byte-compile-function-environment))
@@ -1248,16 +1248,18 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'."
1248 (and (not macro-p) 1248 (and (not macro-p)
1249 (byte-code-function-p (symbol-function fn))))) 1249 (byte-code-function-p (symbol-function fn)))))
1250 (setq fn (symbol-function fn))) 1250 (setq fn (symbol-function fn)))
1251 (if (and (not macro-p) (byte-code-function-p fn)) 1251 (let ((advertised (gethash fn advertised-signature-table t)))
1252 fn 1252 (cond
1253 (and (consp fn) 1253 ((listp advertised)
1254 (if (eq 'macro (car fn)) 1254 (if macro-p
1255 (cdr fn) 1255 `(macro lambda ,advertised)
1256 (if macro-p 1256 `(lambda ,advertised)))
1257 nil 1257 ((and (not macro-p) (byte-code-function-p fn)) fn)
1258 (if (eq 'autoload (car fn)) 1258 ((not (consp fn)) nil)
1259 nil 1259 ((eq 'macro (car fn)) (cdr fn))
1260 fn))))))))) 1260 (macro-p nil)
1261 ((eq 'autoload (car fn)) nil)
1262 (t fn)))))))
1261 1263
1262(defun byte-compile-arglist-signature (arglist) 1264(defun byte-compile-arglist-signature (arglist)
1263 (let ((args 0) 1265 (let ((args 0)
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 7608e9f24e9..53663d1aeeb 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -100,13 +100,15 @@ ARGLIST can also be t or a string of the form \"(FUN ARG1 ARG2 ...)\"."
100 ;; Handle symbols aliased to other symbols. 100 ;; Handle symbols aliased to other symbols.
101 (if (and (symbolp def) (fboundp def)) (setq def (indirect-function def))) 101 (if (and (symbolp def) (fboundp def)) (setq def (indirect-function def)))
102 ;; If definition is a macro, find the function inside it. 102 ;; If definition is a macro, find the function inside it.
103 (if (eq (car-safe def) 'macro) (setq def (cdr def))) 103 (let ((advertised (gethash def advertised-signature-table t)))
104 (cond 104 (if (listp advertised) advertised
105 ((byte-code-function-p def) (aref def 0)) 105 (if (eq (car-safe def) 'macro) (setq def (cdr def)))
106 ((eq (car-safe def) 'lambda) (nth 1 def)) 106 (cond
107 ((and (eq (car-safe def) 'autoload) (not (eq (nth 4 def) 'keymap))) 107 ((byte-code-function-p def) (aref def 0))
108 "[Arg list not available until function definition is loaded.]") 108 ((eq (car-safe def) 'lambda) (nth 1 def))
109 (t t))) 109 ((and (eq (car-safe def) 'autoload) (not (eq (nth 4 def) 'keymap)))
110 "[Arg list not available until function definition is loaded.]")
111 (t t)))))
110 112
111(defun help-make-usage (function arglist) 113(defun help-make-usage (function arglist)
112 (cons (if (symbolp function) function 'anonymous) 114 (cons (if (symbolp function) function 'anonymous)