From: stephen_leake@stephe-leake.org
To: 21185@debbugs.gnu.org
Subject: bug#21185: 25.0.50; byte-compiler warn on quote lexical var
Date: Tue, 04 Aug 2015 04:17:21 -0500 [thread overview]
Message-ID: <86y4hre7ku.fsf@stephe-leake.org> (raw)
This file gives an example where a new byte-compiler warning would be
useful:
;; quote-lexical-var.el -*- lexical-binding: t -*-
(defun display-var (var)
"Display variable value of VAR (a symbol), if any."
(cond
((boundp var)
(message "%s: %s" (symbol-name var) (symbol-value var)))
(t
(message "%s not bound" (symbol-name var)))))
(defun quote-lexical-var ()
(let ((my-var "foo"))
(message "non-quoted my-var: %s" my-var)
(display-var 'my-var)))
(provide 'quote-lexical-var)
;; end of file
To see the problem, execute (in emacs master, -Q):
(add-to-list 'load-path "/home/stephe/Elisp_Work/")
;; path containing above file
(byte-compile-file "/home/stephe/Elisp_Work/quote-lexical-var.el")
(require 'quote-lexical-var)
(display-var 'default-directory)
This gives "default-directory: /home/stephe" as expected.
(quote-lexical-var)
This gives:
non-quoted my-var: foo
my-var: not bound
Quoting lexical variables does not work; there is no symbol available at
run-time.
I've been bitten by this problem when converting code to use lexical
binding; it would be helpful if the byte-compiler warned about it.
In GNU Emacs 25.0.50.4 (x86_64-w64-mingw32)
of 2015-08-02 on TAKVER2
Repository revision: d2c4309d46529bac656f332677d2c5e199577845
Windowing system distributor `Microsoft Corp.', version 6.3.9600
Configured using:
`configure --prefix=/mingw64
PKG_CONFIG_PATH=/mingw64/lib/pkgconfig:/mingw64/share/pkgconfig'
Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB
TOOLKIT_SCROLL_BARS
Important settings:
value of $LANG: en_US.UTF-8
locale-coding-system: cp1252
Major mode: Lisp Interaction
Minor modes in effect:
tooltip-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Load-path shadows:
None found.
Features:
(shadow sort gnus-util mail-extr emacsbug message dired format-spec
rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util help-fns help-mode easymenu cl-loaddefs pcase cl-lib mail-prsvr
mail-utils time-date mule-util tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel dos-w32 ls-lisp disp-table
w32-win w32-vars term/common-win tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register
page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese charscript case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote w32notify w32 multi-tty
make-network-process emacs)
Memory information:
((conses 16 82209 4908)
(symbols 56 18803 0)
(miscs 48 36 106)
(strings 32 14166 4682)
(string-bytes 1 381142)
(vectors 16 10489)
(vector-slots 8 395072 6302)
(floats 8 121 16)
(intervals 56 221 2)
(buffers 976 11))
next reply other threads:[~2015-08-04 9:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-04 9:17 stephen_leake [this message]
2015-08-06 3:28 ` bug#21185: 25.0.50; byte-compiler warn on quote lexical var Stefan Monnier
2015-08-06 7:15 ` Stephen Leake
2021-07-08 14:12 ` Lars Ingebrigtsen
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=86y4hre7ku.fsf@stephe-leake.org \
--to=stephen_leake@stephe-leake.org \
--cc=21185@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.