From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Juanma Barranquero <lekktu@gmail.com>
Cc: michael_heerdegen@web.de, 11241@debbugs.gnu.org
Subject: bug#11241: 24.1.50; emacs-lock is ill uncompiled (lexical binding problem?)
Date: Sat, 14 Apr 2012 08:47:09 -0400 [thread overview]
Message-ID: <jwvy5pyzfb1.fsf-monnier+INBOX@gnu.org> (raw)
In-Reply-To: <CAAeL0SS0CM4=+K+j+9bB5K2Liy3baHavd7w20DzJCk-OHeaKOA@mail.gmail.com> (Juanma Barranquero's message of "Sat, 14 Apr 2012 04:06:19 +0200")
>> You don't get that error when you use the compiled code, however.
> Stefan, I can "fix" this for 24.1 just by making emacs-lock.el not use
> lexical-binding. But is this difference between compiled and
> non-compiled code a bug in the lexical-binding support or something
> expected?
IIRC the problem is that it's not clear whether (<function> <args>)
should treat <function> as an expression or a value.
The compiler handles such as call like (funcall #'<function> <args>)
whereas the interpreter handles it like (funcall '<function> <args>).
In dynamically scoped Elisp, there is no difference between the two, but
not with lexical scoping.
The patch below should work around the difference.
Note that using define-minor-mode's `arg' is not recommended
[ But no, I don't have a good replacement to suggest, other than to
split the code into two functions, one behaving as a normal boolean
minor mode and the other accepting the extra possible values. ]
Stefan
=== modified file 'lisp/emacs-lisp/easy-mmode.el'
--- lisp/emacs-lisp/easy-mmode.el 2012-02-25 05:53:29 +0000
+++ lisp/emacs-lisp/easy-mmode.el 2012-04-14 12:41:01 +0000
@@ -260,7 +260,7 @@
;; repeat-command still does the toggling correctly.
(interactive (list (or current-prefix-arg 'toggle)))
(let ((,last-message (current-message)))
- (,@(if setter (list setter)
+ (,@(if setter `(funcall #',setter)
(list (if (symbolp mode) 'setq 'setf) mode))
(if (eq arg 'toggle)
(not ,mode)
next prev parent reply other threads:[~2012-04-14 12:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-14 1:26 bug#11241: 24.1.50; emacs-lock is ill uncompiled (lexical binding problem?) Michael Heerdegen
2012-04-14 2:06 ` Juanma Barranquero
2012-04-14 12:47 ` Stefan Monnier [this message]
2012-04-14 13:31 ` Juanma Barranquero
2012-04-14 13:35 ` Juanma Barranquero
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=jwvy5pyzfb1.fsf-monnier+INBOX@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=11241@debbugs.gnu.org \
--cc=lekktu@gmail.com \
--cc=michael_heerdegen@web.de \
/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.