aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2012-04-27 13:40:46 +0800
committerChong Yidong2012-04-27 13:40:46 +0800
commit15cd8efd049338ec4a42ba00e96d2baf2c3cc51a (patch)
tree53a9ec557ed6c37b2a0e60abc1bf46d349df7554
parenta8e7d6d783219972c08fd49a3a2afaf26eb139c2 (diff)
downloademacs-15cd8efd049338ec4a42ba00e96d2baf2c3cc51a.tar.gz
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).
-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 @@
12012-04-27 Chong Yidong <cyd@gnu.org> 12012-04-27 Chong Yidong <cyd@gnu.org>
2 2
3 * startup.el (x-apply-session-resources): New function.
4
5 * term/ns-win.el (ns-initialize-window-system):
6 * term/w32-win.el (w32-initialize-window-system):
7 * term/x-win.el (x-initialize-window-system): Use it to properly
8 set menu-bar-mode and other vars from X resources, even if the
9 initial frame is not a window-system frame (Bug#2299).
10
3 * subr.el (read-key): Avoid running filter function when setting 11 * subr.el (read-key): Avoid running filter function when setting
4 up temporary tool bar entries (Bug#9922). 12 up temporary tool bar entries (Bug#9922).
5 13
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."
905 905
906 (run-hooks 'before-init-hook) 906 (run-hooks 'before-init-hook)
907 907
908 ;; Under X, this creates the X frame and deletes the terminal frame. 908 ;; Under X, create the X frame and delete the terminal frame.
909 (unless (daemonp) 909 (unless (daemonp)
910 910 (if (or noninteractive emacs-basic-display)
911 ;; If X resources are available, use them to initialize the values 911 (setq menu-bar-mode nil
912 ;; of `tool-bar-mode' and `menu-bar-mode', as well as the value of 912 tool-bar-mode nil
913 ;; `no-blinking-cursor' and the `cursor' face. 913 no-blinking-cursor t))
914 (cond
915 ((or noninteractive emacs-basic-display)
916 (setq menu-bar-mode nil
917 tool-bar-mode nil
918 no-blinking-cursor t))
919 ((memq initial-window-system '(x w32 ns))
920 (let ((no-vals '("no" "off" "false" "0")))
921 (if (member (x-get-resource "menuBar" "MenuBar") no-vals)
922 (setq menu-bar-mode nil))
923 (if (member (x-get-resource "toolBar" "ToolBar") no-vals)
924 (setq tool-bar-mode nil))
925 (if (member (x-get-resource "cursorBlink" "CursorBlink")
926 no-vals)
927 (setq no-blinking-cursor t)))
928 ;; If the cursorColor X resource exists, alter the `cursor' face
929 ;; spec, but mark it as changed outside of Customize.
930 (let ((color (x-get-resource "cursorColor" "Foreground")))
931 (when color
932 (put 'cursor 'theme-face
933 `((changed ((t :background ,color)))))
934 (put 'cursor 'face-modified t)))))
935 (frame-initialize)) 914 (frame-initialize))
936 915
937 (when (fboundp 'x-create-frame) 916 (when (fboundp 'x-create-frame)
@@ -1266,6 +1245,29 @@ the `--debug-init' option to view a complete error backtrace."
1266 (with-no-warnings 1245 (with-no-warnings
1267 (emacs-session-restore x-session-previous-id)))) 1246 (emacs-session-restore x-session-previous-id))))
1268 1247
1248(defun x-apply-session-resources ()
1249 "Apply X resources which specify initial values for Emacs variables.
1250This is called from a window-system initialization function, such
1251as `x-initialize-window-system' for X, either at startup (prior
1252to reading the init file), or afterwards when the user first
1253opens a graphical frame.
1254
1255This can set the values of `menu-bar-mode', `tool-bar-mode', and
1256`no-blinking-cursor', as well as the `cursor' face. Changed
1257settings will be marked as \"CHANGED outside of Customize\"."
1258 (let ((no-vals '("no" "off" "false" "0"))
1259 (settings '(("menuBar" "MenuBar" menu-bar-mode nil)
1260 ("toolBar" "ToolBar" tool-bar-mode nil)
1261 ("cursorBlink" "CursorBlink" no-blinking-cursor t))))
1262 (dolist (x settings)
1263 (if (member (x-get-resource (nth 0 x) (nth 1 x)) no-vals)
1264 (set (nth 2 x) (nth 3 x)))))
1265 (let ((color (x-get-resource "cursorColor" "Foreground")))
1266 (when color
1267 (put 'cursor 'theme-face
1268 `((changed ((t :background ,color)))))
1269 (put 'cursor 'face-modified t))))
1270
1269(defcustom initial-scratch-message (purecopy "\ 1271(defcustom initial-scratch-message (purecopy "\
1270;; This buffer is for notes you don't want to save, and for Lisp evaluation. 1272;; This buffer is for notes you don't want to save, and for Lisp evaluation.
1271;; If you want to create a file, visit that file with C-x C-f, 1273;; 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.")
923 ;; http://lists.gnu.org/archive/html/emacs-devel/2011-06/msg00505.html 923 ;; http://lists.gnu.org/archive/html/emacs-devel/2011-06/msg00505.html
924 (ns-set-resource nil "ApplePressAndHoldEnabled" "NO") 924 (ns-set-resource nil "ApplePressAndHoldEnabled" "NO")
925 925
926 (x-apply-session-resources)
926 (setq ns-initialized t)) 927 (setq ns-initialized t))
927 928
928(add-to-list 'handle-args-function-alist '(ns . x-handle-args)) 929(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.")
309 309
310 ;; Set to a system sound if you want a fancy bell. 310 ;; Set to a system sound if you want a fancy bell.
311 (set-message-beep 'ok) 311 (set-message-beep 'ok)
312 (x-apply-session-resources)
312 (setq w32-initialized t)) 313 (setq w32-initialized t))
313 314
314(add-to-list 'handle-args-function-alist '(w32 . x-handle-args)) 315(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'."
1445 ;; :help "Paste (yank) text most recently cut/copied") 1445 ;; :help "Paste (yank) text most recently cut/copied")
1446 ;; nil)) 1446 ;; nil))
1447 1447
1448 (x-apply-session-resources)
1448 (setq x-initialized t)) 1449 (setq x-initialized t))
1449 1450
1450(add-to-list 'handle-args-function-alist '(x . x-handle-args)) 1451(add-to-list 'handle-args-function-alist '(x . x-handle-args))