# HG changeset patch # User Richard M. Stallman # Date 841268030 0 # Node ID 38a50022d61042b31e28a12ab1c9f457558af830 # Parent 1757da8f8f3106eab16f16aec87b14146b6cb6f2 (byte-compile-funarg-2): New function, (sort): Use byte-compile-funarg-2. diff -r 1757da8f8f31 -r 38a50022d610 lisp/emacs-lisp/bytecomp.el --- a/lisp/emacs-lisp/bytecomp.el Wed Aug 28 21:27:18 1996 +0000 +++ b/lisp/emacs-lisp/bytecomp.el Wed Aug 28 21:33:50 1996 +0000 @@ -10,7 +10,7 @@ ;;; This version incorporates changes up to version 2.10 of the ;;; Zawinski-Furuseth compiler. -(defconst byte-compile-version "$Revision: 2.13 $") +(defconst byte-compile-version "$Revision: 2.14 $") ;; This file is part of GNU Emacs. @@ -2556,6 +2556,19 @@ (cdr (cdr form)))) form)))) +(defun byte-compile-funarg-2 (form) + ;; (sort ... '(lambda (x) ..)) ==> (sort ... (function (lambda (x) ..))) + ;; for cases where it's guaranteed that second arg will be used as a lambda. + (byte-compile-normal-call + (let ((fn (nth 2 form))) + (if (and (eq (car-safe fn) 'quote) + (eq (car-safe (nth 1 fn)) 'lambda)) + (cons (car form) + (cons (nth 1 form) + (cons (cons 'function (cdr fn)) + (cdr (cdr (cdr form)))))) + form)))) + ;; (function foo) must compile like 'foo, not like (symbol-function 'foo). ;; Otherwise it will be incompatible with the interpreter, ;; and (funcall (function foo)) will lose with autoloads. @@ -2682,6 +2695,7 @@ (byte-defop-compiler-1 mapcar byte-compile-funarg) (byte-defop-compiler-1 mapatoms byte-compile-funarg) (byte-defop-compiler-1 mapconcat byte-compile-funarg) +(byte-defop-compiler-1 sort byte-compile-funarg-2) (byte-defop-compiler-1 let) (byte-defop-compiler-1 let*)