all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* start-process somehow expands *.org
@ 2011-03-01  2:07 Lennart Borgman
  2011-03-01  2:27 ` Glenn Morris
  0 siblings, 1 reply; 13+ messages in thread
From: Lennart Borgman @ 2011-03-01  2:07 UTC (permalink / raw)
  To: Emacs-Devel devel

I am calling start-process with one of the program-args beeing
"*.org". Somehow this is expanded to just the first of matching file.

What is happening? Is this the way it is supposed to work?



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

* Re: start-process somehow expands *.org
  2011-03-01  2:07 start-process somehow expands *.org Lennart Borgman
@ 2011-03-01  2:27 ` Glenn Morris
  2011-03-01  2:51   ` Lennart Borgman
  0 siblings, 1 reply; 13+ messages in thread
From: Glenn Morris @ 2011-03-01  2:27 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: Emacs developers


Lennart Borgman wrote (on Tue, 1 Mar 2011 at 03:07 +0100):

> I am calling start-process with one of the program-args beeing
> "*.org". Somehow this is expanded to just the first of matching file.
> 
> What is happening? Is this the way it is supposed to work?

Will you PLEASE learn to give complete examples, rather than always
this "I saw a thing; is it a problem?" kind of mail.

Maybe the following is relevant, how should I know what you doing.

Functions that Create Subprocesses

   All three of the subprocess-creating functions have a `&rest'
   argument, ARGS. The ARGS must all be strings, and they are supplied
   to PROGRAM as separate command line arguments. Wildcard characters
   and other shell constructs have no special meanings in these
   strings, since the strings are passed directly to the specified
   program.



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

* Re: start-process somehow expands *.org
  2011-03-01  2:27 ` Glenn Morris
@ 2011-03-01  2:51   ` Lennart Borgman
  2011-03-01  6:19     ` Thierry Volpiatto
  2011-03-01 15:14     ` Davis Herring
  0 siblings, 2 replies; 13+ messages in thread
From: Lennart Borgman @ 2011-03-01  2:51 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Emacs developers

On Tue, Mar 1, 2011 at 3:27 AM, Glenn Morris <rgm@gnu.org> wrote:
>
> Lennart Borgman wrote (on Tue, 1 Mar 2011 at 03:07 +0100):
>
>> I am calling start-process with one of the program-args beeing
>> "*.org". Somehow this is expanded to just the first of matching file.
>>
>> What is happening? Is this the way it is supposed to work?
>
> Will you PLEASE learn to give complete examples, rather than always
> this "I saw a thing; is it a problem?" kind of mail.

Sorry, I thought I was clear enough. start-process has a "&rest" arg
called "program-args".

> Maybe the following is relevant, how should I know what you doing.
>
> Functions that Create Subprocesses
>
>   All three of the subprocess-creating functions have a `&rest'
>   argument, ARGS. The ARGS must all be strings, and they are supplied
>   to PROGRAM as separate command line arguments. Wildcard characters
>   and other shell constructs have no special meanings in these
>   strings, since the strings are passed directly to the specified
>   program.

Yes, it might be relevant. However I do not understand what is happening.

I have something like this

   (setq command
      ("ruby.exe" "c:\\path-to\\idxsearch.rb" "--root"
"c:/where-to-search/" "--filepatt" "*.org" "--query" "word1,word2")

   (apply 'start-process (downcase mode-name) outbuf command)

It looks like idxsearch.rb recieves the first file matching *.org, in
my case "act.org" - instead of "*.org" as I expected.

It might be ruby.exe that expands *.org, but if I try a similar
command line ruby.exe does not expand *.org.

This is on w32, as usual with my patched version.



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

* Re: start-process somehow expands *.org
  2011-03-01  2:51   ` Lennart Borgman
@ 2011-03-01  6:19     ` Thierry Volpiatto
  2011-03-01 10:37       ` Lennart Borgman
  2011-03-01 15:14     ` Davis Herring
  1 sibling, 1 reply; 13+ messages in thread
From: Thierry Volpiatto @ 2011-03-01  6:19 UTC (permalink / raw)
  To: emacs-devel

Lennart Borgman <lennart.borgman@gmail.com> writes:

> On Tue, Mar 1, 2011 at 3:27 AM, Glenn Morris <rgm@gnu.org> wrote:
>>
>> Lennart Borgman wrote (on Tue, 1 Mar 2011 at 03:07 +0100):
>>
>>> I am calling start-process with one of the program-args beeing
>>> "*.org". Somehow this is expanded to just the first of matching file.
>>>
>>> What is happening? Is this the way it is supposed to work?
>>
>> Will you PLEASE learn to give complete examples, rather than always
>> this "I saw a thing; is it a problem?" kind of mail.
>
> Sorry, I thought I was clear enough. start-process has a "&rest" arg
> called "program-args".
>
>> Maybe the following is relevant, how should I know what you doing.
>>
>> Functions that Create Subprocesses
>>
>>   All three of the subprocess-creating functions have a `&rest'
>>   argument, ARGS. The ARGS must all be strings, and they are supplied
>>   to PROGRAM as separate command line arguments. Wildcard characters
>>   and other shell constructs have no special meanings in these
>>   strings, since the strings are passed directly to the specified
>>   program.
>
> Yes, it might be relevant. However I do not understand what is happening.
>
> I have something like this
>
>    (setq command
>       ("ruby.exe" "c:\\path-to\\idxsearch.rb" "--root"
> "c:/where-to-search/" "--filepatt" "*.org" "--query" "word1,word2")
>
>    (apply 'start-process (downcase mode-name) outbuf command)
>
> It looks like idxsearch.rb recieves the first file matching *.org, in
> my case "act.org" - instead of "*.org" as I expected.
>
> It might be ruby.exe that expands *.org, but if I try a similar
> command line ruby.exe does not expand *.org.
>
> This is on w32, as usual with my patched version.

Maybe use --filepatt as last arg and file-expand-wildcards on *.org.

(setq command "a b c d e --filepatt")
(apply 'start-process (downcase mode-name) outbuf command
   (file-expand-wildcards "*.org"))

Or even better use start-process-shell-command.

-- 
A+ Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 




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

* Re: start-process somehow expands *.org
  2011-03-01  6:19     ` Thierry Volpiatto
@ 2011-03-01 10:37       ` Lennart Borgman
  2011-03-01 10:46         ` Thierry Volpiatto
  0 siblings, 1 reply; 13+ messages in thread
From: Lennart Borgman @ 2011-03-01 10:37 UTC (permalink / raw)
  To: Thierry Volpiatto; +Cc: emacs-devel

On Tue, Mar 1, 2011 at 7:19 AM, Thierry Volpiatto
<thierry.volpiatto@gmail.com> wrote:
> Lennart Borgman <lennart.borgman@gmail.com> writes:
>
>> On Tue, Mar 1, 2011 at 3:27 AM, Glenn Morris <rgm@gnu.org> wrote:
>>>
>>> Lennart Borgman wrote (on Tue, 1 Mar 2011 at 03:07 +0100):
>>>
>>>> I am calling start-process with one of the program-args beeing
>>>> "*.org". Somehow this is expanded to just the first of matching file.
>>>>
>>>> What is happening? Is this the way it is supposed to work?
>>>
>>> Will you PLEASE learn to give complete examples, rather than always
>>> this "I saw a thing; is it a problem?" kind of mail.
>>
>> Sorry, I thought I was clear enough. start-process has a "&rest" arg
>> called "program-args".
>>
>>> Maybe the following is relevant, how should I know what you doing.
>>>
>>> Functions that Create Subprocesses
>>>
>>>   All three of the subprocess-creating functions have a `&rest'
>>>   argument, ARGS. The ARGS must all be strings, and they are supplied
>>>   to PROGRAM as separate command line arguments. Wildcard characters
>>>   and other shell constructs have no special meanings in these
>>>   strings, since the strings are passed directly to the specified
>>>   program.
>>
>> Yes, it might be relevant. However I do not understand what is happening.
>>
>> I have something like this
>>
>>    (setq command
>>       ("ruby.exe" "c:\\path-to\\idxsearch.rb" "--root"
>> "c:/where-to-search/" "--filepatt" "*.org" "--query" "word1,word2")
>>
>>    (apply 'start-process (downcase mode-name) outbuf command)
>>
>> It looks like idxsearch.rb recieves the first file matching *.org, in
>> my case "act.org" - instead of "*.org" as I expected.
>>
>> It might be ruby.exe that expands *.org, but if I try a similar
>> command line ruby.exe does not expand *.org.
>>
>> This is on w32, as usual with my patched version.
>
> Maybe use --filepatt as last arg and file-expand-wildcards on *.org.

*.org is the argument to --filepatt and it only takes one argument so
this can't be done.

> Or even better use start-process-shell-command.

That can't be used either because of other problems.



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

* Re: start-process somehow expands *.org
  2011-03-01 10:37       ` Lennart Borgman
@ 2011-03-01 10:46         ` Thierry Volpiatto
  2011-03-01 11:35           ` Lennart Borgman
  0 siblings, 1 reply; 13+ messages in thread
From: Thierry Volpiatto @ 2011-03-01 10:46 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: emacs-devel

Lennart Borgman <lennart.borgman@gmail.com> writes:

> *.org is the argument to --filepatt and it only takes one argument so
> this can't be done.
So maybe try:
(setq command '(arg1 arg2 arg3 etc...))
(apply 'start-process (downcase mode-name) outbuf "ruby.exe" command)


-- 
A+ Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 



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

* Re: start-process somehow expands *.org
  2011-03-01 10:46         ` Thierry Volpiatto
@ 2011-03-01 11:35           ` Lennart Borgman
  2011-03-01 13:04             ` Thierry Volpiatto
  0 siblings, 1 reply; 13+ messages in thread
From: Lennart Borgman @ 2011-03-01 11:35 UTC (permalink / raw)
  To: Thierry Volpiatto; +Cc: emacs-devel

On Tue, Mar 1, 2011 at 11:46 AM, Thierry Volpiatto
<thierry.volpiatto@gmail.com> wrote:
> Lennart Borgman <lennart.borgman@gmail.com> writes:
>
>> *.org is the argument to --filepatt and it only takes one argument so
>> this can't be done.
> So maybe try:
> (setq command '(arg1 arg2 arg3 etc...))
> (apply 'start-process (downcase mode-name) outbuf "ruby.exe" command)

Is not that exactly the same?



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

* Re: start-process somehow expands *.org
  2011-03-01 11:35           ` Lennart Borgman
@ 2011-03-01 13:04             ` Thierry Volpiatto
  2011-03-01 13:14               ` Lennart Borgman
  0 siblings, 1 reply; 13+ messages in thread
From: Thierry Volpiatto @ 2011-03-01 13:04 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: emacs-devel

Lennart Borgman <lennart.borgman@gmail.com> writes:

> On Tue, Mar 1, 2011 at 11:46 AM, Thierry Volpiatto
> <thierry.volpiatto@gmail.com> wrote:
>> Lennart Borgman <lennart.borgman@gmail.com> writes:
>>
>>> *.org is the argument to --filepatt and it only takes one argument so
>>> this can't be done.
>> So maybe try:
>> (setq command '(arg1 arg2 arg3 etc...))
>> (apply 'start-process (downcase mode-name) outbuf "ruby.exe" command)
>
> Is not that exactly the same?
No, but anyway, in this case it won't work because wilcards syntax is
recognized only inside a shell, so i am afraid you
will have to use start-process-shell-command who understand *.ext.

From same directory with file1.el and file2.el:

(apply 'start-process "test1" "*Test1*" "echo" (list "-n" "*.el"))
==> *.el

(start-process-shell-command "test1" "*Test1*" "echo -n *.el")
==> file1.el file2.el

-- 
A+ Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 



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

* Re: start-process somehow expands *.org
  2011-03-01 13:04             ` Thierry Volpiatto
@ 2011-03-01 13:14               ` Lennart Borgman
  2011-03-01 18:12                 ` Thierry Volpiatto
  0 siblings, 1 reply; 13+ messages in thread
From: Lennart Borgman @ 2011-03-01 13:14 UTC (permalink / raw)
  To: Thierry Volpiatto; +Cc: emacs-devel

On Tue, Mar 1, 2011 at 2:04 PM, Thierry Volpiatto
<thierry.volpiatto@gmail.com> wrote:
> Lennart Borgman <lennart.borgman@gmail.com> writes:
>
>> On Tue, Mar 1, 2011 at 11:46 AM, Thierry Volpiatto
>> <thierry.volpiatto@gmail.com> wrote:
>>> Lennart Borgman <lennart.borgman@gmail.com> writes:
>>>
>>>> *.org is the argument to --filepatt and it only takes one argument so
>>>> this can't be done.
>>> So maybe try:
>>> (setq command '(arg1 arg2 arg3 etc...))
>>> (apply 'start-process (downcase mode-name) outbuf "ruby.exe" command)
>>
>> Is not that exactly the same?

> No, but anyway,

I think it will be converted to exactly the same (by apply).

> in this case it won't work because wilcards syntax is
> recognized only inside a shell, so i am afraid you
> will have to use start-process-shell-command who understand *.ext.

I see. You are misunderstanding. I do not want anything to understand
"*.ext". The problem is that something tries to do that. I want it
transferred literally to the ruby script.



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

* Re: start-process somehow expands *.org
  2011-03-01  2:51   ` Lennart Borgman
  2011-03-01  6:19     ` Thierry Volpiatto
@ 2011-03-01 15:14     ` Davis Herring
  2011-03-01 15:20       ` Lennart Borgman
  1 sibling, 1 reply; 13+ messages in thread
From: Davis Herring @ 2011-03-01 15:14 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: Emacs developers

>    (setq command
>       ("ruby.exe" "c:\\path-to\\idxsearch.rb" "--root"
> "c:/where-to-search/" "--filepatt" "*.org" "--query" "word1,word2")
>
>    (apply 'start-process (downcase mode-name) outbuf command)
>
> It looks like idxsearch.rb recieves the first file matching *.org, in
> my case "act.org" - instead of "*.org" as I expected.
>
> It might be ruby.exe that expands *.org, but if I try a similar
> command line ruby.exe does not expand *.org.
>
> This is on w32, as usual with my patched version.

The system shell on w32 does not expand wildcards (or even split words),
so programs built for w32 must do any expansion themselves.  The various
Unix-on-Windows approaches typically try to do splitting/expansion before
calling main() so that the ported programs see what they would expect from
a Unix shell.

So it's likely that ruby is choosing to do the expansion itself (and then
doing who knows what with the other matches).  You might be able to fix it
by passing the argument with double quotes or so; it depends on the
details of the Unix emulation layer in use.

Davis

-- 
This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.



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

* Re: start-process somehow expands *.org
  2011-03-01 15:14     ` Davis Herring
@ 2011-03-01 15:20       ` Lennart Borgman
  0 siblings, 0 replies; 13+ messages in thread
From: Lennart Borgman @ 2011-03-01 15:20 UTC (permalink / raw)
  To: herring; +Cc: Emacs developers

On Tue, Mar 1, 2011 at 4:14 PM, Davis Herring <herring@lanl.gov> wrote:
>>    (setq command
>>       ("ruby.exe" "c:\\path-to\\idxsearch.rb" "--root"
>> "c:/where-to-search/" "--filepatt" "*.org" "--query" "word1,word2")
>>
>>    (apply 'start-process (downcase mode-name) outbuf command)
>>
>> It looks like idxsearch.rb recieves the first file matching *.org, in
>> my case "act.org" - instead of "*.org" as I expected.
>>
>> It might be ruby.exe that expands *.org, but if I try a similar
>> command line ruby.exe does not expand *.org.
>>
>> This is on w32, as usual with my patched version.
>
> The system shell on w32 does not expand wildcards (or even split words),
> so programs built for w32 must do any expansion themselves.  The various
> Unix-on-Windows approaches typically try to do splitting/expansion before
> calling main() so that the ported programs see what they would expect from
> a Unix shell.
>
> So it's likely that ruby is choosing to do the expansion itself (and then
> doing who knows what with the other matches).  You might be able to fix it
> by passing the argument with double quotes or so; it depends on the
> details of the Unix emulation layer in use.

But if I give "*.ext" to ruby the same way I thought Emacs did it does
not expand "*.ext".

So I thought that maybe Emacs does this expansion, but since know one
seems to know about it I guess it does not. Now I am a bit puzzled...



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

* Re: start-process somehow expands *.org
  2011-03-01 13:14               ` Lennart Borgman
@ 2011-03-01 18:12                 ` Thierry Volpiatto
  2011-03-01 20:04                   ` Lennart Borgman
  0 siblings, 1 reply; 13+ messages in thread
From: Thierry Volpiatto @ 2011-03-01 18:12 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: emacs-devel

Lennart Borgman <lennart.borgman@gmail.com> writes:

> I see. You are misunderstanding. I do not want anything to understand
> "*.ext". The problem is that something tries to do that. I want it
> transferred literally to the ruby script.
So when your command variable is ready (as a list), pass it to
start-process-shell-command with mapconcat and shell-quote-argument.

-- 
A+ Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 



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

* Re: start-process somehow expands *.org
  2011-03-01 18:12                 ` Thierry Volpiatto
@ 2011-03-01 20:04                   ` Lennart Borgman
  0 siblings, 0 replies; 13+ messages in thread
From: Lennart Borgman @ 2011-03-01 20:04 UTC (permalink / raw)
  To: Thierry Volpiatto; +Cc: emacs-devel

On Tue, Mar 1, 2011 at 7:12 PM, Thierry Volpiatto
<thierry.volpiatto@gmail.com> wrote:
> Lennart Borgman <lennart.borgman@gmail.com> writes:
>
>> I see. You are misunderstanding. I do not want anything to understand
>> "*.ext". The problem is that something tries to do that. I want it
>> transferred literally to the ruby script.
> So when your command variable is ready (as a list), pass it to
> start-process-shell-command with mapconcat and shell-quote-argument.

Thanks, but unfortunately I got into some other trouble (which I can't
remember at the moment) when I tried using the shell.



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

end of thread, other threads:[~2011-03-01 20:04 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-01  2:07 start-process somehow expands *.org Lennart Borgman
2011-03-01  2:27 ` Glenn Morris
2011-03-01  2:51   ` Lennart Borgman
2011-03-01  6:19     ` Thierry Volpiatto
2011-03-01 10:37       ` Lennart Borgman
2011-03-01 10:46         ` Thierry Volpiatto
2011-03-01 11:35           ` Lennart Borgman
2011-03-01 13:04             ` Thierry Volpiatto
2011-03-01 13:14               ` Lennart Borgman
2011-03-01 18:12                 ` Thierry Volpiatto
2011-03-01 20:04                   ` Lennart Borgman
2011-03-01 15:14     ` Davis Herring
2011-03-01 15:20       ` Lennart Borgman

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.