From: Sergey Vinokurov <serg.foo@gmail.com>
To: 12532@debbugs.gnu.org
Subject: bug#12532: 24.2.50; wrong results using byte-compile-file with lexical-binding
Date: Fri, 28 Sep 2012 14:36:34 +0300 [thread overview]
Message-ID: <CAKRbHWiZzVwD-azQ2zG9dcSA-UK1aC1wipi1jrniMTs+-jGVtw@mail.gmail.com> (raw)
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.
next reply other threads:[~2012-09-28 11:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-28 11:36 Sergey Vinokurov [this message]
2012-09-28 20:22 ` bug#12532: 24.2.50; wrong results using byte-compile-file with lexical-binding Stefan Monnier
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=CAKRbHWiZzVwD-azQ2zG9dcSA-UK1aC1wipi1jrniMTs+-jGVtw@mail.gmail.com \
--to=serg.foo@gmail.com \
--cc=12532@debbugs.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.