diff options
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 34 |
2 files changed, 30 insertions, 12 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 05c90be59ba..c35bcb40eba 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2005-10-23 Lars Hansen <larsh@soem.dk> | ||
| 2 | * emacs-lisp/bytecomp.el (byte-compile-lambda): Add parameter | ||
| 3 | add-lambda. | ||
| 4 | (byte-compile-file-form-defmumble, byte-compile-defun) | ||
| 5 | (byte-compile-defmacro): Use it. | ||
| 6 | (byte-compile-form): Don't call byte-compile-set-symbol-position | ||
| 7 | when a byte-compile handler is called. | ||
| 8 | |||
| 1 | 2005-10-22 Romain Francoise <romain@orebokech.com> | 9 | 2005-10-22 Romain Francoise <romain@orebokech.com> |
| 2 | 10 | ||
| 3 | * savehist.el (savehist-history-variables): Add `grep-find-history'. | 11 | * savehist.el (savehist-history-variables): Add `grep-find-history'. |
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 559d2bd86c6..47bcbbcae6c 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el | |||
| @@ -908,6 +908,13 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'." | |||
| 908 | ;; list. If our current position is after the symbol's position, we | 908 | ;; list. If our current position is after the symbol's position, we |
| 909 | ;; assume we've already passed that point, and look for the next | 909 | ;; assume we've already passed that point, and look for the next |
| 910 | ;; occurrence of the symbol. | 910 | ;; occurrence of the symbol. |
| 911 | ;; | ||
| 912 | ;; This function should not be called twice for the same occurrence of | ||
| 913 | ;; a symbol, and it should not be called for symbols generated by the | ||
| 914 | ;; byte compiler itself; because rather than just fail looking up the | ||
| 915 | ;; symbol, we may find an occurrence of the symbol further ahead, and | ||
| 916 | ;; then `byte-compile-last-position' as advanced too far. | ||
| 917 | ;; | ||
| 911 | ;; So your're probably asking yourself: Isn't this function a | 918 | ;; So your're probably asking yourself: Isn't this function a |
| 912 | ;; gross hack? And the answer, of course, would be yes. | 919 | ;; gross hack? And the answer, of course, would be yes. |
| 913 | (defun byte-compile-set-symbol-position (sym &optional allow-previous) | 920 | (defun byte-compile-set-symbol-position (sym &optional allow-previous) |
| @@ -2304,7 +2311,7 @@ list that represents a doc string reference. | |||
| 2304 | ',name ',declaration)) | 2311 | ',name ',declaration)) |
| 2305 | outbuffer))))) | 2312 | outbuffer))))) |
| 2306 | 2313 | ||
| 2307 | (let* ((new-one (byte-compile-lambda (cons 'lambda (nthcdr 2 form)))) | 2314 | (let* ((new-one (byte-compile-lambda (nthcdr 2 form) t)) |
| 2308 | (code (byte-compile-byte-code-maker new-one))) | 2315 | (code (byte-compile-byte-code-maker new-one))) |
| 2309 | (if this-one | 2316 | (if this-one |
| 2310 | (setcdr this-one new-one) | 2317 | (setcdr this-one new-one) |
| @@ -2500,10 +2507,16 @@ If FORM is a lambda or a macro, byte-compile it as a function." | |||
| 2500 | ;; Byte-compile a lambda-expression and return a valid function. | 2507 | ;; Byte-compile a lambda-expression and return a valid function. |
| 2501 | ;; The value is usually a compiled function but may be the original | 2508 | ;; The value is usually a compiled function but may be the original |
| 2502 | ;; lambda-expression. | 2509 | ;; lambda-expression. |
| 2503 | (defun byte-compile-lambda (fun) | 2510 | ;; When ADD-LAMBDA is non-nil, the symbol `lambda' is added as head |
| 2504 | (unless (eq 'lambda (car-safe fun)) | 2511 | ;; of the list FUN and `byte-compile-set-symbol-position' is not called. |
| 2505 | (error "Not a lambda list: %S" fun)) | 2512 | ;; Use this feature to avoid calling `byte-compile-set-symbol-position' |
| 2506 | (byte-compile-set-symbol-position 'lambda) | 2513 | ;; for symbols generated by the byte compiler itself. |
| 2514 | (defun byte-compile-lambda (fun &optional add-lambda) | ||
| 2515 | (if add-lambda | ||
| 2516 | (setq fun (cons 'lambda fun)) | ||
| 2517 | (unless (eq 'lambda (car-safe fun)) | ||
| 2518 | (error "Not a lambda list: %S" fun)) | ||
| 2519 | (byte-compile-set-symbol-position 'lambda)) | ||
| 2507 | (byte-compile-check-lambda-list (nth 1 fun)) | 2520 | (byte-compile-check-lambda-list (nth 1 fun)) |
| 2508 | (let* ((arglist (nth 1 fun)) | 2521 | (let* ((arglist (nth 1 fun)) |
| 2509 | (byte-compile-bound-variables | 2522 | (byte-compile-bound-variables |
| @@ -2755,9 +2768,7 @@ That command is designed for interactive use only" fn)) | |||
| 2755 | (or (not (byte-compile-version-cond | 2768 | (or (not (byte-compile-version-cond |
| 2756 | byte-compile-compatibility)) | 2769 | byte-compile-compatibility)) |
| 2757 | (not (get (get fn 'byte-opcode) 'emacs19-opcode)))) | 2770 | (not (get (get fn 'byte-opcode) 'emacs19-opcode)))) |
| 2758 | (progn | 2771 | (funcall handler form) |
| 2759 | (byte-compile-set-symbol-position fn) | ||
| 2760 | (funcall handler form)) | ||
| 2761 | (when (memq 'callargs byte-compile-warnings) | 2772 | (when (memq 'callargs byte-compile-warnings) |
| 2762 | (if (memq fn '(custom-declare-group custom-declare-variable custom-declare-face)) | 2773 | (if (memq fn '(custom-declare-group custom-declare-variable custom-declare-face)) |
| 2763 | (byte-compile-nogroup-warn form)) | 2774 | (byte-compile-nogroup-warn form)) |
| @@ -3671,7 +3682,7 @@ that suppresses all warnings during execution of BODY." | |||
| 3671 | (list 'fset | 3682 | (list 'fset |
| 3672 | (list 'quote (nth 1 form)) | 3683 | (list 'quote (nth 1 form)) |
| 3673 | (byte-compile-byte-code-maker | 3684 | (byte-compile-byte-code-maker |
| 3674 | (byte-compile-lambda (cons 'lambda (cdr (cdr form))))))) | 3685 | (byte-compile-lambda (cdr (cdr form)) t)))) |
| 3675 | (byte-compile-discard)) | 3686 | (byte-compile-discard)) |
| 3676 | ;; We prefer to generate a defalias form so it will record the function | 3687 | ;; We prefer to generate a defalias form so it will record the function |
| 3677 | ;; definition just like interpreting a defun. | 3688 | ;; definition just like interpreting a defun. |
| @@ -3679,7 +3690,7 @@ that suppresses all warnings during execution of BODY." | |||
| 3679 | (list 'defalias | 3690 | (list 'defalias |
| 3680 | (list 'quote (nth 1 form)) | 3691 | (list 'quote (nth 1 form)) |
| 3681 | (byte-compile-byte-code-maker | 3692 | (byte-compile-byte-code-maker |
| 3682 | (byte-compile-lambda (cons 'lambda (cdr (cdr form)))))) | 3693 | (byte-compile-lambda (cdr (cdr form)) t))) |
| 3683 | t)) | 3694 | t)) |
| 3684 | (byte-compile-constant (nth 1 form))) | 3695 | (byte-compile-constant (nth 1 form))) |
| 3685 | 3696 | ||
| @@ -3688,8 +3699,7 @@ that suppresses all warnings during execution of BODY." | |||
| 3688 | (byte-compile-body-do-effect | 3699 | (byte-compile-body-do-effect |
| 3689 | (list (list 'fset (list 'quote (nth 1 form)) | 3700 | (list (list 'fset (list 'quote (nth 1 form)) |
| 3690 | (let ((code (byte-compile-byte-code-maker | 3701 | (let ((code (byte-compile-byte-code-maker |
| 3691 | (byte-compile-lambda | 3702 | (byte-compile-lambda (cdr (cdr form)) t)))) |
| 3692 | (cons 'lambda (cdr (cdr form))))))) | ||
| 3693 | (if (eq (car-safe code) 'make-byte-code) | 3703 | (if (eq (car-safe code) 'make-byte-code) |
| 3694 | (list 'cons ''macro code) | 3704 | (list 'cons ''macro code) |
| 3695 | (list 'quote (cons 'macro (eval code)))))) | 3705 | (list 'quote (cons 'macro (eval code)))))) |