summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/startup.el54
-rw-r--r--lisp/term/ns-win.el1
-rw-r--r--lisp/term/w32-win.el1
-rw-r--r--lisp/term/x-win.el1
5 files changed, 39 insertions, 26 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f88a386178f..6710082665a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,13 @@
2012-04-27 Chong Yidong <cyd@gnu.org>
+ * startup.el (x-apply-session-resources): New function.
+
+ * term/ns-win.el (ns-initialize-window-system):
+ * term/w32-win.el (w32-initialize-window-system):
+ * 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).
+
* subr.el (read-key): Avoid running filter function when setting
up temporary tool bar entries (Bug#9922).
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,
diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el
index feac0f1c537..6dd9eed0d2b 100644
--- a/lisp/term/ns-win.el
+++ b/lisp/term/ns-win.el
@@ -923,6 +923,7 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
;; http://lists.gnu.org/archive/html/emacs-devel/2011-06/msg00505.html
(ns-set-resource nil "ApplePressAndHoldEnabled" "NO")
+ (x-apply-session-resources)
(setq ns-initialized t))
(add-to-list 'handle-args-function-alist '(ns . x-handle-args))
diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el
index 3e1c4161667..a4fac3441db 100644
--- a/lisp/term/w32-win.el
+++ b/lisp/term/w32-win.el
@@ -309,6 +309,7 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
;; Set to a system sound if you want a fancy bell.
(set-message-beep 'ok)
+ (x-apply-session-resources)
(setq w32-initialized t))
(add-to-list 'handle-args-function-alist '(w32 . x-handle-args))
diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el
index 21d49267b21..498cc01fe22 100644
--- a/lisp/term/x-win.el
+++ b/lisp/term/x-win.el
@@ -1445,6 +1445,7 @@ Request data types in the order specified by `x-select-request-type'."
;; :help "Paste (yank) text most recently cut/copied")
;; nil))
+ (x-apply-session-resources)
(setq x-initialized t))
(add-to-list 'handle-args-function-alist '(x . x-handle-args))