Commit 7133f262 authored by Stefan Monnier's avatar Stefan Monnier
Browse files

* lisp/progmodes/gud.el: Use lexical-binding.

Fixes: debbugs:19966

* lisp/emacs-lisp/gv.el (gv-ref): Warn about likely problematic cases.
parent cecf4afe
2015-03-03 Stefan Monnier <monnier@iro.umontreal.ca>
* progmodes/gud.el: Use lexical-binding (bug#19966).
* emacs-lisp/gv.el (gv-ref): Warn about likely problematic cases.
2015-03-03 Daniel Colascione <dancol@dancol.org> 2015-03-03 Daniel Colascione <dancol@dancol.org>
   
* emacs-lisp/generator.el: Make globals conform to elisp * emacs-lisp/generator.el: Make globals conform to elisp
...@@ -6,8 +12,8 @@ ...@@ -6,8 +12,8 @@
`cps-disable-atomic-optimization'. `cps-disable-atomic-optimization'.
(cps--gensym): New macro; replaces `cl-gensym' throughout. (cps--gensym): New macro; replaces `cl-gensym' throughout.
(cps-generate-evaluator): Move the `iter-yield' local macro (cps-generate-evaluator): Move the `iter-yield' local macro
definition here definition here...
(iter-defun, iter-lambda): from here. (iter-defun, iter-lambda): ...from here.
   
2015-03-03 Artur Malabarba <bruce.connor.am@gmail.com> 2015-03-03 Artur Malabarba <bruce.connor.am@gmail.com>
   
......
...@@ -493,9 +493,20 @@ This is like the `&' operator of the C language. ...@@ -493,9 +493,20 @@ This is like the `&' operator of the C language.
Note: this only works reliably with lexical binding mode, except for very Note: this only works reliably with lexical binding mode, except for very
simple PLACEs such as (function-symbol 'foo) which will also work in dynamic simple PLACEs such as (function-symbol 'foo) which will also work in dynamic
binding mode." binding mode."
(gv-letplace (getter setter) place (let ((code
`(cons (lambda () ,getter) (gv-letplace (getter setter) place
(lambda (gv--val) ,(funcall setter 'gv--val))))) `(cons (lambda () ,getter)
(lambda (gv--val) ,(funcall setter 'gv--val))))))
(if (or lexical-binding
;; If `code' still starts with `cons' then presumably gv-letplace
;; did not add any new let-bindings, so the `lambda's don't capture
;; any new variables. As a consequence, the code probably works in
;; dynamic binding mode as well.
(eq (car-safe code) 'cons))
code
(macroexp--warn-and-return
"Use of gv-ref probably requires lexical-binding"
code))))
(defsubst gv-deref (ref) (defsubst gv-deref (ref)
"Dereference REF, returning the referenced value. "Dereference REF, returning the referenced value.
......
;;; gud.el --- Grand Unified Debugger mode for running GDB and other debuggers ;;; gud.el --- Grand Unified Debugger mode for running GDB and other debuggers -*- lexical-binding:t -*-
;; Copyright (C) 1992-1996, 1998, 2000-2015 Free Software Foundation, ;; Copyright (C) 1992-1996, 1998, 2000-2015 Free Software Foundation,
;; Inc. ;; Inc.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment