aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorEli Zaretskii2010-12-09 21:07:53 +0200
committerEli Zaretskii2010-12-09 21:07:53 +0200
commitf68ab99bc19e7819788acd173e989aa5f52d94f7 (patch)
tree4b2cd2033ead2a4e5464096791e365a06df30f84 /lisp
parent99139556b846a507d121a436786039d7c716a5a0 (diff)
downloademacs-f68ab99bc19e7819788acd173e989aa5f52d94f7.tar.gz
emacs-f68ab99bc19e7819788acd173e989aa5f52d94f7.zip
Fix bug #1077 with popping new frames from a minibuffer-only frame.
menu-bar.el (menu-bar-frame-for-menubar, menu-bar-positive-p): New functions. (menu-bar-showhide-menu) <menu-bar-mode, showhide-tool-bar>: Use them instead of `nil' and `>', respectively. (menu-bar-showhide-tool-bar-menu): Use menu-bar-frame-for-menubar instead of `nil'. (toggle-menu-bar-mode-from-frame): Use menu-bar-frame-for-menubar and menu-bar-positive-p instead of `nil' and `>', respectively.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog12
-rw-r--r--lisp/menu-bar.el43
2 files changed, 47 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 49e4f1a9d04..cb3846c6f46 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,15 @@
12010-12-09 Eli Zaretskii <eliz@gnu.org>
2
3 * menu-bar.el (menu-bar-frame-for-menubar, menu-bar-positive-p):
4 New functions.
5 (menu-bar-showhide-menu) <menu-bar-mode, showhide-tool-bar>: Use
6 them instead of `nil' and `>', respectively.
7 (menu-bar-showhide-tool-bar-menu): Use menu-bar-frame-for-menubar
8 instead of `nil'.
9 (toggle-menu-bar-mode-from-frame): Use menu-bar-frame-for-menubar
10 and menu-bar-positive-p instead of `nil' and `>', respectively.
11 (Bug#1077)
12
12010-12-09 Vinicius Jose Latorre <viniciusjl@ig.com.br> 132010-12-09 Vinicius Jose Latorre <viniciusjl@ig.com.br>
2 14
3 * whitespace.el (whitespace-newline-mode): Code fix. 15 * whitespace.el (whitespace-newline-mode): Code fix.
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index a3a28c3dcfc..4708c52e12e 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -1020,10 +1020,24 @@ mail status in mode line"))
1020 :visible (and (display-graphic-p) (fboundp 'x-show-tip)) 1020 :visible (and (display-graphic-p) (fboundp 'x-show-tip))
1021 :button (:toggle . tooltip-mode))) 1021 :button (:toggle . tooltip-mode)))
1022 1022
1023(defun menu-bar-frame-for-menubar ()
1024 "Return the frame suitable for updating the menu bar."
1025 (or (and (framep menu-updating-frame)
1026 menu-updating-frame)
1027 (selected-frame)))
1028
1029(defun menu-bar-positive-p (val)
1030 "Return non-nil iff VAL is a positive number."
1031 (and (numberp val)
1032 (> val 0)))
1033
1023(define-key menu-bar-showhide-menu [menu-bar-mode] 1034(define-key menu-bar-showhide-menu [menu-bar-mode]
1024 `(menu-item ,(purecopy "Menu-bar") toggle-menu-bar-mode-from-frame 1035 `(menu-item ,(purecopy "Menu-bar") toggle-menu-bar-mode-from-frame
1025 :help ,(purecopy "Turn menu-bar on/off") 1036 :help ,(purecopy "Turn menu-bar on/off")
1026 :button (:toggle . (> (frame-parameter nil 'menu-bar-lines) 0)))) 1037 :button
1038 (:toggle . (menu-bar-positive-p
1039 (frame-parameter (menu-bar-frame-for-menubar)
1040 'menu-bar-lines)))))
1027 1041
1028(defun menu-bar-set-tool-bar-position (position) 1042(defun menu-bar-set-tool-bar-position (position)
1029 (customize-set-variable 'tool-bar-mode t) 1043 (customize-set-variable 'tool-bar-mode t)
@@ -1060,7 +1074,9 @@ mail status in mode line"))
1060 :visible (display-graphic-p) 1074 :visible (display-graphic-p)
1061 :button 1075 :button
1062 (:radio . (and tool-bar-mode 1076 (:radio . (and tool-bar-mode
1063 (eq (frame-parameter nil 'tool-bar-position) 1077 (eq (frame-parameter
1078 (menu-bar-frame-for-menubar)
1079 'tool-bar-position)
1064 'left))))) 1080 'left)))))
1065 1081
1066 (define-key menu-bar-showhide-tool-bar-menu [showhide-tool-bar-right] 1082 (define-key menu-bar-showhide-tool-bar-menu [showhide-tool-bar-right]
@@ -1070,7 +1086,9 @@ mail status in mode line"))
1070 :visible (display-graphic-p) 1086 :visible (display-graphic-p)
1071 :button 1087 :button
1072 (:radio . (and tool-bar-mode 1088 (:radio . (and tool-bar-mode
1073 (eq (frame-parameter nil 'tool-bar-position) 1089 (eq (frame-parameter
1090 (menu-bar-frame-for-menubar)
1091 'tool-bar-position)
1074 'right))))) 1092 'right)))))
1075 1093
1076 (define-key menu-bar-showhide-tool-bar-menu [showhide-tool-bar-bottom] 1094 (define-key menu-bar-showhide-tool-bar-menu [showhide-tool-bar-bottom]
@@ -1080,7 +1098,9 @@ mail status in mode line"))
1080 :visible (display-graphic-p) 1098 :visible (display-graphic-p)
1081 :button 1099 :button
1082 (:radio . (and tool-bar-mode 1100 (:radio . (and tool-bar-mode
1083 (eq (frame-parameter nil 'tool-bar-position) 1101 (eq (frame-parameter
1102 (menu-bar-frame-for-menubar)
1103 'tool-bar-position)
1084 'bottom))))) 1104 'bottom)))))
1085 1105
1086 (define-key menu-bar-showhide-tool-bar-menu [showhide-tool-bar-top] 1106 (define-key menu-bar-showhide-tool-bar-menu [showhide-tool-bar-top]
@@ -1090,7 +1110,9 @@ mail status in mode line"))
1090 :visible (display-graphic-p) 1110 :visible (display-graphic-p)
1091 :button 1111 :button
1092 (:radio . (and tool-bar-mode 1112 (:radio . (and tool-bar-mode
1093 (eq (frame-parameter nil 'tool-bar-position) 1113 (eq (frame-parameter
1114 (menu-bar-frame-for-menubar)
1115 'tool-bar-position)
1094 'top))))) 1116 'top)))))
1095 1117
1096 (define-key menu-bar-showhide-tool-bar-menu [showhide-tool-bar-none] 1118 (define-key menu-bar-showhide-tool-bar-menu [showhide-tool-bar-none]
@@ -1110,8 +1132,10 @@ mail status in mode line"))
1110 `(menu-item ,(purecopy "Tool-bar") toggle-tool-bar-mode-from-frame 1132 `(menu-item ,(purecopy "Tool-bar") toggle-tool-bar-mode-from-frame
1111 :help ,(purecopy "Turn tool-bar on/off") 1133 :help ,(purecopy "Turn tool-bar on/off")
1112 :visible (display-graphic-p) 1134 :visible (display-graphic-p)
1113 :button (:toggle . (> (frame-parameter nil 'tool-bar-lines) 0)))) 1135 :button
1114) 1136 (:toggle . (menu-bar-positive-p
1137 (frame-parameter (menu-bar-frame-for-menubar)
1138 'tool-bar-lines))))))
1115 1139
1116(define-key menu-bar-options-menu [showhide] 1140(define-key menu-bar-options-menu [showhide]
1117 `(menu-item ,(purecopy "Show/Hide") ,menu-bar-showhide-menu)) 1141 `(menu-item ,(purecopy "Show/Hide") ,menu-bar-showhide-menu))
@@ -2109,7 +2133,10 @@ turn on menu bars; otherwise, turn off menu bars."
2109See `menu-bar-mode' for more information." 2133See `menu-bar-mode' for more information."
2110 (interactive (list (or current-prefix-arg 'toggle))) 2134 (interactive (list (or current-prefix-arg 'toggle)))
2111 (if (eq arg 'toggle) 2135 (if (eq arg 'toggle)
2112 (menu-bar-mode (if (> (frame-parameter nil 'menu-bar-lines) 0) 0 1)) 2136 (menu-bar-mode
2137 (if (menu-bar-positive-p
2138 (frame-parameter (menu-bar-frame-for-menubar) 'menu-bar-lines))
2139 0 1))
2113 (menu-bar-mode arg))) 2140 (menu-bar-mode arg)))
2114 2141
2115(declare-function x-menu-bar-open "term/x-win" (&optional frame)) 2142(declare-function x-menu-bar-open "term/x-win" (&optional frame))