Subject: Re: bug#4664: 23.1.50; local variables completions

From: Juri Linkov <[email-masked]>
Date: Thu, 08 Oct 2009 12:22:43 +0300

>>> Thanks, this also added usually unbound symbols
>>> like `generated-autoload-file'.
>>
>> Is that a problem?

No, no.  Some time ago I noticed that there are some unbound symbols
valid for inclusion to the Local Variables section but unavailable
for completion.  So far I had no idea about the correct way
to add them.  Your change fixed that.

> When trying to add generated-autoload-file it produces an error. So I
> wonder if the following is more suitable?
>
> (or (user-variable-sym)
>     (and (boundp sym) (get sym 'safe-local-variable))
>     (memq sym '(mode eval coding unibyte)))

This is a wrong fix.  It again removes valid local variables like
`generated-autoload-file' from completion.  The right fix would be
just to avoid trying to provide their current value as the default
value:

Index: lisp/files-x.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/files-x.el,v
retrieving revision 1.4
diff -c -r1.4 files-x.el
*** lisp/files-x.el	7 Oct 2009 14:33:37 -0000	1.4
--- lisp/files-x.el	8 Oct 2009 09:21:22 -0000
***************
*** 92,98 ****
  			 nil 'set-variable-value-history
  			 (format "%S"
  				 (cond ((eq variable 'unibyte) t)
! 				       (t (symbol-value variable))))))))))
  
  (defun read-file-local-variable-mode ()
    "Read per-directory file-local variable's mode using completion.
--- 92,99 ----
  			 nil 'set-variable-value-history
  			 (format "%S"
  				 (cond ((eq variable 'unibyte) t)
! 				       ((boundp variable)
! 					(symbol-value variable))))))))))
  
  (defun read-file-local-variable-mode ()
    "Read per-directory file-local variable's mode using completion.

-- 
Juri Linkov
http://www.jurta.org/emacs/