unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Open terminal window from emacs
@ 2013-09-27 20:46 Frederik
  2013-09-28  7:54 ` Frederik
  0 siblings, 1 reply; 9+ messages in thread
From: Frederik @ 2013-09-27 20:46 UTC (permalink / raw)
  To: help-gnu-emacs

Hey,

I try to open up urxvt from emacs and make the terminal emulator
automatically switch to the current working directory of the current
buffer (i.e. to the value of default-directory).

This is what I've come up with:

(call-process "/usr/bin/urxvt" nil 0 nil
	(concat "-cd" default-directory))

But this doesn't work.

This
(call-process "/usr/bin/urxvt" nil 0 nil
	"-cd ~/test")
doesn't work either, even though the directory exits.

Any pointers?

-- 
Frederik




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

* Re: Open terminal window from emacs
       [not found] <mailman.3023.1380314834.10748.help-gnu-emacs@gnu.org>
@ 2013-09-27 21:21 ` Pascal J. Bourguignon
  2013-09-28  7:25   ` Frederik
  2013-09-28  7:56 ` Sven Joachim
  1 sibling, 1 reply; 9+ messages in thread
From: Pascal J. Bourguignon @ 2013-09-27 21:21 UTC (permalink / raw)
  To: help-gnu-emacs

Frederik <freak.fred@gmail.com> writes:

> Hey,
>
> I try to open up urxvt from emacs and make the terminal emulator
> automatically switch to the current working directory of the current
> buffer (i.e. to the value of default-directory).
>
> This is what I've come up with:
>
> (call-process "/usr/bin/urxvt" nil 0 nil
> 	(concat "-cd" default-directory))
>
> But this doesn't work.
>
> This
> (call-process "/usr/bin/urxvt" nil 0 nil
> 	"-cd ~/test")
> doesn't work either, even though the directory exits.

(shell-command (format "cd %S ; /usr/bin/urxvt" default-directory))

-- 
__Pascal Bourguignon__
http://www.informatimago.com/


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

* Re: Open terminal window from emacs
  2013-09-27 21:21 ` Pascal J. Bourguignon
@ 2013-09-28  7:25   ` Frederik
  0 siblings, 0 replies; 9+ messages in thread
From: Frederik @ 2013-09-28  7:25 UTC (permalink / raw)
  To: help-gnu-emacs


> (shell-command (format "cd %S ; /usr/bin/urxvt" default-directory))

Thanks, but this freezes my emacs frame as long as the terminal runs;
I'd like to avoid that. I guess that I'll have to stick with
call-process, but as I don't know any Lisp, I don't know how to
correctly adapt your hint to call-process...


-- 
Frederik




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

* Re: Open terminal window from emacs
  2013-09-27 20:46 Open terminal window from emacs Frederik
@ 2013-09-28  7:54 ` Frederik
  0 siblings, 0 replies; 9+ messages in thread
From: Frederik @ 2013-09-28  7:54 UTC (permalink / raw)
  To: help-gnu-emacs

> I try to open up urxvt from emacs and make the terminal emulator
> automatically switch to the current working directory of the current
> buffer (i.e. to the value of default-directory).

Ok, the following works for me:
(call-process "/usr/bin/urxvt" nil 0 nil
	      "-cd" (expand-file-name default-directory))

I've no clue why this works, but I'm happy now...

-- 
Frederik




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

* Re: Open terminal window from emacs
       [not found] <mailman.3023.1380314834.10748.help-gnu-emacs@gnu.org>
  2013-09-27 21:21 ` Pascal J. Bourguignon
@ 2013-09-28  7:56 ` Sven Joachim
  2013-09-28  8:06   ` Frederik
                     ` (2 more replies)
  1 sibling, 3 replies; 9+ messages in thread
From: Sven Joachim @ 2013-09-28  7:56 UTC (permalink / raw)
  To: help-gnu-emacs

On 2013-09-27 22:46 +0200, Frederik wrote:

> I try to open up urxvt from emacs and make the terminal emulator
> automatically switch to the current working directory of the current
> buffer (i.e. to the value of default-directory).

Shouldn't the terminal emulator start in that directory automatically?
At least xterm does, I don't have urxvt around ATM.

> This is what I've come up with:
>
> (call-process "/usr/bin/urxvt" nil 0 nil
> 	(concat "-cd" default-directory))
>
> But this doesn't work.
>
> This
> (call-process "/usr/bin/urxvt" nil 0 nil
> 	"-cd ~/test")
> doesn't work either, even though the directory exits.
>
> Any pointers?

Seems to me the tilde does not get expanded here, so you would have to
use (expand-file-name default-directory) rather than just
default-directory.

Cheers,
       Sven


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

* Re: Open terminal window from emacs
  2013-09-28  7:56 ` Sven Joachim
@ 2013-09-28  8:06   ` Frederik
  2013-09-28  9:08   ` Peter Dyballa
       [not found]   ` <mailman.3053.1380355638.10748.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 9+ messages in thread
From: Frederik @ 2013-09-28  8:06 UTC (permalink / raw)
  To: help-gnu-emacs

> Seems to me the tilde does not get expanded here, so you would have to
> use (expand-file-name default-directory) rather than just
> default-directory.
> 
> Cheers,
>        Sven
> 

Yeah, thanks, I just skimmed the documentation on default-directory and
found expand-file-name. It works now. However the behaviour is quite
strange since the command "urxvt -cd ~/test" works well when launched
from a terminal...

Cheers

-- 
Frederik




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

* Re: Open terminal window from emacs
  2013-09-28  7:56 ` Sven Joachim
  2013-09-28  8:06   ` Frederik
@ 2013-09-28  9:08   ` Peter Dyballa
       [not found]   ` <mailman.3053.1380355638.10748.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 9+ messages in thread
From: Peter Dyballa @ 2013-09-28  9:08 UTC (permalink / raw)
  To: Sven Joachim; +Cc: help-gnu-emacs


Am 28.09.2013 um 09:56 schrieb Sven Joachim:

> Shouldn't the terminal emulator start in that directory automatically?

The *terminal emulator* might have its working directory there, but you're not working with it, you are using the shell inside. And it might have some initialisation code…

--
Greetings

  Pete

If you're not confused, you're not paying attention.




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

* Re: Open terminal window from emacs
       [not found]   ` <mailman.3053.1380355638.10748.help-gnu-emacs@gnu.org>
@ 2013-09-28 10:06     ` Sven Joachim
  2013-09-28 11:38       ` Frederik
  0 siblings, 1 reply; 9+ messages in thread
From: Sven Joachim @ 2013-09-28 10:06 UTC (permalink / raw)
  To: help-gnu-emacs

On 2013-09-28 10:06 +0200, Frederik wrote:

>> Seems to me the tilde does not get expanded here, so you would have to
>> use (expand-file-name default-directory) rather than just
>> default-directory.
>
> Yeah, thanks, I just skimmed the documentation on default-directory and
> found expand-file-name. It works now. However the behaviour is quite
> strange since the command "urxvt -cd ~/test" works well when launched
> from a terminal...

Your shell expands the tilde then, as it does in Pascal's suggestion.
But call-process does not invoke a shell, in contrast to shell-command.

Cheers,
       Sven


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

* Re: Open terminal window from emacs
  2013-09-28 10:06     ` Sven Joachim
@ 2013-09-28 11:38       ` Frederik
  0 siblings, 0 replies; 9+ messages in thread
From: Frederik @ 2013-09-28 11:38 UTC (permalink / raw)
  To: help-gnu-emacs

Am 28.09.2013 12:06, schrieb Sven Joachim:
> On 2013-09-28 10:06 +0200, Frederik wrote:
> 
>>> Seems to me the tilde does not get expanded here, so you would have to
>>> use (expand-file-name default-directory) rather than just
>>> default-directory.
>>
>> Yeah, thanks, I just skimmed the documentation on default-directory and
>> found expand-file-name. It works now. However the behaviour is quite
>> strange since the command "urxvt -cd ~/test" works well when launched
>> from a terminal...
> 
> Your shell expands the tilde then, as it does in Pascal's suggestion.
> But call-process does not invoke a shell, in contrast to shell-command.
> 
> Cheers,
>        Sven
> 

I see. Thanks for the clarification!

Regards,

-- 
Frederik




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

end of thread, other threads:[~2013-09-28 11:38 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-27 20:46 Open terminal window from emacs Frederik
2013-09-28  7:54 ` Frederik
     [not found] <mailman.3023.1380314834.10748.help-gnu-emacs@gnu.org>
2013-09-27 21:21 ` Pascal J. Bourguignon
2013-09-28  7:25   ` Frederik
2013-09-28  7:56 ` Sven Joachim
2013-09-28  8:06   ` Frederik
2013-09-28  9:08   ` Peter Dyballa
     [not found]   ` <mailman.3053.1380355638.10748.help-gnu-emacs@gnu.org>
2013-09-28 10:06     ` Sven Joachim
2013-09-28 11:38       ` Frederik

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).