bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#21185: 25.0.50; byte-compiler warn on quote lexical var


From: stephen_leake
Subject: bug#21185: 25.0.50; byte-compiler warn on quote lexical var
Date: Tue, 04 Aug 2015 04:17:21 -0500

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))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]