all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: Reading in a variable list of strings
  2005-03-14 12:40 Reading in a variable list of strings Florian von Savigny
@ 2005-03-14 12:21 ` Mathias Dahl
  2005-03-14 15:37   ` Florian von Savigny
  0 siblings, 1 reply; 3+ messages in thread
From: Mathias Dahl @ 2005-03-14 12:21 UTC (permalink / raw)


Florian von Savigny <sawitzky2000@yahoo.de> writes:

> I am writing (better, trying to write) a function the core of which
> is call-process. The problem is that I would like to be able to
> supply a variable number of arguments to the process called, by user
> input.
>
> I have no clear idea of how to read in an unknown-length list of
> strings. It must be something with (while ...) and (read-string
> ...), but (while what?), i. e. how can the user say he's done now?
>
> For the moment, I am reading in just one string and splitting it at
> spaces, but this is quick and dirty at best.

How about something like this:

 (while (not (string-equal ""
     (setq test 
        (read-string "Enter string. and press enter. (When ready, just input an empty string: ")))))

The prompt could be better, but you should get the picture.

/Mathias

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

* Reading in a variable list of strings
@ 2005-03-14 12:40 Florian von Savigny
  2005-03-14 12:21 ` Mathias Dahl
  0 siblings, 1 reply; 3+ messages in thread
From: Florian von Savigny @ 2005-03-14 12:40 UTC (permalink / raw)




Hi there,

I am running into problems whatever I try:

I am writing (better, trying to write) a function the core of which is
call-process. The problem is that I would like to be able to supply a
variable number of arguments to the process called, by user
input.

I have no clear idea of how to read in an unknown-length list of
strings. It must be something with (while ...) and (read-string ...),
but (while what?), i. e. how can the user say he's done now?

For the moment, I am reading in just one string and splitting it at
spaces, but this is quick and dirty at best.

Any hints greatly appreciated!


-- 


Florian v. Savigny

If you are going to reply in private, please be patient, as I only
check for mail something like once a week. - Si vous allez répondre
personellement, patientez s.v.p., car je ne lis les courriels
qu'environ une fois par semaine.

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

* Re: Reading in a variable list of strings
  2005-03-14 12:21 ` Mathias Dahl
@ 2005-03-14 15:37   ` Florian von Savigny
  0 siblings, 0 replies; 3+ messages in thread
From: Florian von Savigny @ 2005-03-14 15:37 UTC (permalink / raw)



Mathias Dahl <brakjoller@gmail.com> writes:

> How about something like this:
> 
>  (while (not (string-equal ""
>      (setq test 
>         (read-string "Enter string. and press enter. (When ready, just input an empty string: ")))))


Just great, thanks. I wasn't aware that the \n character (that would
be part of the input in a Perl script, for example) is automatically
stripped off by Elisp, and it also didn't occur to me that you can
simply test the return value of an assignment like that. I guess it
was a case of "den Wald vor lauter Bäumen nicht sehen" ...

Thanks a lot!


-- 


Florian v. Savigny

If you are going to reply in private, please be patient, as I only
check for mail something like once a week. - Si vous allez répondre
personellement, patientez s.v.p., car je ne lis les courriels
qu'environ une fois par semaine.

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

end of thread, other threads:[~2005-03-14 15:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-14 12:40 Reading in a variable list of strings Florian von Savigny
2005-03-14 12:21 ` Mathias Dahl
2005-03-14 15:37   ` Florian von Savigny

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.