emacs-devel
[Top][All Lists]
Advanced

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

Re: defvar inside let-binding


From: Lars Magne Ingebrigtsen
Subject: Re: defvar inside let-binding
Date: Tue, 02 Aug 2011 21:56:45 +0200
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

> Yes.  Tho the "next" step you suggested (to cause defvar to change the
> outer let-binding) will require another such function and will make
> symbol-let-bound-p unneeded.

Let's see...

  ;; Use defvar to set the docstring as well as the special-variable-p flag.
  ;; FIXME: We should reproduce more of `defvar's behavior, such as the warning
  ;; when the var is currently let-bound.
  (if (not (default-boundp symbol))
      ;; Don't use defvar to avoid setting a default-value when undesired.
      (when doc (put symbol 'variable-documentation doc))
    (eval `(defvar ,symbol nil ,@(when doc (list doc)))))

So what I would do here now would be to add

(when (symbol-let-bound-p symbol)
  (message "Warning: let-bound etc"))

now, and in Emacs 24.2, I'd change that to

(when (symbol-let-bound-p symbol)
  (change-outer-let-binding symbol default))

Or something along those lines?  

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/



reply via email to

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