emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/emacs-24 r108053: Fix application of menu-b


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-24 r108053: Fix application of menu-bar-mode etc. by X resources.
Date: Fri, 02 Nov 2012 02:26:12 -0000
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 108053
fixes bug: http://debbugs.gnu.org/2299
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Fri 2012-04-27 13:40:46 +0800
message:
  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).
modified:
  lisp/ChangeLog
  lisp/startup.el
  lisp/term/ns-win.el
  lisp/term/w32-win.el
  lisp/term/x-win.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-04-27 03:10:38 +0000
+++ b/lisp/ChangeLog    2012-04-27 05:40:46 +0000
@@ -1,5 +1,13 @@
 2012-04-27  Chong Yidong  <address@hidden>
 
+       * 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).
 

=== modified file 'lisp/startup.el'
--- a/lisp/startup.el   2012-04-27 03:10:38 +0000
+++ b/lisp/startup.el   2012-04-27 05:40:46 +0000
@@ -905,33 +905,12 @@
 
   (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 @@
       (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,

=== modified file 'lisp/term/ns-win.el'
--- a/lisp/term/ns-win.el       2012-04-26 12:43:28 +0000
+++ b/lisp/term/ns-win.el       2012-04-27 05:40:46 +0000
@@ -923,6 +923,7 @@
   ;; 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))

=== modified file 'lisp/term/w32-win.el'
--- a/lisp/term/w32-win.el      2012-04-07 13:57:36 +0000
+++ b/lisp/term/w32-win.el      2012-04-27 05:40:46 +0000
@@ -309,6 +309,7 @@
 
   ;; 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))

=== modified file 'lisp/term/x-win.el'
--- a/lisp/term/x-win.el        2012-02-25 03:01:11 +0000
+++ b/lisp/term/x-win.el        2012-04-27 05:40:46 +0000
@@ -1445,6 +1445,7 @@
   ;;                   :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))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]