How to detect that emacs is in terminal-mode?

前端 未结 5 905
感情败类
感情败类 2020-12-04 07:19

In my .emacs file, I have commands that only makes sense in graphical mode (like (set-frame-size (selected-frame) 166 100)). How do I run these onl

5条回答
  •  北海茫月
    2020-12-04 07:57

    window-system is a variable defined in `C source code'. Its value is x

    Documentation: Name of window system through which the selected frame is displayed. The value is a symbol--for instance, `x' for X windows. The value is nil if the selected frame is on a text-only-terminal.

    Basically do a:

    (if window-system
        (progn
          (something)
          (something-else)))
    

提交回复
热议问题