diff options
| -rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 16 |
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 | ||