[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: default-toplevel-value and set-default-toplevel-value
From: |
Stefan Monnier |
Subject: |
Re: default-toplevel-value and set-default-toplevel-value |
Date: |
Mon, 26 Dec 2016 11:45:55 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) |
> Yes, because there doesn't seem to be any need for using it, as
> default-value is unaffected by the let-binding.
That's because the let-binding was in a buffer which had a buffer-local
value, so the let-binding only affects the buffer-local value.
(defun get-A ()
(with-current-buffer "A" myvar))
(defun get-B ()
(with-current-buffer "B" myvar))
(defun get-test ()
(setq myvar 'global)
(with-current-buffer (get-buffer-create "A")
(setq-local myvar 'local-A))
(with-current-buffer (get-buffer-create "B")
(setq-local myvar 'local-B))
(list (list (get-A) (get-B) (default-value 'myvar))
(with-current-buffer "*scratch*"
(let ((myvar 'let-bound))
(list (get-A) (get-B) (default-value 'myvar))))
(with-current-buffer "A"
(let ((myvar 'let-bound))
(list (get-A) (get-B) (default-value 'myvar))))
(with-current-buffer "B"
(let ((myvar 'let-bound))
(list (get-A) (get-B) (default-value 'myvar))))))
-- Stefan