[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#14710: add-file-local-variable vs. unquoted string
From: |
Juri Linkov |
Subject: |
bug#14710: add-file-local-variable vs. unquoted string |
Date: |
Tue, 25 Jun 2013 23:18:23 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) |
> Good point. I fixed it with the patch below, which uses
> read-from-minibuffer (with a non-nil `read' argument) instead of
> read-string, so it re-uses the check that was already used when reading
> an Elisp expression.
FWIW, when I wrote `read-file-local-variable-value' I copied its code:
(read (read-string (format "Add %s with value (use quotes for strings): "
variable)
nil 'set-variable-value-history
(format "%S" ...
from `set-variable':
(read
(read-string prompt nil
'set-variable-value-history
(format "%S" ...
So `set-variable' seems to have the same problem, although
after entering a string without quotes with e.g.
`M-x set-variable RET compile-command RET a b c RET'
it checks `custom-type' of the entered value and reports the
error "Value `a' does not match type string of compile-command".
Perhaps this is not too problematic as long as `set-variable' is used
only for customizable options, and not for ordinary variables.