<[email protected]> writes: >> Then, I should be wrong thinking that let-binding override buffer-local >> value. >> buffer-locals + let is tricky. > > It's the other way around. > > In a fresh buffer, (for convenience in Lisp mode), eval those two in sequence: > > (set (make-local-variable 'foo) 23) > > (let ((foo 42)) > (message (format "foo is: %S, its buffer-local value is %S" > foo > (buffer-local-value 'foo (current-buffer))))) > > => foo is: 42, its buffer-local value is 42 > > Let bindings shadow buffer-local ones.
Yes and no. (defvar-local yant/test 1) yant/test ; => 1 (set 'yant/test 23) yant/test ; => 23 (let ((yant/foo 42)) (buffer-local-value 'yant/test (current-buffer))) ; => 23 (let ((yant/foo 42)) (with-temp-buffer (buffer-local-value 'yant/test (current-buffer)))) ; => 1 In a freshly created buffer, if the buffer is created _inside_ let-binding, the let override does not hold and default value is assigned instead. It is complicated... -- Ihor Radchenko // yantar92, Org mode maintainer, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>
