变量
"system-type"
在 emacs-nox.exe 和 emacs.exe(在 X 下运行)下都设置为“cygwin”。如何查找 Emacs 是否在 X 中运行。
尝试调用函数window-system
。文档字符串说:
(window-system &optional FRAME)
The name of the window system that FRAME is displaying through.
The value is a symbol:
nil for a termcap frame (a character-only terminal),
'x' for an Emacs frame that is really an X window,
'w32' for an Emacs frame that is a window on MS-Windows display,
'ns' for an Emacs frame on a GNUstep or Macintosh Cocoa display,
'pc' for a direct-write MS-DOS frame.
FRAME defaults to the currently selected frame.
Use of this function as a predicate is deprecated. Instead,
use `display-graphic-p' or any of the other `display-*-p'
predicates which report frame's specific UI-related capabilities.
AFAIK Cygwin-X11 版本的 Emacs 就像 GNU/Linux 版本一样,它可以同时具有 tty 帧和 X11 帧。
因此,即使您启动“emacs -nw”,您也可以稍后从同一个 Emacs 实例创建 X11 帧(例如 viaemacsclient
或 via M-x make-frame-on-display
)。这意味着,如果您希望该案例运行良好,即使在“非 X11”案例中,您也需要应用您的“仅 X11”自定义,但您可能希望以仅影响 X11 帧的方式执行此操作而不是 tty 帧。