[Top][All Lists]

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

bug#14710: add-file-local-variable vs. unquoted string

From: Stefan Monnier
Subject: bug#14710: add-file-local-variable vs. unquoted string
Date: Tue, 25 Jun 2013 09:06:52 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> Try
> M-x add-file-local-variable
> compile-command
> a b c

> Note how b c are thrown away.
> Yes the user should have typed "a b c",
> but still some warning should be printed upon throwing them away.

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.


=== modified file 'lisp/files-x.el'
--- lisp/files-x.el     2013-06-18 20:38:43 +0000
+++ lisp/files-x.el     2013-06-25 12:59:31 +0000
@@ -71,12 +69,14 @@
         (format "Add %s with value: " variable))
-      (read (read-string (format "Add %s with value: " variable)
-                        nil 'set-variable-value-history
-                        (format "%S"
+    (let ((default (format "%S"
                                 (cond ((eq variable 'unibyte) t)
                                       ((boundp variable)
-                                       (symbol-value variable))))))))))
+                                  (symbol-value variable)))))
+          (minibuffer-completing-symbol t))
+      (read-from-minibuffer (format "Add %s with value: " variable)
+                            nil read-expression-map t
+                            'set-variable-value-history)))))
 (defun read-file-local-variable-mode ()
   "Read per-directory file-local variable's mode using completion.

reply via email to

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