all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Hansen <larsh@soem.dk>
Cc: emacs-devel@gnu.org
Subject: Re: Misleading error messages from bytecomp.el
Date: Sat, 22 Oct 2005 11:31:43 +0200	[thread overview]
Message-ID: <435A06FF.2040202@soem.dk> (raw)
In-Reply-To: <4352711E.6020307@soem.dk>

[-- Attachment #1: Type: text/plain, Size: 117 bytes --]

Shall I install the attached patch?

For an explanation, please se my previous post in this thread from
october 16.


[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 5163 bytes --]

*** cvsroot/emacs/lisp/emacs-lisp/bytecomp.el	2005-08-08 14:15:23.000000000 +0200
--- emacs/LH-work/byte-compile/bytecomp.2.178.patched.el	2005-10-22 11:20:11.898327320 +0200
***************
*** 908,913 ****
--- 908,920 ----
  ;; list.  If our current position is after the symbol's position, we
  ;; assume we've already passed that point, and look for the next
  ;; occurrence of the symbol.
+ ;;
+ ;; This function should not be called twice for the same occurrence of
+ ;; a symbol, and it should not be called for symbols generated by the
+ ;; byte compiler itself; because rather than just fail looking up the
+ ;; symbol, we may find an occurrence of the symbol further ahead, and
+ ;; then `byte-compile-last-position' as advanced too far.
+ ;;
  ;; So your're probably asking yourself: Isn't this function a
  ;; gross hack?  And the answer, of course, would be yes.
  (defun byte-compile-set-symbol-position (sym &optional allow-previous)
***************
*** 2304,2310 ****
  				 ',name ',declaration))
  		   outbuffer)))))
  
!     (let* ((new-one (byte-compile-lambda (cons 'lambda (nthcdr 2 form))))
  	   (code (byte-compile-byte-code-maker new-one)))
        (if this-one
  	  (setcdr this-one new-one)
--- 2311,2317 ----
  				 ',name ',declaration))
  		   outbuffer)))))
  
!     (let* ((new-one (byte-compile-lambda (nthcdr 2 form) t))
  	   (code (byte-compile-byte-code-maker new-one)))
        (if this-one
  	  (setcdr this-one new-one)
***************
*** 2500,2509 ****
  ;; Byte-compile a lambda-expression and return a valid function.
  ;; The value is usually a compiled function but may be the original
  ;; lambda-expression.
! (defun byte-compile-lambda (fun)
!   (unless (eq 'lambda (car-safe fun))
!     (error "Not a lambda list: %S" fun))
!   (byte-compile-set-symbol-position 'lambda)
    (byte-compile-check-lambda-list (nth 1 fun))
    (let* ((arglist (nth 1 fun))
  	 (byte-compile-bound-variables
--- 2507,2518 ----
  ;; Byte-compile a lambda-expression and return a valid function.
  ;; The value is usually a compiled function but may be the original
  ;; lambda-expression.
! (defun byte-compile-lambda (fun &optional add-lambda)
!   (if add-lambda
!       (setq fun (cons 'lambda fun))
!     (unless (eq 'lambda (car-safe fun))
!       (error "Not a lambda list: %S" fun))
!     (byte-compile-set-symbol-position 'lambda))
    (byte-compile-check-lambda-list (nth 1 fun))
    (let* ((arglist (nth 1 fun))
  	 (byte-compile-bound-variables
***************
*** 2755,2763 ****
  		    (or (not (byte-compile-version-cond
  			      byte-compile-compatibility))
  			(not (get (get fn 'byte-opcode) 'emacs19-opcode))))
! 	       (progn
! 		 (byte-compile-set-symbol-position fn)
! 		 (funcall handler form))
  	     (when (memq 'callargs byte-compile-warnings)
  	       (if (memq fn '(custom-declare-group custom-declare-variable custom-declare-face))
  		   (byte-compile-nogroup-warn form))
--- 2764,2770 ----
  		    (or (not (byte-compile-version-cond
  			      byte-compile-compatibility))
  			(not (get (get fn 'byte-opcode) 'emacs19-opcode))))
!                (funcall handler form)
  	     (when (memq 'callargs byte-compile-warnings)
  	       (if (memq fn '(custom-declare-group custom-declare-variable custom-declare-face))
  		   (byte-compile-nogroup-warn form))
***************
*** 3671,3677 ****
  	 (list 'fset
  	       (list 'quote (nth 1 form))
  	       (byte-compile-byte-code-maker
! 		(byte-compile-lambda (cons 'lambda (cdr (cdr form)))))))
  	(byte-compile-discard))
      ;; We prefer to generate a defalias form so it will record the function
      ;; definition just like interpreting a defun.
--- 3678,3684 ----
  	 (list 'fset
  	       (list 'quote (nth 1 form))
  	       (byte-compile-byte-code-maker
! 		(byte-compile-lambda (cdr (cdr form)) t))))
  	(byte-compile-discard))
      ;; We prefer to generate a defalias form so it will record the function
      ;; definition just like interpreting a defun.
***************
*** 3679,3685 ****
       (list 'defalias
  	   (list 'quote (nth 1 form))
  	   (byte-compile-byte-code-maker
! 	    (byte-compile-lambda (cons 'lambda (cdr (cdr form))))))
       t))
    (byte-compile-constant (nth 1 form)))
  
--- 3686,3692 ----
       (list 'defalias
  	   (list 'quote (nth 1 form))
  	   (byte-compile-byte-code-maker
! 	    (byte-compile-lambda (cdr (cdr form)) t)))
       t))
    (byte-compile-constant (nth 1 form)))
  
***************
*** 3688,3695 ****
    (byte-compile-body-do-effect
     (list (list 'fset (list 'quote (nth 1 form))
  	       (let ((code (byte-compile-byte-code-maker
! 			    (byte-compile-lambda
! 			     (cons 'lambda (cdr (cdr form)))))))
  		 (if (eq (car-safe code) 'make-byte-code)
  		     (list 'cons ''macro code)
  		   (list 'quote (cons 'macro (eval code))))))
--- 3695,3701 ----
    (byte-compile-body-do-effect
     (list (list 'fset (list 'quote (nth 1 form))
  	       (let ((code (byte-compile-byte-code-maker
! 			    (byte-compile-lambda (cdr (cdr form)) t))))
  		 (if (eq (car-safe code) 'make-byte-code)
  		     (list 'cons ''macro code)
  		   (list 'quote (cons 'macro (eval code))))))

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

  reply	other threads:[~2005-10-22  9:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-16 15:26 Misleading error messages from bytecomp.el Lars Hansen
2005-10-22  9:31 ` Lars Hansen [this message]
2005-10-23  4:42   ` Richard M. Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=435A06FF.2040202@soem.dk \
    --to=larsh@soem.dk \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.