[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r100650: Change default-frame-alist a
From: |
Chong Yidong |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r100650: Change default-frame-alist and menu/tool-bar-mode interaction (Bug#2249). |
Date: |
Sat, 26 Jun 2010 20:30:52 -0400 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 100650
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Sat 2010-06-26 20:30:52 -0400
message:
Change default-frame-alist and menu/tool-bar-mode interaction (Bug#2249).
Don't add entries for `menu-bar-lines' and `tool-bar-lines' to
`default-frame-alist' and `initial-frame-alist' at startup.
Instead, use X resources to update the `menu-bar-mode' and
`tool-bar-mode' variables at startup, and use them as defaults during
frame creation.
* lisp/frame.el (frame-notice-user-settings): Don't change
default-frame-alist based on menu-bar-mode and tool-bar-mode, or
vice versa.
* lisp/menu-bar.el (menu-bar-mode):
* lisp/tool-bar.el (tool-bar-mode): Don't change default-frame-alist.
Set init-value to t.
* lisp/startup.el (command-line): Use X resources to set the value of
menu-bar-mode and tool-bar-mode, before calling frame-initialize.
* src/frame.c (Vmenu_bar_mode, Vtool_bar_mode): New vars.
* src/w32fns.c (Fx_create_frame):
* src/nsfns.m (Fx_create_frame): Likewise.
* src/xfns.c (Fx_create_frame): Don't consult X resouces when setting
menu-bar-lines and tool-bar-lines. Use menu-bar-mode and
tool-bar-mode, which are now set using these X resources at
startup, to determine the defaults.
modified:
etc/NEWS
lisp/ChangeLog
lisp/frame.el
lisp/menu-bar.el
lisp/startup.el
lisp/tool-bar.el
src/ChangeLog
src/frame.c
src/nsfns.m
src/w32fns.c
src/xfns.c
=== modified file 'etc/NEWS'
--- a/etc/NEWS 2010-06-17 02:08:10 +0000
+++ b/etc/NEWS 2010-06-27 00:30:52 +0000
@@ -275,6 +275,15 @@
** Passing a nil argument to a minor mode function now turns the mode
ON unconditionally.
+
+** During startup, Emacs no longer adds entries for `menu-bar-lines'
+and `tool-bar-lines' to `default-frame-alist' and
+`initial-frame-alist'. With these alist entries omitted, `make-frame'
+checks the value of the variable `menu-bar-mode'/`tool-bar-mode' to
+determine whether to create a menu-bar or tool-bar, respectively.
+If the alist entries are added, they override the value of
+`menu-bar-mode'/`tool-bar-mode'.
+
* Lisp changes in Emacs 24.1
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2010-06-26 12:11:06 +0000
+++ b/lisp/ChangeLog 2010-06-27 00:30:52 +0000
@@ -1,3 +1,16 @@
+2010-06-27 Chong Yidong <address@hidden>
+
+ * startup.el (command-line): Use X resources to set the value of
+ menu-bar-mode and tool-bar-mode, before calling frame-initialize.
+
+ * menu-bar.el (menu-bar-mode):
+ * tool-bar.el (tool-bar-mode): Don't change default-frame-alist.
+ Set init-value to t.
+
+ * frame.el (frame-notice-user-settings): Don't change
+ default-frame-alist based on menu-bar-mode and tool-bar-mode, or
+ vice versa (Bug#2249).
+
2010-06-26 Eli Zaretskii <address@hidden>
* w32-fns.el (w32-convert-standard-filename): Doc fix.
=== modified file 'lisp/frame.el'
--- a/lisp/frame.el 2010-06-25 19:32:37 +0000
+++ b/lisp/frame.el 2010-06-27 00:30:52 +0000
@@ -39,13 +39,6 @@
(defvar window-system-default-frame-alist nil
"Alist of window-system dependent default frame parameters.
-You can set this in your init file; for example,
-
- ;; Disable menubar and toolbar on the console, but enable them under X.
- (setq window-system-default-frame-alist
- '((x (menu-bar-lines . 1) (tool-bar-lines . 1))
- (nil (menu-bar-lines . 0) (tool-bar-lines . 0))))
-
Parameters specified here supersede the values given in
`default-frame-alist'.")
@@ -287,36 +280,6 @@
React to settings of `initial-frame-alist',
`window-system-default-frame-alist' and `default-frame-alist'
there (in decreasing order of priority)."
- ;; Make menu-bar-mode and default-frame-alist consistent.
- (when (boundp 'menu-bar-mode)
- (let ((default (assq 'menu-bar-lines default-frame-alist)))
- (if default
- (setq menu-bar-mode (not (eq (cdr default) 0)))
- (setq default-frame-alist
- (cons (cons 'menu-bar-lines (if menu-bar-mode 1 0))
- default-frame-alist)))))
-
- ;; Make tool-bar-mode and default-frame-alist consistent. Don't do
- ;; it in batch mode since that would leave a tool-bar-lines
- ;; parameter in default-frame-alist in a dumped Emacs, which is not
- ;; what we want.
- (when (and (boundp 'tool-bar-mode)
- (not noninteractive))
- (let ((default (assq 'tool-bar-lines default-frame-alist)))
- (if default
- (setq tool-bar-mode (not (eq (cdr default) 0)))
- ;; If Emacs was started on a tty, changing default-frame-alist
- ;; would disable the toolbar on X frames created later. We
- ;; want to keep the default of showing a toolbar under X even
- ;; in this case.
- ;;
- ;; If the user explicitly called `tool-bar-mode' in .emacs,
- ;; then default-frame-alist is already changed anyway.
- (when initial-window-system
- (setq default-frame-alist
- (cons (cons 'tool-bar-lines (if tool-bar-mode 1 0))
- default-frame-alist))))))
-
;; Creating and deleting frames may shift the selected frame around,
;; and thus the current buffer. Protect against that. We don't
;; want to use save-excursion here, because that may also try to set
=== modified file 'lisp/menu-bar.el'
--- a/lisp/menu-bar.el 2010-06-19 22:36:51 +0000
+++ b/lisp/menu-bar.el 2010-06-27 00:30:52 +0000
@@ -1924,28 +1924,20 @@
`(menu-item ,(purecopy "Previous History Item") previous-history-element
:help ,(purecopy "Put previous minibuffer history element in
the minibuffer"))))
-;;;###autoload
-;; This comment is taken from tool-bar.el near
-;; (put 'tool-bar-mode ...)
-;; We want to pretend the menu bar by standard is on, as this will make
-;; customize consider disabling the menu bar a customization, and save
-;; that. We could do this for real by setting :init-value below, but
-;; that would overwrite disabling the tool bar from X resources.
-(put 'menu-bar-mode 'standard-value '(t))
-
(define-minor-mode menu-bar-mode
"Toggle display of a menu bar on each frame.
This command applies to all frames that exist and frames to be
created in the future.
With a numeric argument, if the argument is positive,
turn on menu bars; otherwise, turn off menu bars."
- :init-value nil
+ :init-value t
:global t
:group 'frames
- ;; Make menu-bar-mode and default-frame-alist consistent.
- (modify-all-frames-parameters (list (cons 'menu-bar-lines
- (if menu-bar-mode 1 0))))
+ ;; Turn the menu-bars on all frames on or off.
+ (let ((val (if menu-bar-mode 1 0)))
+ (dolist (frame (frame-list))
+ (set-frame-parameter frame 'menu-bar-lines val)))
;; Make the message appear when Emacs is idle. We can not call message
;; directly. The minor-mode message "Menu-bar mode disabled" comes
=== modified file 'lisp/startup.el'
--- a/lisp/startup.el 2010-06-17 02:08:10 +0000
+++ b/lisp/startup.el 2010-06-27 00:30:52 +0000
@@ -878,10 +878,32 @@
(run-hooks 'before-init-hook)
- ;; Under X Window, this creates the X frame and deletes the terminal frame.
+ ;; Under X, this creates the X frame and deletes the terminal frame.
(unless (daemonp)
+ ;; Enable or disable the tool-bar and menu-bar.
+ ;; While we're at it, set `no-blinking-cursor' too.
+ (cond
+ ((or noninteractive emacs-basic-display)
+ (setq menu-bar-mode nil
+ tool-bar-mode nil
+ no-blinking-cursor t))
+ ;; Check X resources if available.
+ ((memq initial-window-system '(x w32 ns))
+ (let ((no-vals '("no" "off" "false")))
+ (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)))))
(frame-initialize))
+ ;; Set up the tool-bar (even in tty frames, since Emacs might open a
+ ;; graphical frame later).
+ (unless noninteractive
+ (tool-bar-setup))
+
;; Turn off blinking cursor if so specified in X resources. This is here
;; only because all other settings of no-blinking-cursor are here.
(unless (or noninteractive
@@ -891,25 +913,6 @@
'("off" "false")))))
(setq no-blinking-cursor t))
- ;; If frame was created with a menu bar, set menu-bar-mode on.
- (unless (or noninteractive
- emacs-basic-display
- (and (memq initial-window-system '(x w32))
- (<= (frame-parameter nil 'menu-bar-lines) 0)))
- (menu-bar-mode 1))
-
- (unless (or noninteractive (not (fboundp 'tool-bar-mode)))
- ;; Set up the tool-bar. Do this even in tty frames, so that there
- ;; is a tool-bar if Emacs later opens a graphical frame.
- (if (or emacs-basic-display
- (and (numberp (frame-parameter nil 'tool-bar-lines))
- (<= (frame-parameter nil 'tool-bar-lines) 0)))
- ;; On a graphical display with the toolbar disabled via X
- ;; resources, set up the toolbar without enabling it.
- (tool-bar-setup)
- ;; Otherwise, enable tool-bar-mode.
- (tool-bar-mode 1)))
-
;; Re-evaluate predefined variables whose initial value depends on
;; the runtime context.
(mapc 'custom-reevaluate-setting
=== modified file 'lisp/tool-bar.el'
--- a/lisp/tool-bar.el 2010-04-25 07:23:01 +0000
+++ b/lisp/tool-bar.el 2010-06-27 00:30:52 +0000
@@ -48,21 +48,17 @@
See `tool-bar-add-item' and `tool-bar-add-item-from-menu' for
conveniently adding tool bar items."
- :init-value nil
+ :init-value t
:global t
:group 'mouse
:group 'frames
- (if tool-bar-mode
- (progn
- ;; Make one tool-bar-line for any - including non-graphical -
- ;; terminal, see Bug#1754. If this causes problems, we should
- ;; handle the problem in `modify-frame-parameters' or do not
- ;; call `modify-all-frames-parameters' when toggling the tool
- ;; bar off either.
- (modify-all-frames-parameters (list (cons 'tool-bar-lines 1)))
- (if (= 1 (length (default-value 'tool-bar-map))) ; not yet setup
- (tool-bar-setup)))
- (modify-all-frames-parameters (list (cons 'tool-bar-lines 0)))))
+ ;; Make tool-bar even if terminal is non-graphical (Bug#1754).
+ (let ((val (if tool-bar-mode 1 0)))
+ (dolist (frame (frame-list))
+ (set-frame-parameter frame 'tool-bar-lines val)))
+ (when tool-bar-mode
+ (if (= 1 (length (default-value 'tool-bar-map))) ; not yet setup
+ (tool-bar-setup))))
;;;###autoload
;; Used in the Show/Hide menu, to have the toggle reflect the current frame.
@@ -74,17 +70,6 @@
(tool-bar-mode (if (> (frame-parameter nil 'tool-bar-lines) 0) 0 1))
(tool-bar-mode arg)))
-;;;###autoload
-;; We want to pretend the toolbar by standard is on, as this will make
-;; customize consider disabling the toolbar a customization, and save
-;; that. We could do this for real by setting :init-value above, but
-;; that would turn on the toolbar in MS Windows where it is currently
-;; useless, and it would overwrite disabling the tool bar from X
-;; resources. If anyone want to implement this in a cleaner way,
-;; please do so.
-;; -- Per Abrahamsen <address@hidden> 2002-02-21.
-(put 'tool-bar-mode 'standard-value '(t))
-
(defvar tool-bar-map (make-sparse-keymap)
"Keymap for the tool bar.
Define this locally to override the global tool bar.")
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2010-06-25 19:32:37 +0000
+++ b/src/ChangeLog 2010-06-27 00:30:52 +0000
@@ -1,3 +1,15 @@
+2010-06-27 Chong Yidong <address@hidden>
+
+ * xfns.c (Fx_create_frame): Don't consult X resouces when setting
+ menu-bar-lines and tool-bar-lines. Use menu-bar-mode and
+ tool-bar-mode, which are now set using these X resources at
+ startup, to determine the defaults (Bug#2249).
+
+ * w32fns.c (Fx_create_frame):
+ * nsfns.m (Fx_create_frame): Likewise.
+
+ * frame.c (Vmenu_bar_mode, Vtool_bar_mode): New vars.
+
2010-06-24 Juanma Barranquero <address@hidden>
* gtkutil.c (xg_update_scrollbar_pos):
=== modified file 'src/frame.c'
--- a/src/frame.c 2010-06-25 19:32:37 +0000
+++ b/src/frame.c 2010-06-27 00:30:52 +0000
@@ -119,6 +119,7 @@
Lisp_Object Qexplicit_name;
Lisp_Object Qunsplittable;
Lisp_Object Qmenu_bar_lines, Qtool_bar_lines;
+Lisp_Object Vmenu_bar_mode, Vtool_bar_mode;
Lisp_Object Qleft_fringe, Qright_fringe;
Lisp_Object Qbuffer_predicate, Qbuffer_list, Qburied_buffer_list;
Lisp_Object Qtty_color_mode;
@@ -4648,6 +4649,14 @@
Qdelete_frame_functions = intern_c_string ("delete-frame-functions");
staticpro (&Qdelete_frame_functions);
+ DEFVAR_LISP ("menu-bar-mode", &Vmenu_bar_mode,
+ doc: /* Non-nil if Menu-Bar mode is enabled. */);
+ Vmenu_bar_mode = Qt;
+
+ DEFVAR_LISP ("tool-bar-mode", &Vtool_bar_mode,
+ doc: /* Non-nil if Tool-Bar mode is enabled. */);
+ Vtool_bar_mode = Qt;
+
DEFVAR_KBOARD ("default-minibuffer-frame", Vdefault_minibuffer_frame,
doc: /* Minibufferless frames use this frame's minibuffer.
=== modified file 'src/nsfns.m'
--- a/src/nsfns.m 2010-06-02 04:29:53 +0000
+++ b/src/nsfns.m 2010-06-27 00:30:52 +0000
@@ -1234,10 +1234,18 @@
init_frame_faces (f);
- x_default_parameter (f, parms, Qmenu_bar_lines, make_number (0), "menuBar",
- "menuBar", RES_TYPE_NUMBER);
- x_default_parameter (f, parms, Qtool_bar_lines, make_number (0), "toolBar",
- "toolBar", RES_TYPE_NUMBER);
+ /* The X resources controlling the menu-bar and tool-bar are
+ processed specially at startup, and reflected in the mode
+ variables; ignore them here. */
+ x_default_parameter (f, parms, Qmenu_bar_lines,
+ NILP (Vmenu_bar_mode)
+ ? make_number (0) : make_number (1),
+ NULL, NULL, RES_TYPE_NUMBER);
+ x_default_parameter (f, parms, Qtool_bar_lines,
+ NILP (Vtool_bar_mode)
+ ? make_number (0) : make_number (1),
+ NULL, NULL, RES_TYPE_NUMBER);
+
x_default_parameter (f, parms, Qbuffer_predicate, Qnil, "bufferPredicate",
"BufferPredicate", RES_TYPE_SYMBOL);
x_default_parameter (f, parms, Qtitle, Qnil, "title", "Title",
=== modified file 'src/w32fns.c'
--- a/src/w32fns.c 2010-05-11 21:02:32 +0000
+++ b/src/w32fns.c 2010-06-27 00:30:52 +0000
@@ -290,6 +290,7 @@
/* The below are defined in frame.c. */
+extern Lisp_Object Vmenu_bar_mode, Vtool_bar_mode;
extern Lisp_Object Vwindow_system_version;
#ifdef GLYPH_DEBUG
@@ -4462,10 +4463,17 @@
happen. */
init_frame_faces (f);
- x_default_parameter (f, parameters, Qmenu_bar_lines, make_number (1),
- "menuBar", "MenuBar", RES_TYPE_NUMBER);
- x_default_parameter (f, parameters, Qtool_bar_lines, make_number (1),
- "toolBar", "ToolBar", RES_TYPE_NUMBER);
+ /* The X resources controlling the menu-bar and tool-bar are
+ processed specially at startup, and reflected in the mode
+ variables; ignore them here. */
+ x_default_parameter (f, parameters, Qmenu_bar_lines,
+ NILP (Vmenu_bar_mode)
+ ? make_number (0) : make_number (1),
+ NULL, NULL, RES_TYPE_NUMBER);
+ x_default_parameter (f, parameters, Qtool_bar_lines,
+ NILP (Vtool_bar_mode)
+ ? make_number (0) : make_number (1),
+ NULL, NULL, RES_TYPE_NUMBER);
x_default_parameter (f, parameters, Qbuffer_predicate, Qnil,
"bufferPredicate", "BufferPredicate", RES_TYPE_SYMBOL);
=== modified file 'src/xfns.c'
--- a/src/xfns.c 2010-06-22 07:55:08 +0000
+++ b/src/xfns.c 2010-06-27 00:30:52 +0000
@@ -204,6 +204,8 @@
/* The below are defined in frame.c. */
+extern Lisp_Object Vmenu_bar_mode, Vtool_bar_mode;
+
#if GLYPH_DEBUG
int image_cache_refcount, dpyinfo_refcount;
#endif
@@ -3450,10 +3452,18 @@
happen. */
init_frame_faces (f);
- x_default_parameter (f, parms, Qmenu_bar_lines, make_number (1),
- "menuBar", "MenuBar", RES_TYPE_BOOLEAN_NUMBER);
- x_default_parameter (f, parms, Qtool_bar_lines, make_number (1),
- "toolBar", "ToolBar", RES_TYPE_NUMBER);
+ /* The X resources controlling the menu-bar and tool-bar are
+ processed specially at startup, and reflected in the mode
+ variables; ignore them here. */
+ x_default_parameter (f, parms, Qmenu_bar_lines,
+ NILP (Vmenu_bar_mode)
+ ? make_number (0) : make_number (1),
+ NULL, NULL, RES_TYPE_NUMBER);
+ x_default_parameter (f, parms, Qtool_bar_lines,
+ NILP (Vtool_bar_mode)
+ ? make_number (0) : make_number (1),
+ NULL, NULL, RES_TYPE_NUMBER);
+
x_default_parameter (f, parms, Qbuffer_predicate, Qnil,
"bufferPredicate", "BufferPredicate",
RES_TYPE_SYMBOL);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r100650: Change default-frame-alist and menu/tool-bar-mode interaction (Bug#2249).,
Chong Yidong <=