[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#16728: 24.3.50; bug? (with-temp-buffer (insert "foo")) deactivates m
From: |
Stefan Monnier |
Subject: |
bug#16728: 24.3.50; bug? (with-temp-buffer (insert "foo")) deactivates mark in current buffer |
Date: |
Fri, 14 Feb 2014 12:21:27 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
> (list (with-temp-buffer
> (set (make-local-variable 'deactivate-mark) nil)
> (insert "foo")
> (let (deactivate-mark)
> (with-temp-buffer
> (insert "bar"))))
> deactivate-mark)
The `let' above dynamically binds the `deactivate-mark' of the first
temp-buffer. The (insert "bar") then set the deactivate-mark in the
second temp-buffer, which did not make it buffer-local, so it really
sets the global deactivate-mark. Try:
(with-temp-buffer
(let ((a 3)
(buf (current-buffer)))
(make-local-variable 'a)
(let ((a 4))
(with-temp-buffer
(message "a=%S but a=%S" (list a (local-variable-p 'a))
(with-current-buffer buf
(list a (local-variable-p 'a))))))))
Interaction between let-bindings and buffer-local bindings is tricky.
Stefan