aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1996-08-28 21:33:50 +0000
committerRichard M. Stallman1996-08-28 21:33:50 +0000
commit5a6037bb416c6ab252ade68c931e610dcff2d04c (patch)
tree90ed70461f56926fba12db09ed38a68d62fe8c23
parentf822bec6eaa66235a4ace1f046d5714002d14009 (diff)
downloademacs-5a6037bb416c6ab252ade68c931e610dcff2d04c.tar.gz
emacs-5a6037bb416c6ab252ade68c931e610dcff2d04c.zip
(byte-compile-funarg-2): New function,
(sort): Use byte-compile-funarg-2.
-rw-r--r--lisp/emacs-lisp/bytecomp.el16
1 files changed, 15 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 30e92ca8982..0052a947aa5 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -10,7 +10,7 @@
10 10
11;;; This version incorporates changes up to version 2.10 of the 11;;; This version incorporates changes up to version 2.10 of the
12;;; Zawinski-Furuseth compiler. 12;;; Zawinski-Furuseth compiler.
13(defconst byte-compile-version "$Revision: 2.13 $") 13(defconst byte-compile-version "$Revision: 2.14 $")
14 14
15;; This file is part of GNU Emacs. 15;; This file is part of GNU Emacs.
16 16
@@ -2556,6 +2556,19 @@ If FORM is a lambda or a macro, byte-compile it as a function."
2556 (cdr (cdr form)))) 2556 (cdr (cdr form))))
2557 form)))) 2557 form))))
2558 2558
2559(defun byte-compile-funarg-2 (form)
2560 ;; (sort ... '(lambda (x) ..)) ==> (sort ... (function (lambda (x) ..)))
2561 ;; for cases where it's guaranteed that second arg will be used as a lambda.
2562 (byte-compile-normal-call
2563 (let ((fn (nth 2 form)))
2564 (if (and (eq (car-safe fn) 'quote)
2565 (eq (car-safe (nth 1 fn)) 'lambda))
2566 (cons (car form)
2567 (cons (nth 1 form)
2568 (cons (cons 'function (cdr fn))
2569 (cdr (cdr (cdr form))))))
2570 form))))
2571
2559;; (function foo) must compile like 'foo, not like (symbol-function 'foo). 2572;; (function foo) must compile like 'foo, not like (symbol-function 'foo).
2560;; Otherwise it will be incompatible with the interpreter, 2573;; Otherwise it will be incompatible with the interpreter,
2561;; and (funcall (function foo)) will lose with autoloads. 2574;; and (funcall (function foo)) will lose with autoloads.
@@ -2682,6 +2695,7 @@ If FORM is a lambda or a macro, byte-compile it as a function."
2682(byte-defop-compiler-1 mapcar byte-compile-funarg) 2695(byte-defop-compiler-1 mapcar byte-compile-funarg)
2683(byte-defop-compiler-1 mapatoms byte-compile-funarg) 2696(byte-defop-compiler-1 mapatoms byte-compile-funarg)
2684(byte-defop-compiler-1 mapconcat byte-compile-funarg) 2697(byte-defop-compiler-1 mapconcat byte-compile-funarg)
2698(byte-defop-compiler-1 sort byte-compile-funarg-2)
2685(byte-defop-compiler-1 let) 2699(byte-defop-compiler-1 let)
2686(byte-defop-compiler-1 let*) 2700(byte-defop-compiler-1 let*)
2687 2701