我试图明智地调试Emacs程序的性能.特别是,我通过WLAN,手机等在远程连接上遇到极长的启动时间(~5'与裸Emacs相比为~1').在这种情况下,任何message
书面都没有帮助,因为显示器没有刷新一点都不
我想做的是写入Linux进程的"标准输出".我知道这种--batch
模式,但这对我没有帮助,因为我想以交互方式使用Emacs.
那么如何将消息写入Linux标准输出(而不是Emacs标准输出)?
Phi*_*ord 26
您可以像这样输出标准错误:
(print "hello world" #'external-debugging-output)
Run Code Online (Sandbox Code Playgroud)
要么
(princ "hello world" #'external-debugging-output)
Run Code Online (Sandbox Code Playgroud)
这可以缓冲,所以要小心.目前无法输出到标准输出.我想补充一点,我想!
启动emacs作为守护进程(emacs --daemon
),启动序列中的任何消息都将发送到stdout或stderr,如lunaryorn所述.
使用连接到服务器 emacsclient
杀死服务器的最简单方法是 M-x kill-emacs
RET
详情见 C-hig (emacs) Emacs Server
RET
适用于我的中心6.8(GNU Emacs 23.1.1):
(append-to-file "here I come to save the day\n" nil "/dev/stdout")
Run Code Online (Sandbox Code Playgroud)
尝试使用"/ dev/tty"代替"/ dev/stdout":
如果您打算将"emacs -nw"stdout重定向到文件并在外部监视该文件(然后使用"/ dev/stdout"),则不清楚问题; 或者可以写入"/ dev/tty",从而污染主"emacs -nw"显示的自相同tty.
如果以这种方式启动emacs的GUI版本,它可能会失去对原始tty的附件,可以滥用环境变量来将原始shell的tty传递给elisp.
这适用于我在Mac OS X中使用Aquamacs.从bash shell启动:
$ MY_TTY=$(tty) open /Applications/Aquamacs\ Emacs.app &
Run Code Online (Sandbox Code Playgroud)
然后在emacs中:
(append-to-file "here I come to save the day\n" nil (getenv "MY_TTY"))
Run Code Online (Sandbox Code Playgroud)