changeset 86336:5dde93581c8f

(byte-compile-file-form-custom-declare-variable): Simplify.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 22 Nov 2007 18:03:05 +0000
parents eaf0c8e1e9aa
children 161416156d88
files lisp/ChangeLog lisp/emacs-lisp/bytecomp.el
diffstat 2 files changed, 14 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Thu Nov 22 16:50:11 2007 +0000
+++ b/lisp/ChangeLog	Thu Nov 22 18:03:05 2007 +0000
@@ -1,3 +1,8 @@
+2007-11-22  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* emacs-lisp/bytecomp.el
+	(byte-compile-file-form-custom-declare-variable): Simplify.
+
 2007-11-22  Juanma Barranquero  <lekktu@gmail.com>
 
 	* cus-edit.el (custom-mode): Define with `define-derived-mode'.
--- a/lisp/emacs-lisp/bytecomp.el	Thu Nov 22 16:50:11 2007 +0000
+++ b/lisp/emacs-lisp/bytecomp.el	Thu Nov 22 18:03:05 2007 +0000
@@ -2277,18 +2277,17 @@
     (byte-compile-nogroup-warn form))
   (when (byte-compile-warning-enabled-p 'free-vars)
     (push (nth 1 (nth 1 form)) byte-compile-bound-variables))
+  ;; Don't compile the expression because it may be displayed to the user.
+  ;; (when (eq (car-safe (nth 2 form)) 'quote)
+  ;;   ;; (nth 2 form) is meant to evaluate to an expression, so if we have the
+  ;;   ;; final value already, we can byte-compile it.
+  ;;   (setcar (cdr (nth 2 form))
+  ;;           (byte-compile-top-level (cadr (nth 2 form)) nil 'file)))
   (let ((tail (nthcdr 4 form)))
     (while tail
-      ;; If there are any (function (lambda ...)) expressions, compile
-      ;; those functions.
-      (if (and (consp (car tail))
-	       (eq (car (car tail)) 'function)
-	       (consp (nth 1 (car tail))))
-	  (setcar tail (byte-compile-lambda (nth 1 (car tail))))
-	;; Likewise for a bare lambda.
-	(if (and (consp (car tail))
-		 (eq (car (car tail)) 'lambda))
-	    (setcar tail (byte-compile-lambda (car tail)))))
+      (unless (keywordp (car tail))      ;No point optimizing keywords.
+        ;; Compile the keyword arguments.
+        (setcar tail (byte-compile-top-level (car tail) nil 'file)))
       (setq tail (cdr tail))))
   form)