all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Is `make-process' doing this?
@ 2016-10-16 19:02 Joost Kremers
  2016-10-16 19:07 ` Andreas Schwab
  2016-10-16 19:15 ` Eli Zaretskii
  0 siblings, 2 replies; 4+ messages in thread
From: Joost Kremers @ 2016-10-16 19:02 UTC (permalink / raw)
  To: Emacs developers

Hi all,

just ran into this issue with starting external processes on Linux 
(I can't test if something similar happens on Windows or Mac OS).

Run `emacs -Q', start IELM (for convenience) and type:

IELM> (start-process "some-process" nil "evince" 
"~/path/to/some.pdf")

(Assuming that ~/path/to/some.pdf is an existing pdf file, of 
course). This brings up an evince window with the error message:

Unable to open document "file:///home/joost/~/path/to/some.pdf".

The point is that if I do this from a shell (either some terminal 
emulator, or even eshell or M-x shell in Emacs), it works fine. 
So:

~ $ evince ~/path/to/some.pdf

starts evince and opens the file without issue. 

So I was wondering if it is `make-process' that adds the 
"file:///home/joost/" part, or if it is evince, and if the latter, 
if there is something about `make-process' that keeps evince from 
recognising the argument as an absolute path inspite of the fact 
that it starts with a tilde.

More importantly, I was wondering if I should file a bug report or 
whether this is simply not guaranteed to work. (I modified my code 
to ensure that file names are always expanded with 
`expand-file-name' before being passed to `start-process'. Perhaps 
I should have been doing that all along.)

TIA


-- 
Joost Kremers
Life has its moments



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

* Re: Is `make-process' doing this?
  2016-10-16 19:02 Is `make-process' doing this? Joost Kremers
@ 2016-10-16 19:07 ` Andreas Schwab
  2016-10-16 20:31   ` Joost Kremers
  2016-10-16 19:15 ` Eli Zaretskii
  1 sibling, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2016-10-16 19:07 UTC (permalink / raw)
  To: Joost Kremers; +Cc: Emacs developers

On Okt 16 2016, Joost Kremers <joostkremers@fastmail.fm> wrote:

> IELM> (start-process "some-process" nil "evince" "~/path/to/some.pdf")

This passes the string "~/path/to/some.pdf" as the argument.

> ~ $ evince ~/path/to/some.pdf

Try this instead:

$ evince '~/path/to/some.pdf'

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



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

* Re: Is `make-process' doing this?
  2016-10-16 19:02 Is `make-process' doing this? Joost Kremers
  2016-10-16 19:07 ` Andreas Schwab
@ 2016-10-16 19:15 ` Eli Zaretskii
  1 sibling, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2016-10-16 19:15 UTC (permalink / raw)
  To: Joost Kremers; +Cc: emacs-devel

> From: Joost Kremers <joostkremers@fastmail.fm>
> Date: Sun, 16 Oct 2016 21:02:55 +0200
> 
> Run `emacs -Q', start IELM (for convenience) and type:
> 
> IELM> (start-process "some-process" nil "evince" 
> "~/path/to/some.pdf")
> 
> (Assuming that ~/path/to/some.pdf is an existing pdf file, of 
> course). This brings up an evince window with the error message:
> 
> Unable to open document "file:///home/joost/~/path/to/some.pdf".
> 
> The point is that if I do this from a shell (either some terminal 
> emulator, or even eshell or M-x shell in Emacs), it works fine. 
> So:
> 
> ~ $ evince ~/path/to/some.pdf
> 
> starts evince and opens the file without issue. 

Because the shell expands the tilde.  See the hint from Andreas.

> So I was wondering if it is `make-process' that adds the 
> "file:///home/joost/" part, or if it is evince, and if the latter, 
> if there is something about `make-process' that keeps evince from 
> recognising the argument as an absolute path inspite of the fact 
> that it starts with a tilde.

Neither 'start-process' nor 'make-process' can expand arguments via
'expand-file-name', because they simply don't know which arguments are
file names and which aren't, with the single exception: the program's
executable file name.  So it's up to your code to do that for any
other arguments that you know are file names.



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

* Re: Is `make-process' doing this?
  2016-10-16 19:07 ` Andreas Schwab
@ 2016-10-16 20:31   ` Joost Kremers
  0 siblings, 0 replies; 4+ messages in thread
From: Joost Kremers @ 2016-10-16 20:31 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Emacs developers


On Sun, Oct 16 2016, Andreas Schwab wrote:
> On Okt 16 2016, Joost Kremers <joostkremers@fastmail.fm> wrote:
>
>> IELM> (start-process "some-process" nil "evince" 
>> "~/path/to/some.pdf")
>
> This passes the string "~/path/to/some.pdf" as the argument.
>
>> ~ $ evince ~/path/to/some.pdf
>
> Try this instead:
>
> $ evince '~/path/to/some.pdf'

Thanks for the hint. I'll go find myself a cluebat.

-- 
Joost Kremers
Life has its moments



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

end of thread, other threads:[~2016-10-16 20:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-16 19:02 Is `make-process' doing this? Joost Kremers
2016-10-16 19:07 ` Andreas Schwab
2016-10-16 20:31   ` Joost Kremers
2016-10-16 19:15 ` Eli Zaretskii

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.