X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/eada086196ccb005ded188ac2e58d41f3682a125..6b3770fb9dd180abbda32383eba5e961e76d7504:/lisp/emacs-lisp/gv.el diff --git a/lisp/emacs-lisp/gv.el b/lisp/emacs-lisp/gv.el index d1f997c99c..3dd021f9e7 100644 --- a/lisp/emacs-lisp/gv.el +++ b/lisp/emacs-lisp/gv.el @@ -1,22 +1,25 @@ -;;; gv.el --- Generalized variables -*- lexical-binding: t -*- +;;; gv.el --- generalized variables -*- lexical-binding: t -*- ;; Copyright (C) 2012 Free Software Foundation, Inc. ;; Author: Stefan Monnier ;; Keywords: extensions +;; Package: emacs -;; This program is free software; you can redistribute it and/or modify +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. -;; This program is distributed in the hope that it will be useful, +;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . +;; along with GNU Emacs. If not, see . ;;; Commentary: @@ -191,8 +194,9 @@ well for simple place forms. Assignments of VAL to (NAME ARGS...) are expanded by binding the argument forms (VAL ARGS...) according to ARGLIST, then executing BODY, which must return a Lisp form that does the assignment. -Actually, ARGLIST may be bound to temporary variables which are introduced -automatically to preserve proper execution order of the arguments. Example: +The first arg in ARGLIST (the one that receives VAL) receives an expression +which can do arbitrary things, whereas the other arguments are all guaranteed +to be pure and copyable. Example use: (gv-define-setter aref (v a i) `(aset ,a ,i ,v))" (declare (indent 2) (debug (&define name sexp body))) `(gv-define-expander ,name @@ -265,7 +269,7 @@ The return value is the last VAL in the list. ;;;###autoload (put 'gv-place 'edebug-form-spec 'edebug-match-form) ;; CL did the equivalent of: -;;(gv-define-expand edebug-after (lambda (before index place) place)) +;;(gv-define-macroexpand edebug-after (lambda (before index place) place)) (put 'edebug-after 'gv-expander (lambda (do before index place) @@ -354,7 +358,8 @@ The return value is the last VAL in the list. (put 'if 'gv-expander (lambda (do test then &rest else) - (if (macroexp-small-p (funcall do 'dummy (lambda (_) 'dummy))) + (if (or (not lexical-binding) ;The other code requires lexical-binding. + (macroexp-small-p (funcall do 'dummy (lambda (_) 'dummy)))) ;; This duplicates the `do' code, which is a problem if that ;; code is large, but otherwise results in more efficient code. `(if ,test ,(gv-get then do) @@ -372,7 +377,8 @@ The return value is the last VAL in the list. (put 'cond 'gv-expander (lambda (do &rest branches) - (if (macroexp-small-p (funcall do 'dummy (lambda (_) 'dummy))) + (if (or (not lexical-binding) ;The other code requires lexical-binding. + (macroexp-small-p (funcall do 'dummy (lambda (_) 'dummy)))) ;; This duplicates the `do' code, which is a problem if that ;; code is large, but otherwise results in more efficient code. `(cond