Function: x-apply-session-resources

x-apply-session-resources is a byte-compiled function defined in startup.el.gz.

Signature

(x-apply-session-resources)

Documentation

Apply X resources which specify initial values for Emacs variables.

This is called from a window-system initialization function, such as window-system-initialization for X, either at startup (prior to reading the init file), or afterwards when the user first opens a graphical frame.

This can set the values of menu-bar-mode(var)/menu-bar-mode(fun), tool-bar-mode(var)/tool-bar-mode(fun), tab-bar-mode(var)/tab-bar-mode(fun), and blink-cursor-mode(var)/blink-cursor-mode(fun), as well as the cursor face. Changed settings will be marked as "CHANGED outside of Customize".

Source Code

;; Defined in /usr/src/emacs/lisp/startup.el.gz
(defun x-apply-session-resources ()
  "Apply X resources which specify initial values for Emacs variables.
This is called from a window-system initialization function, such
as `window-system-initialization' for X, either at startup (prior
to reading the init file), or afterwards when the user first
opens a graphical frame.

This can set the values of `menu-bar-mode', `tool-bar-mode',
`tab-bar-mode', and `blink-cursor-mode', as well as the `cursor' face.
Changed settings will be marked as \"CHANGED outside of Customize\"."
  (let ((no-vals  '("no" "off" "false" "0"))
	(settings '(("menuBar" "MenuBar" menu-bar-mode nil)
		    ("toolBar" "ToolBar" tool-bar-mode nil)
		    ("scrollBar" "ScrollBar" scroll-bar-mode nil)
		    ("cursorBlink" "CursorBlink" blink-cursor-mode nil))))
    (dolist (x settings)
      (if (member (x-get-resource (nth 0 x) (nth 1 x)) no-vals)
	  (set (nth 2 x) (nth 3 x)))))
  (let ((yes-vals  '("yes" "on" "true" "1"))
	(settings '(("tabBar" "TabBar" tab-bar-mode 1))))
    (dolist (x settings)
      (if (member (x-get-resource (nth 0 x) (nth 1 x)) yes-vals)
	  (funcall (nth 2 x) (nth 3 x)))))
  (let ((color (x-get-resource "cursorColor" "Foreground")))
    (when color
      (put 'cursor 'theme-face
	   `((changed ((t :background ,color)))))
      (put 'cursor 'face-modified t))))