unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
To: Juanma Barranquero <lekktu@gmail.com>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>,
	Emacs Devel <emacs-devel@gnu.org>
Subject: Re: Using `call-process-shell-command' in `process-lines'
Date: Mon, 26 Nov 2007 20:58:55 +0100	[thread overview]
Message-ID: <474B257F.3050709@gmail.com> (raw)
In-Reply-To: <f7ccd24b0711260959w7f3457a4ocb57ae28598d72c3@mail.gmail.com>

Juanma Barranquero wrote:
> On Nov 26, 2007 6:28 PM, Lennart Borgman (gmail)
> <lennart.borgman@gmail.com> wrote:
> 
>> Doesn't it look like arg passing in find.exe is a bit strange?
> 
> I think "yes" is the only sensible answer...


A summary using gnuwin32 find.exe:

- This gives the error "paths must precede expressions"

   (apply #'call-process "find.exe" nil
          (get-buffer-create "output")
          nil
          '("c:/emacs-lisp/old/" "-name" "*.el" ))

- The same for this in cmd.exe

   find -name *.el


- These two works:

   (apply #'call-process "find.exe" nil
          (get-buffer-create "output")
          nil
          '("c:/emacs-lisp/old/" "-name" "*l.el" ))

   (apply #'call-process "find.exe" nil
          (get-buffer-create "output")
          nil
          '("c:/emacs-lisp/old/" "-name" "m*.el" ))


- and these works in cmd.exe:

   find -name *l.el
   find -name m*.el
   find -name "*.el"

The arg parsing loop in find looks like this (though I do not know if it 
matters here):

   parse_open (argv, &argc);
   /* Build the input order list. */
   while (i < argc)
     {
       if (strchr ("-!(),", argv[i][0]) == NULL)
	usage (_("paths must precede expression"));
       predicate_name = argv[i];
       parse_function = find_parser (predicate_name);
       if (parse_function == NULL)
	/* Command line option not recognized */
	error (1, 0, _("invalid predicate `%s'"), predicate_name);
       i++;
       if (!(*parse_function) (argv, &i))
	{
	  if (argv[i] == NULL)
	    /* Command line option requires an argument */
	    error (1, 0, _("missing argument to `%s'"), predicate_name);
	  else
	    error (1, 0, _("invalid argument `%s' to `%s'"),
		   argv[i], predicate_name);
	}
     }

Trying to understand what parse_function does is beyond my time table 
;-) -- However from the loop above one can see that somehow 
parse_function seems to make a bad guess, but strangely enough not if 
the argument *.el is enclosed like "*.el" when it is called from the 
cmd.exe shell.

Is anyone able to understand what is going on?

  reply	other threads:[~2007-11-26 19:58 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-26 14:11 Using `call-process-shell-command' in `process-lines' Juanma Barranquero
2007-11-26 15:35 ` Stefan Monnier
2007-11-26 16:01   ` Juanma Barranquero
2007-11-26 16:43     ` Stefan Monnier
2007-11-26 17:01       ` Juanma Barranquero
2007-11-26 17:28         ` Lennart Borgman (gmail)
2007-11-26 17:59           ` Juanma Barranquero
2007-11-26 19:58             ` Lennart Borgman (gmail) [this message]
2007-11-26 20:50               ` Eli Zaretskii
2007-11-26 21:25                 ` Lennart Borgman (gmail)
2007-11-26 22:04                   ` Eli Zaretskii
2007-11-26 22:16                     ` Lennart Borgman (gmail)
2007-11-26 22:22                       ` Eli Zaretskii
2007-11-26 22:39                         ` Lennart Borgman (gmail)
2007-11-27  4:08                           ` Eli Zaretskii
2007-11-27 22:34                             ` Lennart Borgman (gmail)
2007-11-26 22:17                     ` Eli Zaretskii
2007-11-26 22:35                       ` Lennart Borgman (gmail)
2007-11-26 20:38           ` Eli Zaretskii
2007-11-26 20:23         ` Eli Zaretskii
2007-11-26 20:30           ` Eli Zaretskii
2007-11-26 20:31           ` Lennart Borgman (gmail)
2007-11-26 20:51             ` Eli Zaretskii
2007-11-26 21:08               ` Lennart Borgman (gmail)
2007-11-26 21:18                 ` Eli Zaretskii
2007-11-26 21:23                   ` Lennart Borgman (gmail)
2007-11-26 21:49                     ` Eli Zaretskii
2007-11-26 22:17                       ` Jason Rumney
2007-11-26 22:29                         ` Eli Zaretskii
2007-11-26 22:30                         ` Jason Rumney
2007-11-27  0:24                           ` Juanma Barranquero
2007-11-26 22:33                         ` Eli Zaretskii
2007-11-26 23:01                           ` Jason Rumney
2007-11-27  4:13                             ` Eli Zaretskii
2007-11-26 20:35           ` Stefan Monnier
2007-11-26 20:59             ` Eli Zaretskii
2007-11-26 21:18               ` Lennart Borgman (gmail)
2007-11-26 16:04   ` Juanma Barranquero

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=474B257F.3050709@gmail.com \
    --to=lennart.borgman@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=lekktu@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    /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).