From unknown Sat Sep 13 21:03:19 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#12532 <12532@debbugs.gnu.org> To: bug#12532 <12532@debbugs.gnu.org> Subject: Status: 24.2.50; wrong results using byte-compile-file with lexical-binding Reply-To: bug#12532 <12532@debbugs.gnu.org> Date: Sun, 14 Sep 2025 04:03:19 +0000 retitle 12532 24.2.50; wrong results using byte-compile-file with lexical-b= inding reassign 12532 emacs submitter 12532 Sergey Vinokurov severity 12532 normal tag 12532 notabug thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 28 11:54:25 2012 Received: (at submit) by debbugs.gnu.org; 28 Sep 2012 15:54:25 +0000 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 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 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 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.2 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 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 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 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 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== MIME-Version: 1.0 Received: by 10.66.72.134 with SMTP id d6mr16800989pav.13.1348832194128; Fri, 28 Sep 2012 04:36:34 -0700 (PDT) Received: by 10.68.135.36 with HTTP; Fri, 28 Sep 2012 04:36:34 -0700 (PDT) Date: Fri, 28 Sep 2012 14:36:34 +0300 Message-ID: Subject: 24.2.50; wrong results using byte-compile-file with lexical-binding From: Sergey Vinokurov To: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset=UTF-8 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-Received-From: 208.118.235.17 X-Spam-Score: -6.1 (------) X-Debbugs-Envelope-To: submit 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 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.1 (------) 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. From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 28 16:23:04 2012 Received: (at 12532) by debbugs.gnu.org; 28 Sep 2012 20:23:04 +0000 Received: from localhost ([127.0.0.1]:60953 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1THh5T-0001Bh-Ll for submit@debbugs.gnu.org; Fri, 28 Sep 2012 16:23:04 -0400 Received: from pruche.dit.umontreal.ca ([132.204.246.22]:35581) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1THh5Q-0001B6-ME; Fri, 28 Sep 2012 16:23:01 -0400 Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id q8SKMmrS008520; Fri, 28 Sep 2012 16:22:48 -0400 Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 6FE11B40A1; Fri, 28 Sep 2012 16:22:48 -0400 (EDT) From: Stefan Monnier To: Sergey Vinokurov Subject: Re: bug#12532: 24.2.50; wrong results using byte-compile-file with lexical-binding Message-ID: References: Date: Fri, 28 Sep 2012 16:22:48 -0400 In-Reply-To: (Sergey Vinokurov's message of "Fri, 28 Sep 2012 14:36:34 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4355=0 X-NAI-Spam-Version: 2.2.0.9309 : core <4355> : streams <827623> : uri <1230215> X-Spam-Score: -4.3 (----) X-Debbugs-Envelope-To: 12532 Cc: 12532@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.3 (----) tags 12532 notabug thanks > 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 Yes. Using special variables as function arguments is not supported for lexical-binding code. So the behavior can change according to the phase of the moon. That's also why the byte-compiler warns you that test12592_hY.el:2:1:Warning: Argument *myvar* is not a lexical variable Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 11 21:08:05 2012 Received: (at control) by debbugs.gnu.org; 12 Oct 2012 01:08:05 +0000 Received: from localhost ([127.0.0.1]:40091 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TMTjQ-0002hh-O1 for submit@debbugs.gnu.org; Thu, 11 Oct 2012 21:08:05 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:58281 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TMTjO-0002h0-Fj for control@debbugs.gnu.org; Thu, 11 Oct 2012 21:08:02 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1TMTic-0007gI-SJ for control@debbugs.gnu.org; Thu, 11 Oct 2012 21:07:15 -0400 Date: Thu, 11 Oct 2012 21:07:14 -0400 Message-Id: Subject: control message for bug 12532 To: X-Mailer: mail (GNU Mailutils 2.1) From: Glenn Morris X-Spam-Score: -6.3 (------) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.3 (------) close 12532 From unknown Sat Sep 13 21:03:19 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 09 Nov 2012 12:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator