bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#26624: 26.0.50; Generalized variable `buffer-local-value' does't res


From: Philipp Stephani
Subject: bug#26624: 26.0.50; Generalized variable `buffer-local-value' does't restore local flag
Date: Sat, 17 Jun 2017 13:10:20 +0000



Philipp Stephani <p.stephani2@gmail.com> schrieb am So., 23. Apr. 2017 um 19:14 Uhr:

In *scratch*, evaluate:

(defvar foo-test-var nil)
(with-temp-buffer
  (list (list (buffer-local-value 'foo-test-var (current-buffer))
              (local-variable-p 'foo-test-var)
              (local-variable-if-set-p 'foo-test-var))
        (cl-letf (((buffer-local-value 'foo-test-var (current-buffer)) 123))
          (list (buffer-local-value 'foo-test-var (current-buffer))
                (local-variable-p 'foo-test-var)
                (local-variable-if-set-p 'foo-test-var)))
        (list (buffer-local-value 'foo-test-var (current-buffer))
              (local-variable-p 'foo-test-var)
              (local-variable-if-set-p 'foo-test-var))))

The result is:

((nil nil nil) (123 t t) (nil t t))

But expected is:

((nil nil nil) (123 t t) (nil nil nil))

i.e. the local flag of the variable should be reset.


It's possible to fix this (see attached patch), but at the expense of breaking other valid use cases such as (cl-incf (buffer-local-value ...)). Not sure whether the bug can be fixed at all without breaking other stuff. 

Attachment: 0001-Have-cl-letf-restore-buffer-local-status-Bug-26624.txt
Description: Text document


reply via email to

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