Commit 4ad11f8c authored by Chong Yidong's avatar Chong Yidong

Set default-frame-alist, if necessary, in menu/tool-bar-mode.

* menu-bar.el (menu-bar-mode):
* tool-bar.el (tool-bar-mode): Replace default-frame-alist element
if it has been set.
parent 81133808
2010-07-05 Chong Yidong <cyd@stupidchicken.com>
* menu-bar.el (menu-bar-mode):
* tool-bar.el (tool-bar-mode): Replace default-frame-alist element
if it has been set.
* mouse.el (mouse-drag-track): Call mouse-start-end to handle
word/line selection (Bug#6565).
......
......@@ -1937,15 +1937,20 @@ turn on menu bars; otherwise, turn off menu bars."
;; 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)))
(set-frame-parameter frame 'menu-bar-lines val))
;; If the user has given `default-frame-alist' a `menu-bar-lines'
;; parameter, replace it.
(if (assq 'menu-bar-lines default-frame-alist)
(setq default-frame-alist
(cons (cons 'menu-bar-lines val)
(assq-delete-all 'menu-bar-lines
default-frame-alist)))))
;; Make the message appear when Emacs is idle. We can not call message
;; directly. The minor-mode message "Menu-bar mode disabled" comes
;; after this function returns, overwriting any message we do here.
(when (and (called-interactively-p 'interactive) (not menu-bar-mode))
(run-with-idle-timer 0 nil 'message
"Menu-bar mode disabled. Use M-x menu-bar-mode to make the menu bar appear."))
menu-bar-mode)
"Menu-bar mode disabled. Use M-x menu-bar-mode to make the menu bar appear.")))
(defun toggle-menu-bar-mode-from-frame (&optional arg)
"Toggle menu bar on or off, based on the status of the current frame.
......
......@@ -52,13 +52,19 @@ conveniently adding tool bar items."
:global t
:group 'mouse
:group 'frames
;; 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))))
(set-frame-parameter frame 'tool-bar-lines val))
;; If the user has given `default-frame-alist' a `tool-bar-lines'
;; parameter, replace it.
(if (assq 'tool-bar-lines default-frame-alist)
(setq default-frame-alist
(cons (cons 'tool-bar-lines val)
(assq-delete-all 'tool-bar-lines
default-frame-alist)))))
(and tool-bar-mode
(= 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.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment