all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* under termianl emacs, how to start a process and make it believe it's running inside a termial?
@ 2016-04-03 13:46 Shiyao Ma
  0 siblings, 0 replies; 10+ messages in thread
From: Shiyao Ma @ 2016-04-03 13:46 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

I am running emacs in a terminal.

I want to invoke the ranger program, which is a tui file manager,  inside
emacs.

basically, I am translating the following file into elisp.
https://github.com/hut/ranger/blob/master/examples/vim_file_chooser.vim#L10


The problem I am facing is, when I do a:
(call-process "/usr/bin/ranger")

ranger thinks it's not running inside terminal, and exited directly.


So, my question is, how to make ranger believe it's actually inside a
terminal?


Regards.


-- 

吾輩は猫である。ホームーページはhttps://introo.me <http://introo.me>。


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

* Re: under termianl emacs, how to start a process and make it believe it's running inside a termial?
       [not found] <mailman.8886.1459691173.843.help-gnu-emacs@gnu.org>
@ 2016-04-03 14:08 ` Pascal J. Bourguignon
  2016-04-04  5:40   ` Shiyao Ma
  0 siblings, 1 reply; 10+ messages in thread
From: Pascal J. Bourguignon @ 2016-04-03 14:08 UTC (permalink / raw)
  To: help-gnu-emacs

Shiyao Ma <i@introo.me> writes:

> Hi,
>
> I am running emacs in a terminal.
>
> I want to invoke the ranger program, which is a tui file manager,  inside
> emacs.
>
> basically, I am translating the following file into elisp.
> https://github.com/hut/ranger/blob/master/examples/vim_file_chooser.vim#L10
>
>
> The problem I am facing is, when I do a:
> (call-process "/usr/bin/ranger")
>
> ranger thinks it's not running inside terminal, and exited directly.
>
>
> So, my question is, how to make ranger believe it's actually inside a
> terminal?

You can use term or terminal for that:

M-x term RET /usr/bin/ranger RET

or: (term "/usr/bin/ranger") ; in code.


-- 
__Pascal Bourguignon__                 http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk


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

* Re: under termianl emacs, how to start a process and make it believe it's running inside a termial?
  2016-04-03 14:08 ` under termianl emacs, how to start a process and make it believe it's running inside a termial? Pascal J. Bourguignon
@ 2016-04-04  5:40   ` Shiyao Ma
  2016-04-04  5:46     ` Shiyao Ma
                       ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Shiyao Ma @ 2016-04-04  5:40 UTC (permalink / raw)
  To: Pascal J. Bourguignon; +Cc: help-gnu-emacs

sorry for my first mail. It seems a little misleading.


It's not to allocate a term-ish thing for ranger *from emacs*.

Indeed, I'd like to run "ranger" as the foreground process, since I am
already inside terminal.



Btw, the M-x term thing failed, out put here:
https://bpaste.net/show/c45a47b26cd8

But it's not relevant here because the terminal should be my own terminal.



regards.

On 3 April 2016 at 22:08, Pascal J. Bourguignon <pjb@informatimago.com>
wrote:

> Shiyao Ma <i@introo.me> writes:
>
> > Hi,
> >
> > I am running emacs in a terminal.
> >
> > I want to invoke the ranger program, which is a tui file manager,  inside
> > emacs.
> >
> > basically, I am translating the following file into elisp.
> >
> https://github.com/hut/ranger/blob/master/examples/vim_file_chooser.vim#L10
> >
> >
> > The problem I am facing is, when I do a:
> > (call-process "/usr/bin/ranger")
> >
> > ranger thinks it's not running inside terminal, and exited directly.
> >
> >
> > So, my question is, how to make ranger believe it's actually inside a
> > terminal?
>
> You can use term or terminal for that:
>
> M-x term RET /usr/bin/ranger RET
>
> or: (term "/usr/bin/ranger") ; in code.
>
>
> --
> __Pascal Bourguignon__                 http://www.informatimago.com/
> “The factory of the future will have only two employees, a man and a
> dog. The man will be there to feed the dog. The dog will be there to
> keep the man from touching the equipment.” -- Carl Bass CEO Autodesk
>



-- 

吾輩は猫である。ホームーページはhttps://introo.me <http://introo.me>。


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

* Re: under termianl emacs, how to start a process and make it believe it's running inside a termial?
  2016-04-04  5:40   ` Shiyao Ma
@ 2016-04-04  5:46     ` Shiyao Ma
       [not found]     ` <mailman.8972.1459748791.843.help-gnu-emacs@gnu.org>
  2016-04-04 16:09     ` Yuri Khan
  2 siblings, 0 replies; 10+ messages in thread
From: Shiyao Ma @ 2016-04-04  5:46 UTC (permalink / raw)
  To: Pascal J. Bourguignon; +Cc: help-gnu-emacs

one more thing,

`M-x ansi-term' does work. But again, how can I make `ranger' utllize the
my termianl (iterm2) instead of the one provided by emacs?

On 4 April 2016 at 13:40, Shiyao Ma <i@introo.me> wrote:

> sorry for my first mail. It seems a little misleading.
>
>
> It's not to allocate a term-ish thing for ranger *from emacs*.
>
> Indeed, I'd like to run "ranger" as the foreground process, since I am
> already inside terminal.
>
>
>
> Btw, the M-x term thing failed, out put here:
> https://bpaste.net/show/c45a47b26cd8
>
> But it's not relevant here because the terminal should be my own terminal.
>
>
>
> regards.
>
> On 3 April 2016 at 22:08, Pascal J. Bourguignon <pjb@informatimago.com>
> wrote:
>
>> Shiyao Ma <i@introo.me> writes:
>>
>> > Hi,
>> >
>> > I am running emacs in a terminal.
>> >
>> > I want to invoke the ranger program, which is a tui file manager,
>> inside
>> > emacs.
>> >
>> > basically, I am translating the following file into elisp.
>> >
>> https://github.com/hut/ranger/blob/master/examples/vim_file_chooser.vim#L10
>> >
>> >
>> > The problem I am facing is, when I do a:
>> > (call-process "/usr/bin/ranger")
>> >
>> > ranger thinks it's not running inside terminal, and exited directly.
>> >
>> >
>> > So, my question is, how to make ranger believe it's actually inside a
>> > terminal?
>>
>> You can use term or terminal for that:
>>
>> M-x term RET /usr/bin/ranger RET
>>
>> or: (term "/usr/bin/ranger") ; in code.
>>
>>
>> --
>> __Pascal Bourguignon__                 http://www.informatimago.com/
>> “The factory of the future will have only two employees, a man and a
>> dog. The man will be there to feed the dog. The dog will be there to
>> keep the man from touching the equipment.” -- Carl Bass CEO Autodesk
>>
>
>
>
> --
>
> 吾輩は猫である。ホームーページはhttps://introo.me <http://introo.me>。
>



-- 

吾輩は猫である。ホームーページはhttps://introo.me <http://introo.me>。


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

* Re: under termianl emacs, how to start a process and make it believe it's running inside a termial?
       [not found]     ` <mailman.8972.1459748791.843.help-gnu-emacs@gnu.org>
@ 2016-04-04 15:00       ` Barry Margolin
  2016-04-05  2:11         ` Shiyao Ma
       [not found]         ` <mailman.9050.1459822277.843.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 10+ messages in thread
From: Barry Margolin @ 2016-04-04 15:00 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2285 bytes --]

In article <mailman.8972.1459748791.843.help-gnu-emacs@gnu.org>,
 Shiyao Ma <i@introo.me> wrote:

> one more thing,
> 
> `M-x ansi-term' does work. But again, how can I make `ranger' utllize the
> my termianl (iterm2) instead of the one provided by emacs?

Maybe:

M-! /usr/bin/ranger </dev/tty >&/dev/tty

> 
> On 4 April 2016 at 13:40, Shiyao Ma <i@introo.me> wrote:
> 
> > sorry for my first mail. It seems a little misleading.
> >
> >
> > It's not to allocate a term-ish thing for ranger *from emacs*.
> >
> > Indeed, I'd like to run "ranger" as the foreground process, since I am
> > already inside terminal.
> >
> >
> >
> > Btw, the M-x term thing failed, out put here:
> > https://bpaste.net/show/c45a47b26cd8
> >
> > But it's not relevant here because the terminal should be my own terminal.
> >
> >
> >
> > regards.
> >
> > On 3 April 2016 at 22:08, Pascal J. Bourguignon <pjb@informatimago.com>
> > wrote:
> >
> >> Shiyao Ma <i@introo.me> writes:
> >>
> >> > Hi,
> >> >
> >> > I am running emacs in a terminal.
> >> >
> >> > I want to invoke the ranger program, which is a tui file manager,
> >> inside
> >> > emacs.
> >> >
> >> > basically, I am translating the following file into elisp.
> >> >
> >> https://github.com/hut/ranger/blob/master/examples/vim_file_chooser.vim#L10
> >> >
> >> >
> >> > The problem I am facing is, when I do a:
> >> > (call-process "/usr/bin/ranger")
> >> >
> >> > ranger thinks it's not running inside terminal, and exited directly.
> >> >
> >> >
> >> > So, my question is, how to make ranger believe it's actually inside a
> >> > terminal?
> >>
> >> You can use term or terminal for that:
> >>
> >> M-x term RET /usr/bin/ranger RET
> >>
> >> or: (term "/usr/bin/ranger") ; in code.
> >>
> >>
> >> --
> >> __Pascal Bourguignon__                 http://www.informatimago.com/
> >> メThe factory of the future will have only two employees, a man and a
> >> dog. The man will be there to feed the dog. The dog will be there to
> >> keep the man from touching the equipment.モ -- Carl Bass CEO Autodesk
> >>
> >
> >
> >
> > --
> >
> > 吾輩は猫である。ホームーページはhttps://introo.me <http://introo.me>。
> >

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


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

* Re: under termianl emacs, how to start a process and make it believe it's running inside a termial?
  2016-04-04  5:40   ` Shiyao Ma
  2016-04-04  5:46     ` Shiyao Ma
       [not found]     ` <mailman.8972.1459748791.843.help-gnu-emacs@gnu.org>
@ 2016-04-04 16:09     ` Yuri Khan
  2 siblings, 0 replies; 10+ messages in thread
From: Yuri Khan @ 2016-04-04 16:09 UTC (permalink / raw)
  To: Shiyao Ma; +Cc: Pascal J. Bourguignon, help-gnu-emacs@gnu.org

On Mon, Apr 4, 2016 at 11:40 AM, Shiyao Ma <i@introo.me> wrote:

> It's not to allocate a term-ish thing for ranger *from emacs*.
>
> Indeed, I'd like to run "ranger" as the foreground process, since I am
> already inside terminal.

You could probably (suspend-emacs) and run ranger from the parent shell.



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

* Re: under termianl emacs, how to start a process and make it believe it's running inside a termial?
  2016-04-04 15:00       ` Barry Margolin
@ 2016-04-05  2:11         ` Shiyao Ma
       [not found]         ` <mailman.9050.1459822277.843.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 10+ messages in thread
From: Shiyao Ma @ 2016-04-05  2:11 UTC (permalink / raw)
  Cc: help-gnu-emacs

On 4 April 2016 at 23:00, Barry Margolin <barmar@alum.mit.edu> wrote:

> In article <mailman.8972.1459748791.843.help-gnu-emacs@gnu.org>,
>  Shiyao Ma <i@introo.me> wrote:
>
>
> Maybe:
>
> M-! /usr/bin/ranger </dev/tty >&/dev/tty
>
>
>

Looks like the right direction.

But after running it, I got:
zsh:1: device not configured: /dev/tty

I am not familiar with the devfs, but surely emacs must setup the tty for
ranger.

-- 

吾輩は猫である。ホームーページはhttps://introo.me <http://introo.me>。


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

* Re: under termianl emacs, how to start a process and make it believe it's running inside a termial?
       [not found]         ` <mailman.9050.1459822277.843.help-gnu-emacs@gnu.org>
@ 2016-04-05  2:43           ` Barry Margolin
  2016-04-06  2:43             ` Shiyao Ma
  0 siblings, 1 reply; 10+ messages in thread
From: Barry Margolin @ 2016-04-05  2:43 UTC (permalink / raw)
  To: help-gnu-emacs

In article <mailman.9050.1459822277.843.help-gnu-emacs@gnu.org>,
 Shiyao Ma <i@introo.me> wrote:

> On 4 April 2016 at 23:00, Barry Margolin <barmar@alum.mit.edu> wrote:
> 
> > In article <mailman.8972.1459748791.843.help-gnu-emacs@gnu.org>,
> >  Shiyao Ma <i@introo.me> wrote:
> >
> >
> > Maybe:
> >
> > M-! /usr/bin/ranger </dev/tty >&/dev/tty
> >
> >
> >
> 
> Looks like the right direction.
> 
> But after running it, I got:
> zsh:1: device not configured: /dev/tty
> 
> I am not familiar with the devfs, but surely emacs must setup the tty for
> ranger.

The tty should just be inherited from the terminal that you're running 
Emacs in. You're using "emacs -nw" to run it in the terminal window, 
aren't you?

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


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

* Re: under termianl emacs, how to start a process and make it believe it's running inside a termial?
  2016-04-05  2:43           ` Barry Margolin
@ 2016-04-06  2:43             ` Shiyao Ma
  2016-04-06  5:27               ` Bob Proulx
  0 siblings, 1 reply; 10+ messages in thread
From: Shiyao Ma @ 2016-04-06  2:43 UTC (permalink / raw)
  Cc: help-gnu-emacs

On 5 April 2016 at 10:43, Barry Margolin <barmar@alum.mit.edu> wrote:

>
> The tty should just be inherited from the terminal that you're running
> Emacs in. You're using "emacs -nw" to run it in the terminal window,
> aren't you?
>


I am using emacs -nw under iTerm2.





-- 

吾輩は猫である。ホームーページはhttps://introo.me <http://introo.me>。


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

* Re: under termianl emacs, how to start a process and make it believe it's running inside a termial?
  2016-04-06  2:43             ` Shiyao Ma
@ 2016-04-06  5:27               ` Bob Proulx
  0 siblings, 0 replies; 10+ messages in thread
From: Bob Proulx @ 2016-04-06  5:27 UTC (permalink / raw)
  To: help-gnu-emacs

Shiyao Ma wrote:
> Barry Margolin wrote:
> > Shiyao Ma <I@introo.me> wrote:
> > Maybe:
> > M-! /usr/bin/ranger </dev/tty >&/dev/tty
> 
> Looks like the right direction.
> 
> But after running it, I got:
> zsh:1: device not configured: /dev/tty
> On 5 April 2016 at 10:43, Barry Margolin <barmar@alum.mit.edu> wrote:
> 
> > The tty should just be inherited from the terminal that you're running
> > Emacs in. You're using "emacs -nw" to run it in the terminal window,
> > aren't you?
> 
> I am using emacs -nw under iTerm2.

For what it is worth I see exactly the same behavior here.  Running
'emacs -nw' in an XTerm from the bash prompt.  I don't have a solution
but here is some data for the thread.

Trying this:

  Shell command: /bin/bash </dev/tty >/dev/tty 2>&1

Yields this message.

    /bin/bash: /dev/tty: No such device or address

I don't have systemd installed and so this isn't related to that side
of things.  /dev/tty exists but isn't associated with a terminal at
that point.

If I use job control to suspend (C-x C-z suspend-frame) then of course
I drop back to the command line prompt.

Looking at the vim_file_chooser reference in the first posting I can
see what is attempted to be created.  I can tell that even though the
job control gets back to the command line and a terminal that it isn't
helpful in trying to make that task work.  I am just noting it in
passing.

If I look to see what tty I am on before launching emacs then I can
associate with it.

  tty
    /dev/pts/4
  emacs -nw
  Shell command: /bin/bash </dev/pts/4 >/dev/pts/4 2>&1
  bash: cannot set terminal process group (11594): Inappropriate ioctl for device
  bash: no job control in this shell
    ...tty is in raw mode with echo turned off...
  rwp@havoc:~$ stty echo onlcr
  rwp@havoc:~$ # Usable tty.
  rwp@havoc:~$ exit
    ...unusable emacs due to tty being in canonical mode...
    ...I should have returned to raw mode first...
  rwp@havoc:~$ stty -echo -onlcr
  rwp@havoc:~$ exit
    ...usable emacs...

And so while that is another data point it is rather useless
information for getting to the goal.

Emacs is running attached to the tty device.  Running the
shell-command routine detaches it from the terminal.  Seems like there
should be a way in elisp to run a shell command without having it
detached from the tty.

Bob



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

end of thread, other threads:[~2016-04-06  5:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.8886.1459691173.843.help-gnu-emacs@gnu.org>
2016-04-03 14:08 ` under termianl emacs, how to start a process and make it believe it's running inside a termial? Pascal J. Bourguignon
2016-04-04  5:40   ` Shiyao Ma
2016-04-04  5:46     ` Shiyao Ma
     [not found]     ` <mailman.8972.1459748791.843.help-gnu-emacs@gnu.org>
2016-04-04 15:00       ` Barry Margolin
2016-04-05  2:11         ` Shiyao Ma
     [not found]         ` <mailman.9050.1459822277.843.help-gnu-emacs@gnu.org>
2016-04-05  2:43           ` Barry Margolin
2016-04-06  2:43             ` Shiyao Ma
2016-04-06  5:27               ` Bob Proulx
2016-04-04 16:09     ` Yuri Khan
2016-04-03 13:46 Shiyao Ma

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.