diff options
author | Chong Yidong <cyd@gnu.org> | 2012-04-27 13:40:46 +0800 |
---|---|---|
committer | Chong Yidong <cyd@gnu.org> | 2012-04-27 13:40:46 +0800 |
commit | 15cd8efd049338ec4a42ba00e96d2baf2c3cc51a (patch) | |
tree | 53a9ec557ed6c37b2a0e60abc1bf46d349df7554 /lisp/startup.el | |
parent | a8e7d6d783219972c08fd49a3a2afaf26eb139c2 (diff) | |
download | emacs-15cd8efd049338ec4a42ba00e96d2baf2c3cc51a.tar.gz emacs-15cd8efd049338ec4a42ba00e96d2baf2c3cc51a.tar.bz2 emacs-15cd8efd049338ec4a42ba00e96d2baf2c3cc51a.zip |
Fix application of menu-bar-mode etc. by X resources.
* lisp/startup.el (x-apply-session-resources): New function.
* lisp/term/ns-win.el (ns-initialize-window-system):
* lisp/term/w32-win.el (w32-initialize-window-system):
* lisp/term/x-win.el (x-initialize-window-system): Use it to properly
set menu-bar-mode and other vars from X resources, even if the initial
frame is not a window-system frame (Bug#2299).
Diffstat (limited to 'lisp/startup.el')
-rw-r--r-- | lisp/startup.el | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/lisp/startup.el b/lisp/startup.el index d6e73023699..862e14f0c9d 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -905,33 +905,12 @@ Amongst another things, it parses the command-line arguments." (run-hooks 'before-init-hook) - ;; Under X, this creates the X frame and deletes the terminal frame. + ;; Under X, create the X frame and delete the terminal frame. (unless (daemonp) - - ;; If X resources are available, use them to initialize the values - ;; of `tool-bar-mode' and `menu-bar-mode', as well as the value of - ;; `no-blinking-cursor' and the `cursor' face. - (cond - ((or noninteractive emacs-basic-display) - (setq menu-bar-mode nil - tool-bar-mode nil - no-blinking-cursor t)) - ((memq initial-window-system '(x w32 ns)) - (let ((no-vals '("no" "off" "false" "0"))) - (if (member (x-get-resource "menuBar" "MenuBar") no-vals) - (setq menu-bar-mode nil)) - (if (member (x-get-resource "toolBar" "ToolBar") no-vals) - (setq tool-bar-mode nil)) - (if (member (x-get-resource "cursorBlink" "CursorBlink") - no-vals) - (setq no-blinking-cursor t))) - ;; If the cursorColor X resource exists, alter the `cursor' face - ;; spec, but mark it as changed outside of Customize. - (let ((color (x-get-resource "cursorColor" "Foreground"))) - (when color - (put 'cursor 'theme-face - `((changed ((t :background ,color))))) - (put 'cursor 'face-modified t))))) + (if (or noninteractive emacs-basic-display) + (setq menu-bar-mode nil + tool-bar-mode nil + no-blinking-cursor t)) (frame-initialize)) (when (fboundp 'x-create-frame) @@ -1266,6 +1245,29 @@ the `--debug-init' option to view a complete error backtrace." (with-no-warnings (emacs-session-restore x-session-previous-id)))) +(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 `x-initialize-window-system' 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', and +`no-blinking-cursor', 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) + ("cursorBlink" "CursorBlink" no-blinking-cursor t)))) + (dolist (x settings) + (if (member (x-get-resource (nth 0 x) (nth 1 x)) no-vals) + (set (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)))) + (defcustom initial-scratch-message (purecopy "\ ;; This buffer is for notes you don't want to save, and for Lisp evaluation. ;; If you want to create a file, visit that file with C-x C-f, |