changeset 4639:7757334005ae

bytecomp.el: always check code in (interactive SEXP) for sanity 2009-05-29 Aidan Kehoe <kehoea@parhasard.net> * bytecomp.el (byte-compile-lambda): Even if we are going to store uncompiled interactive forms in the compiled-function object, byte compile (and discard) the code, for the sake of the warnings generated.
author Aidan Kehoe <kehoea@parhasard.net>
date Sat, 06 Jun 2009 12:59:31 +0100
parents 5bbff3553494
children 8cef85a39d2c
files lisp/ChangeLog lisp/bytecomp.el
diffstat 2 files changed, 16 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Fri Jun 05 21:48:41 2009 +0900
+++ b/lisp/ChangeLog	Sat Jun 06 12:59:31 2009 +0100
@@ -1,3 +1,10 @@
+2009-05-29  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* bytecomp.el (byte-compile-lambda): 
+	Even if we are going to store uncompiled interactive forms in the
+	compiled-function object, byte compile (and discard) the code, for
+	the sake of the warnings generated. 
+
 2009-05-18  Stephen J. Turnbull  <stephen@xemacs.org>
 
 	* XEmacs 21.5.29 "garbanzo" is released.
--- a/lisp/bytecomp.el	Fri Jun 05 21:48:41 2009 +0900
+++ b/lisp/bytecomp.el	Sat Jun 06 12:59:31 2009 +0100
@@ -2541,7 +2541,7 @@
 		    ;; only if it is not the only element of the body.
 		    (if (cdr body)
 			(setq body (cdr body))))))
-	 (int (assq 'interactive body)))
+	 (int (assq 'interactive body)) compiled-int)
     (dolist (arg arglist)
       (cond ((not (symbolp arg))
 	     (byte-compile-warn "non-symbol in arglist: %S" arg))
@@ -2560,9 +2560,11 @@
 		  (if (cdr (cdr int))
 		      (byte-compile-warn "malformed interactive spec: %s"
 					 (prin1-to-string int)))
-		  ;; If the interactive spec is a call to `list',
-		  ;; don't compile it, because `call-interactively'
-		  ;; looks at the args of `list'.
+		  ;; If the interactive spec is a call to `list', don't
+		  ;; store the compiled form, because `call-interactively'
+		  ;; looks at the args of `list' and treats certain
+		  ;; functions specially.  Compiling it is nonetheless
+		  ;; useful for warnings.
 		  (let ((form (nth 1 int)))
 		    (while (or (eq (car-safe form) 'let)
 			       (eq (car-safe form) 'let*)
@@ -2570,9 +2572,10 @@
 		      (while (consp (cdr form))
 			(setq form (cdr form)))
 		      (setq form (car form)))
+		    (setq compiled-int 
+			  (byte-compile-top-level (nth 1 int)))
 		    (or (eq (car-safe form) 'list)
-			(setq int (list 'interactive
-					(byte-compile-top-level (nth 1 int)))))))
+			(setq int (list 'interactive compiled-int)))))
 		 ((cdr int)
 		  (byte-compile-warn "malformed interactive spec: %s"
 				     (prin1-to-string int))))))