diff options
| author | Stephen Berman | 2017-05-24 13:33:27 +0200 |
|---|---|---|
| committer | Stephen Berman | 2017-05-24 13:33:27 +0200 |
| commit | 08f00c01d6f19a3b4465cc856c6ae55a1acdc350 (patch) | |
| tree | 8b4a4bf033af807b81ebfde27ab9f764cceb9ec7 | |
| parent | bba9917299e3628e40462a762f2a14bb8df193f0 (diff) | |
| download | emacs-08f00c01d6f19a3b4465cc856c6ae55a1acdc350.tar.gz emacs-08f00c01d6f19a3b4465cc856c6ae55a1acdc350.zip | |
Fix and improve UI of scroll bar menu (bug#27047)
In addition, since the Emacs manual writes "scroll bar", "tool
bar" and "menu bar", use this convention in the Show/Hide menues
and tooltips as well.
* lisp/menu-bar.el (menu-bar-showhide-scroll-bar-menu): Make
pressing a radio button in the menu actually show that it was
pressed. Replace the two radio buttons to turn the horizontal
scroll bar on and off with a single check-box toggle and add a
separator between this and the vertical scroll bar radio
buttons. Use conventional spelling.
(menu-bar-horizontal-scroll-bar)
(menu-bar-no-horizontal-scroll-bar): Remove, since now unused.
(menu-bar-showhide-tool-bar-menu, menu-bar-showhide-menu)
(menu-bar-mode): Use conventional spelling.
| -rw-r--r-- | lisp/menu-bar.el | 92 |
1 files changed, 39 insertions, 53 deletions
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 6befa6d234e..9c7bcffbaab 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el | |||
| @@ -970,54 +970,40 @@ The selected font will be the default on both the existing and future frames." | |||
| 970 | (interactive) | 970 | (interactive) |
| 971 | (customize-set-variable 'scroll-bar-mode nil)) | 971 | (customize-set-variable 'scroll-bar-mode nil)) |
| 972 | 972 | ||
| 973 | (defun menu-bar-horizontal-scroll-bar () | ||
| 974 | "Display horizontal scroll bars on each window." | ||
| 975 | (interactive) | ||
| 976 | (customize-set-variable 'horizontal-scroll-bar-mode t)) | ||
| 977 | |||
| 978 | (defun menu-bar-no-horizontal-scroll-bar () | ||
| 979 | "Turn off horizontal scroll bars." | ||
| 980 | (interactive) | ||
| 981 | (customize-set-variable 'horizontal-scroll-bar-mode nil)) | ||
| 982 | |||
| 983 | (defvar menu-bar-showhide-scroll-bar-menu | 973 | (defvar menu-bar-showhide-scroll-bar-menu |
| 984 | (let ((menu (make-sparse-keymap "Scroll-bar")) | 974 | (let ((menu (make-sparse-keymap "Scroll Bar"))) |
| 985 | (vsb (frame-parameter nil 'vertical-scroll-bars)) | 975 | |
| 986 | (hsb (frame-parameter nil 'horizontal-scroll-bars))) | ||
| 987 | (bindings--define-key menu [horizontal] | 976 | (bindings--define-key menu [horizontal] |
| 988 | `(menu-item "Horizontal" | 977 | (menu-bar-make-mm-toggle horizontal-scroll-bar-mode |
| 989 | menu-bar-horizontal-scroll-bar | 978 | "Horizontal" |
| 990 | :help "Horizontal scroll bar" | 979 | "Horizontal scroll bar")) |
| 991 | :visible (horizontal-scroll-bars-available-p) | 980 | |
| 992 | :button (:radio . ,hsb))) | 981 | (bindings--define-key menu [scrollbar-separator] |
| 993 | 982 | menu-bar-separator) | |
| 994 | (bindings--define-key menu [none-horizontal] | ||
| 995 | `(menu-item "None-horizontal" | ||
| 996 | menu-bar-no-horizontal-scroll-bar | ||
| 997 | :help "Turn off horizontal scroll bars" | ||
| 998 | :visible (horizontal-scroll-bars-available-p) | ||
| 999 | :button (:radio . (not ,hsb)))) | ||
| 1000 | 983 | ||
| 1001 | (bindings--define-key menu [right] | 984 | (bindings--define-key menu [right] |
| 1002 | `(menu-item "On the Right" | 985 | '(menu-item "On the Right" menu-bar-right-scroll-bar |
| 1003 | menu-bar-right-scroll-bar | 986 | :help "Scroll bar on the right side" |
| 1004 | :help "Scroll-bar on the right side" | ||
| 1005 | :visible (display-graphic-p) | 987 | :visible (display-graphic-p) |
| 1006 | :button (:radio . (eq ,vsb 'right)))) | 988 | :button (:radio . (and scroll-bar-mode |
| 989 | (eq (frame-parameter | ||
| 990 | nil 'vertical-scroll-bars) | ||
| 991 | 'right))))) | ||
| 1007 | 992 | ||
| 1008 | (bindings--define-key menu [left] | 993 | (bindings--define-key menu [left] |
| 1009 | `(menu-item "On the Left" | 994 | '(menu-item "On the Left" menu-bar-left-scroll-bar |
| 1010 | menu-bar-left-scroll-bar | 995 | :help "Scroll bar on the left side" |
| 1011 | :help "Scroll-bar on the left side" | ||
| 1012 | :visible (display-graphic-p) | 996 | :visible (display-graphic-p) |
| 1013 | :button (:radio . (eq ,vsb 'left)))) | 997 | :button (:radio . (and scroll-bar-mode |
| 998 | (eq (frame-parameter | ||
| 999 | nil 'vertical-scroll-bars) | ||
| 1000 | 'left))))) | ||
| 1014 | 1001 | ||
| 1015 | (bindings--define-key menu [none] | 1002 | (bindings--define-key menu [none] |
| 1016 | `(menu-item "None" | 1003 | '(menu-item "No Vertical Scroll Bar" menu-bar-no-scroll-bar |
| 1017 | menu-bar-no-scroll-bar | 1004 | :help "Turn off vertical scroll bar" |
| 1018 | :help "Turn off scroll-bar" | ||
| 1019 | :visible (display-graphic-p) | 1005 | :visible (display-graphic-p) |
| 1020 | :button (:radio . (not ,vsb)))) | 1006 | :button (:radio . (eq scroll-bar-mode nil)))) |
| 1021 | menu)) | 1007 | menu)) |
| 1022 | 1008 | ||
| 1023 | (defun menu-bar-frame-for-menubar () | 1009 | (defun menu-bar-frame-for-menubar () |
| @@ -1057,24 +1043,24 @@ The selected font will be the default on both the existing and future frames." | |||
| 1057 | 1043 | ||
| 1058 | (when (featurep 'move-toolbar) | 1044 | (when (featurep 'move-toolbar) |
| 1059 | (defvar menu-bar-showhide-tool-bar-menu | 1045 | (defvar menu-bar-showhide-tool-bar-menu |
| 1060 | (let ((menu (make-sparse-keymap "Tool-bar"))) | 1046 | (let ((menu (make-sparse-keymap "Tool Bar"))) |
| 1061 | 1047 | ||
| 1062 | (bindings--define-key menu [showhide-tool-bar-left] | 1048 | (bindings--define-key menu [showhide-tool-bar-left] |
| 1063 | '(menu-item "On the Left" | 1049 | '(menu-item "On the Left" |
| 1064 | menu-bar-showhide-tool-bar-menu-customize-enable-left | 1050 | menu-bar-showhide-tool-bar-menu-customize-enable-left |
| 1065 | :help "Tool-bar at the left side" | 1051 | :help "Tool bar at the left side" |
| 1066 | :visible (display-graphic-p) | 1052 | :visible (display-graphic-p) |
| 1067 | :button | 1053 | :button |
| 1068 | (:radio . (and tool-bar-mode | 1054 | (:radio . (and tool-bar-mode |
| 1069 | (eq (frame-parameter | 1055 | (frame-parameter |
| 1070 | (menu-bar-frame-for-menubar) | 1056 | (menu-bar-frame-for-menubar) |
| 1071 | 'tool-bar-position) | 1057 | 'tool-bar-position) |
| 1072 | 'left))))) | 1058 | 'left)))) |
| 1073 | 1059 | ||
| 1074 | (bindings--define-key menu [showhide-tool-bar-right] | 1060 | (bindings--define-key menu [showhide-tool-bar-right] |
| 1075 | '(menu-item "On the Right" | 1061 | '(menu-item "On the Right" |
| 1076 | menu-bar-showhide-tool-bar-menu-customize-enable-right | 1062 | menu-bar-showhide-tool-bar-menu-customize-enable-right |
| 1077 | :help "Tool-bar at the right side" | 1063 | :help "Tool bar at the right side" |
| 1078 | :visible (display-graphic-p) | 1064 | :visible (display-graphic-p) |
| 1079 | :button | 1065 | :button |
| 1080 | (:radio . (and tool-bar-mode | 1066 | (:radio . (and tool-bar-mode |
| @@ -1086,7 +1072,7 @@ The selected font will be the default on both the existing and future frames." | |||
| 1086 | (bindings--define-key menu [showhide-tool-bar-bottom] | 1072 | (bindings--define-key menu [showhide-tool-bar-bottom] |
| 1087 | '(menu-item "On the Bottom" | 1073 | '(menu-item "On the Bottom" |
| 1088 | menu-bar-showhide-tool-bar-menu-customize-enable-bottom | 1074 | menu-bar-showhide-tool-bar-menu-customize-enable-bottom |
| 1089 | :help "Tool-bar at the bottom" | 1075 | :help "Tool bar at the bottom" |
| 1090 | :visible (display-graphic-p) | 1076 | :visible (display-graphic-p) |
| 1091 | :button | 1077 | :button |
| 1092 | (:radio . (and tool-bar-mode | 1078 | (:radio . (and tool-bar-mode |
| @@ -1098,7 +1084,7 @@ The selected font will be the default on both the existing and future frames." | |||
| 1098 | (bindings--define-key menu [showhide-tool-bar-top] | 1084 | (bindings--define-key menu [showhide-tool-bar-top] |
| 1099 | '(menu-item "On the Top" | 1085 | '(menu-item "On the Top" |
| 1100 | menu-bar-showhide-tool-bar-menu-customize-enable-top | 1086 | menu-bar-showhide-tool-bar-menu-customize-enable-top |
| 1101 | :help "Tool-bar at the top" | 1087 | :help "Tool bar at the top" |
| 1102 | :visible (display-graphic-p) | 1088 | :visible (display-graphic-p) |
| 1103 | :button | 1089 | :button |
| 1104 | (:radio . (and tool-bar-mode | 1090 | (:radio . (and tool-bar-mode |
| @@ -1110,7 +1096,7 @@ The selected font will be the default on both the existing and future frames." | |||
| 1110 | (bindings--define-key menu [showhide-tool-bar-none] | 1096 | (bindings--define-key menu [showhide-tool-bar-none] |
| 1111 | '(menu-item "None" | 1097 | '(menu-item "None" |
| 1112 | menu-bar-showhide-tool-bar-menu-customize-disable | 1098 | menu-bar-showhide-tool-bar-menu-customize-disable |
| 1113 | :help "Turn tool-bar off" | 1099 | :help "Turn tool bar off" |
| 1114 | :visible (display-graphic-p) | 1100 | :visible (display-graphic-p) |
| 1115 | :button (:radio . (eq tool-bar-mode nil)))) | 1101 | :button (:radio . (eq tool-bar-mode nil)))) |
| 1116 | menu))) | 1102 | menu))) |
| @@ -1168,7 +1154,7 @@ mail status in mode line")) | |||
| 1168 | :visible (display-graphic-p))) | 1154 | :visible (display-graphic-p))) |
| 1169 | 1155 | ||
| 1170 | (bindings--define-key menu [showhide-scroll-bar] | 1156 | (bindings--define-key menu [showhide-scroll-bar] |
| 1171 | `(menu-item "Scroll-bar" ,menu-bar-showhide-scroll-bar-menu | 1157 | `(menu-item "Scroll Bar" ,menu-bar-showhide-scroll-bar-menu |
| 1172 | :visible (display-graphic-p))) | 1158 | :visible (display-graphic-p))) |
| 1173 | 1159 | ||
| 1174 | (bindings--define-key menu [showhide-tooltip-mode] | 1160 | (bindings--define-key menu [showhide-tooltip-mode] |
| @@ -1178,8 +1164,8 @@ mail status in mode line")) | |||
| 1178 | :button (:toggle . tooltip-mode))) | 1164 | :button (:toggle . tooltip-mode))) |
| 1179 | 1165 | ||
| 1180 | (bindings--define-key menu [menu-bar-mode] | 1166 | (bindings--define-key menu [menu-bar-mode] |
| 1181 | '(menu-item "Menu-bar" toggle-menu-bar-mode-from-frame | 1167 | '(menu-item "Menu Bar" toggle-menu-bar-mode-from-frame |
| 1182 | :help "Turn menu-bar on/off" | 1168 | :help "Turn menu bar on/off" |
| 1183 | :button | 1169 | :button |
| 1184 | (:toggle . (menu-bar-positive-p | 1170 | (:toggle . (menu-bar-positive-p |
| 1185 | (frame-parameter (menu-bar-frame-for-menubar) | 1171 | (frame-parameter (menu-bar-frame-for-menubar) |
| @@ -1188,12 +1174,12 @@ mail status in mode line")) | |||
| 1188 | (if (and (boundp 'menu-bar-showhide-tool-bar-menu) | 1174 | (if (and (boundp 'menu-bar-showhide-tool-bar-menu) |
| 1189 | (keymapp menu-bar-showhide-tool-bar-menu)) | 1175 | (keymapp menu-bar-showhide-tool-bar-menu)) |
| 1190 | (bindings--define-key menu [showhide-tool-bar] | 1176 | (bindings--define-key menu [showhide-tool-bar] |
| 1191 | `(menu-item "Tool-bar" ,menu-bar-showhide-tool-bar-menu | 1177 | `(menu-item "Tool Bar" ,menu-bar-showhide-tool-bar-menu |
| 1192 | :visible (display-graphic-p))) | 1178 | :visible (display-graphic-p))) |
| 1193 | ;; else not tool bar that can move. | 1179 | ;; else not tool bar that can move. |
| 1194 | (bindings--define-key menu [showhide-tool-bar] | 1180 | (bindings--define-key menu [showhide-tool-bar] |
| 1195 | '(menu-item "Tool-bar" toggle-tool-bar-mode-from-frame | 1181 | '(menu-item "Tool Bar" toggle-tool-bar-mode-from-frame |
| 1196 | :help "Turn tool-bar on/off" | 1182 | :help "Turn tool bar on/off" |
| 1197 | :visible (display-graphic-p) | 1183 | :visible (display-graphic-p) |
| 1198 | :button | 1184 | :button |
| 1199 | (:toggle . (menu-bar-positive-p | 1185 | (:toggle . (menu-bar-positive-p |
| @@ -2268,11 +2254,11 @@ created in the future." | |||
| 2268 | (assq-delete-all 'menu-bar-lines | 2254 | (assq-delete-all 'menu-bar-lines |
| 2269 | default-frame-alist))))) | 2255 | default-frame-alist))))) |
| 2270 | ;; Make the message appear when Emacs is idle. We can not call message | 2256 | ;; Make the message appear when Emacs is idle. We can not call message |
| 2271 | ;; directly. The minor-mode message "Menu-bar mode disabled" comes | 2257 | ;; directly. The minor-mode message "Menu Bar mode disabled" comes |
| 2272 | ;; after this function returns, overwriting any message we do here. | 2258 | ;; after this function returns, overwriting any message we do here. |
| 2273 | (when (and (called-interactively-p 'interactive) (not menu-bar-mode)) | 2259 | (when (and (called-interactively-p 'interactive) (not menu-bar-mode)) |
| 2274 | (run-with-idle-timer 0 nil 'message | 2260 | (run-with-idle-timer 0 nil 'message |
| 2275 | "Menu-bar mode disabled. Use M-x menu-bar-mode to make the menu bar appear."))) | 2261 | "Menu Bar mode disabled. Use M-x menu-bar-mode to make the menu bar appear."))) |
| 2276 | 2262 | ||
| 2277 | ;;;###autoload | 2263 | ;;;###autoload |
| 2278 | ;; (This does not work right unless it comes after the above definition.) | 2264 | ;; (This does not work right unless it comes after the above definition.) |