From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sergey Vinokurov Newsgroups: gmane.emacs.bugs Subject: bug#12532: 24.2.50; wrong results using byte-compile-file with lexical-binding Date: Fri, 28 Sep 2012 14:36:34 +0300 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1348847713 31057 80.91.229.3 (28 Sep 2012 15:55:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 28 Sep 2012 15:55:13 +0000 (UTC) To: 12532@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Sep 28 17:55:18 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1THcuK-0006Zu-IM for geb-bug-gnu-emacs@m.gmane.org; Fri, 28 Sep 2012 17:55:16 +0200 Original-Received: from localhost ([::1]:60577 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THcuC-0001wa-7e for geb-bug-gnu-emacs@m.gmane.org; Fri, 28 Sep 2012 11:55:08 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:52014) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THcu4-0001g2-EQ for bug-gnu-emacs@gnu.org; Fri, 28 Sep 2012 11:55:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1THctw-0005zR-Ql for bug-gnu-emacs@gnu.org; Fri, 28 Sep 2012 11:55:00 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:51124) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THctw-0005yl-N4 for bug-gnu-emacs@gnu.org; Fri, 28 Sep 2012 11:54:52 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1THcu5-0001jS-WC for bug-gnu-emacs@gnu.org; Fri, 28 Sep 2012 11:55:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Sergey Vinokurov Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 28 Sep 2012 15:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 12532 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.13488476656592 (code B ref -1); Fri, 28 Sep 2012 15:55:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 28 Sep 2012 15:54:25 +0000 Original-Received: from localhost ([127.0.0.1]:60670 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1THctU-0001iG-Nx for submit@debbugs.gnu.org; Fri, 28 Sep 2012 11:54:25 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:36354) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1THYsO-00045C-E0 for submit@debbugs.gnu.org; Fri, 28 Sep 2012 07:37:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1THYsB-0002qr-Aw for submit@debbugs.gnu.org; Fri, 28 Sep 2012 07:36:51 -0400 Original-Received: from lists.gnu.org ([208.118.235.17]:43740) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THYsB-0002qn-7R for submit@debbugs.gnu.org; Fri, 28 Sep 2012 07:36:47 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:55706) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THYs5-0002W9-HY for bug-gnu-emacs@gnu.org; Fri, 28 Sep 2012 07:36:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1THYrz-0002qF-Pi for bug-gnu-emacs@gnu.org; Fri, 28 Sep 2012 07:36:41 -0400 Original-Received: from mail-pb0-f41.google.com ([209.85.160.41]:38454) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THYrz-0002q8-JX for bug-gnu-emacs@gnu.org; Fri, 28 Sep 2012 07:36:35 -0400 Original-Received: by pbbrq2 with SMTP id rq2so5426574pbb.0 for ; Fri, 28 Sep 2012 04:36:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=g9qtSXb6usyK5m6Bp8FIhGgGHGwEW8CjSG9NnaYuGWU=; b=to2/5tbadYN6TrizZGVE8H7+56C0cOTzNu3/r75KkrUwcAXofWa2LT3n8mRMq6IbP7 JUS979kQelcNt7yYj6DbT7ySLBRGvTVDtPGt8mzuyPOZTgODE0/hTWb1NzfF9qxz8+4M vwP/bxgG076yW6PtxObRHNAmC0zjn8qklP1o6xAkdJc79P28YEa5AFYzJWkU4Hz6ByVo v1pnXlRrkyWUEAUFJyy2ndtPR57SlbOomGNtHMANnwPb3CRU5+1lUX7fdlsfjlfPRe8x qcRkfj0MVTQkXG6lBL3KzMun6QYbLnJZBItDn50RpErO5/XQ67NR1qfOM/Xoyj9JaLWC 5tcA== Original-Received: by 10.66.72.134 with SMTP id d6mr16800989pav.13.1348832194128; Fri, 28 Sep 2012 04:36:34 -0700 (PDT) Original-Received: by 10.68.135.36 with HTTP; Fri, 28 Sep 2012 04:36:34 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Mailman-Approved-At: Fri, 28 Sep 2012 11:54:23 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:64980 Archived-At: On trunk Emacs compiling function with argument names declared as special somewhere, like mode-name, resulting function produced by byte-compile-file is different from function obtained by evaluating definition or byte-compiling that definition in buffer. This code uses all three possibilities and reports evaluating results (progn (defvar *myvar* 'never-shows-up) (let ((tmp (make-temp-file "test" nil ".el")) (form '(defun quux (*myvar*) (mapcar (lambda (y) (list *myvar* y)) '(a))))) (eval form) ;; direct load (message "plain: %s" (eval '(quux t))) (eval '(byte-compile #'quux)) ;; byte-compile definition alone (message "byte-compiled: %s" (eval '(quux t))) (with-temp-buffer (insert ";; -*- lexical-binding: t -*-\n") (princ form (current-buffer)) ;; uncomment this and reassure that byte-compile-file is still wrong ;; (insert "\n\n;; Local Variables:\n;; lexical-binding: t\n;; End:") (write-region (point-min) (point-max) tmp)) (byte-compile-file tmp) (load-file (byte-compile-dest-file tmp)) (message "file byte-compiled: %s" (eval '(quux t))) t)) All three outputs should be equal, but result of loaded byte-compiled function differs plain: ((t a)) byte-compiled: ((t a)) ... file byte-compiled: ((never-shows-up a)) Also byte-compile-file produced a warning test12592_hY.el:2:1:Warning: Argument *myvar* is not a lexical variable but (byte-compile #'quux) hasn't. Using line with ";; Local Variables:" instead of "-*- lexical-binding: t -*-" does not solve the problem either. But if lexical-binding is not specified as a file-local variable it behaves correctly.