簡體   English   中英

在沒有XServer的系統上啟動時運行Emacs

[英]Run Emacs on startup on system with no XServer

我想以用戶身份登錄bash后運行Emacs。 但是,如果我按CTRL-Z,我還希望能夠跳回到bash提示符。

我已經嘗試了幾個.bashrc和.profile的設置:

emacs

eval 'emacs'

bash -c emacs

exec emacs -nw

問題是所有這些變體使CTRL-Z不會將我放到bash提示符下,而是放到空的stdin上,就像尚未加載bash提示符一樣。 有任何想法嗎? 謝謝。

感謝Mark Plotnick,他在下面的評論中回答了。 使用ioctl可以編寫自己的tty。 C程序:

#include "unistd.h"
#include "stdlib.h"
#include "stdio.h"
#include "sys/stat.h"
#include "sys/types.h"
#include "fcntl.h"
#include "termios.h"
#include "sys/ioctl.h"

int main(int argc, char ** argv)
{
  if (argc >= 3)
    {
      int fd = open (argv[1], O_RDWR);

      if (fd)
    {
      char * cmd = argv[2];
      while(*cmd)
        ioctl(fd, TIOCSTI, cmd++);

      if (argc >= 4)
        ioctl(fd, TIOCSTI, "\r");

      return 0;
    }
      else
    printf("could'n open file\n");

    }
  else
    printf("wrong args\n");
  return -1;
}

編譯:gcc my_ioctl.c -o my_ioctl

.profile的結尾:

~/my_ioctl $(tty) emacs rr

(我的c程序並不關心第三個arg的實際含義)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM