在没有XServer的系统上启动时运行Emacs



我想在以用户身份登录 bash 后运行 Emacs。 但是,如果我按 CTRL-Z,我也希望能够跳回 bash 提示符。

我已经尝试了.bashrc和.profile的几个设置:

emacs
eval 'emacs'
bash -c emacs
exec emacs -nw

问题是所有这些变体都使 CTRL-Z 让我不要 bash 提示符 ,而是清空标准,就像 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 filen");
}
else
printf("wrong argsn");
return -1;
}

编译: GCC my_ioctl.C -o my_ioctl

.profile 的末尾:

~/my_ioctl $(tty) emacs rr

(我的 C 程序不关心 3rd arg 实际上是什么(。

最新更新