How to check if Xorg works in emacs lisp?

I have something in my configuration that only works if Xorg else fails.

To solve this problem, I need to know if Xorg is working 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

+4
source share
2 answers
 (case window-system (x '"X11 running") (otherwise "No X11")) 
+7
source

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

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

+4
source

Source: https://habr.com/ru/post/1388105/


All Articles