unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: jidanni@jidanni.org
Cc: 14710-done@debbugs.gnu.org
Subject: bug#14710: add-file-local-variable vs. unquoted string
Date: Tue, 25 Jun 2013 09:06:52 -0400	[thread overview]
Message-ID: <jwvhagmbaza.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <877ghjl0xm.fsf@jidanni.org> (jidanni@jidanni.org's message of "Tue, 25 Jun 2013 04:16:05 +0800")

> 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.


        Stefan


=== 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))
        default))
      (t
-      (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.






  parent reply	other threads:[~2013-06-25 13:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-24 20:16 bug#14710: add-file-local-variable vs. unquoted string jidanni
2013-06-24 23:40 ` Juri Linkov
2013-06-24 23:56   ` Glenn Morris
2013-06-25  6:10     ` Juri Linkov
2013-06-25  6:56       ` martin rudalics
2013-06-25  7:42       ` Andreas Schwab
2013-06-25 13:06 ` Stefan Monnier [this message]
2013-06-25 20:18   ` Juri Linkov
2013-06-26  0:51     ` Stefan Monnier
2013-06-25 13:56 ` jidanni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvhagmbaza.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=14710-done@debbugs.gnu.org \
    --cc=jidanni@jidanni.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).