3

I've got some things in my configuration that works only in Xorg else dropping errors.

To solve it I need to know if Xorg is running or not. How can I check it ?

(defun nCdy-mode ()
    ;; TOOD: Add Xorg check
    ;(tool-bar-mode nil)
    (menu-bar-mode nil) ; TODO: Add hotkey
    ;(scroll-bar-mode nil)
    (setq inhibit-splash-screen t)

    (setq standard-indent 4)
    ;;(mouse-wheel-mode t)
    (setq backup-directory-alist (quote ((".*" . "~/.emacs_backups/"))))

    ;;TODO: Add Xorg check
    ;(require 'nyan-mode)
    ;(nyan-mode)
    ;(nyan-start-animation)
    ;;nyanyanyanyanyanyanyanyanyanyan

thank you

cnd
  • 32,616
  • 62
  • 183
  • 313

2 Answers2

7
(case window-system
  (x '"X11 running")
  (otherwise "No X11"))
Jürgen Hötzel
  • 18,997
  • 3
  • 42
  • 58
4

While Jürgen is correct that you probably want to test the value of window-system, note that because of its client/server mechanism, a single Emacs instance can have several frames, some of which are on graphic terminals (e.g. XOrg) and some of which are in text terminals.

As a result, you should think about where and when to test for window-system. See this answer to a similar question for more on how to deal with that.

Community
  • 1
  • 1
sanityinc
  • 15,002
  • 2
  • 49
  • 43