all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Get a list with edit-and-eval-command
       [not found] <9601423a-874e-4e7e-a2d7-a90c5ea80503@zimbra62-e11.priv.proxad.net>
@ 2012-02-12 16:25 ` david.chappaz
  2012-02-14  4:08   ` Kevin Rodgers
  0 siblings, 1 reply; 2+ messages in thread
From: david.chappaz @ 2012-02-12 16:25 UTC (permalink / raw
  To: help-gnu-emacs

Hi all,

I'm trying to get an elisp object (more specifically a list) from the minibuffer, using the function edit-and-eval-command, as documented in
http://www.gnu.org/software/emacs/manual/html_mono/elisp.html#Object-from-Minibuffer

For example say I first evaluate:
(setq wildcard '("*.c" "*.h" "*.v"))

Next I am trying to do something like:
(setq newwildcard (edit-and-eval-command  "Enter an expression: " (format "%s" wildcard))

but it does not achieves what I really want, which is to provide as initial argument a valid lisp list [e.g. '("*.c" "*.h" "*.v")] so no error is generated if the user simply hits [Enter]. The above generates double quotes and misses the single quote, which causes the problem.

Can anyone give me some insight to do this properly ?

Many thanks,
David.



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Get a list with edit-and-eval-command
  2012-02-12 16:25 ` Get a list with edit-and-eval-command david.chappaz
@ 2012-02-14  4:08   ` Kevin Rodgers
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Rodgers @ 2012-02-14  4:08 UTC (permalink / raw
  To: help-gnu-emacs

On 2/12/12 9:25 AM, david.chappaz@free.fr wrote:
> Hi all,
>
> I'm trying to get an elisp object (more specifically a list) from the minibuffer, using the function edit-and-eval-command, as documented in
> http://www.gnu.org/software/emacs/manual/html_mono/elisp.html#Object-from-Minibuffer
>
> For example say I first evaluate:
> (setq wildcard '("*.c" "*.h" "*.v"))
>
> Next I am trying to do something like:
> (setq newwildcard (edit-and-eval-command  "Enter an expression: " (format "%s" wildcard))
>
> but it does not achieves what I really want, which is to provide as initial argument a valid lisp list [e.g. '("*.c" "*.h" "*.v")] so no error is generated if the user simply hits [Enter]. The above generates double quotes and misses the single quote, which causes the problem.
>
> Can anyone give me some insight to do this properly ?

Do not pass a string as the COMMAND argument to edit-and-eval-command.

(edit-and-eval-command "Edit and eval: " '(quote ("*.c" "*.h" "*.v")))

or equivalently

(edit-and-eval-command "Edit and eval: " (quote '("*.c" "*.h" "*.v")))

-- 
Kevin Rodgers
Denver, Colorado, USA




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-02-14  4:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <9601423a-874e-4e7e-a2d7-a90c5ea80503@zimbra62-e11.priv.proxad.net>
2012-02-12 16:25 ` Get a list with edit-and-eval-command david.chappaz
2012-02-14  4:08   ` Kevin Rodgers

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.