Subject: Re: bug#1013: 23.0.60; permanent-local not honored for word-wrap

From: "Lennart Borgman (gmail)" <[email-masked]>
Date: Mon, 22 Sep 2008 08:42:54 +0200

Stefan Monnier wrote:
>>   (put 'word-wrap 'permanent-local t)
>>   (setq word-wrap t)
>>   (kill-all-local-variables)
> 
>> and then look at word-wrap. It is nil, but it should be t.
> 
> Why should it?  word-wrap is automatically made local, so the `setq' is
> really like (set (make-local-variable 'word-wrap) t), thus not changing
> the global value at which is you'll be looking in the end.

Is there something I am missing? The three variables below are all
automatically buffer local, they are all three `permanent-local, but
only `word-wrap' looses it buffer local value? (Only the last test below
fails.)

>From (info "(elisp) Creating Buffer-Local"):

   A buffer-local variable is "permanent" if the variable name (a
   symbol) has a `permanent-local' property that is non-`nil'.

==== Here is the test file again ===
;; Setup
(defvar word-wrap2 nil)
(make-variable-buffer-local 'word-wrap2)
(set-default 'word-wrap2 nil)

(defcustom word-wrap3 nil
  "doc 3"
  :type 'boolean)
(make-variable-buffer-local 'word-wrap3)
(set-default 'word-wrap3 nil)

(set-default 'word-wrap nil)

(put 'word-wrap  'permanent-local t)
(put 'word-wrap2 'permanent-local t)
(put 'word-wrap3 'permanent-local t)

(setq word-wrap t)
(setq word-wrap2 t)
(setq word-wrap3 t)

(kill-all-local-variables)

;; Test
(ert-should (eq (default-value 'word-wrap3) nil))
(ert-should (eq word-wrap3 t))
(ert-should (eq (default-value 'word-wrap2) nil))
(ert-should (eq word-wrap2 t))
(ert-should (eq (default-value 'word-wrap) nil))
(ert-should (eq word-wrap t))