Skip to content

Commit 7921811

Browse files
committed
Menu bar rearrangements, move Print menu items to submenu, etc. (bug#37594)
* lisp/menu-bar.el (menu-bar-print-menu): New defvar. (menu-bar-file-menu): Move print entries to submenu. Add menu entries for tab-new, tab-close, make-frame-on-monitor. (menu-bar-showhide-menu): Add menu entry for global-tab-line-mode. Don't add toggle-tab-bar-mode-from-frame on ns where it's unavailable. (menu-bar-tools-menu): Add rgrep. * lisp/bindings.el (next-buffer, previous-buffer): Advertise bindings 'C-x right' and 'C-x left' instead of 'XF86Forward' and 'XF86Back'.
1 parent f655967 commit 7921811

File tree

3 files changed

+76
-37
lines changed

3 files changed

+76
-37
lines changed

etc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,10 @@ RGB triplets with a single hexadecimal digit per component.
508508
---
509509
** The toolbar now shows the equivalent key binding in its tooltips.
510510

511+
---
512+
** The File menu-bar menu was re-arranged: Print menu items moved to
513+
submenu, and also added the new entries for tabs.
514+
511515
---
512516
** 'scroll-lock-mode' is now bound to the 'Scroll_Lock' key globally.
513517
Note that this key binding will not work on MS-Windows systems if

lisp/bindings.el

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -933,9 +933,11 @@ if `inhibit-field-text-motion' is non-nil."
933933
(define-key ctl-x-map [right] 'next-buffer)
934934
(define-key ctl-x-map [C-right] 'next-buffer)
935935
(define-key global-map [XF86Forward] 'next-buffer)
936+
(put 'next-buffer :advertised-binding [?\C-x right])
936937
(define-key ctl-x-map [left] 'previous-buffer)
937938
(define-key ctl-x-map [C-left] 'previous-buffer)
938939
(define-key global-map [XF86Back] 'previous-buffer)
940+
(put 'previous-buffer :advertised-binding [?\C-x left])
939941

940942
(let ((map minibuffer-local-map))
941943
(define-key map "\en" 'next-history-element)

lisp/menu-bar.el

Lines changed: 70 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,36 @@
4949
;; It gets modified in place when menu-bar-update-buffers is called.
5050
(defvar global-buffers-menu-map (make-sparse-keymap "Buffers"))
5151

52+
(defvar menu-bar-print-menu
53+
(let ((menu (make-sparse-keymap "Print")))
54+
(bindings--define-key menu [ps-print-region]
55+
'(menu-item "PostScript Print Region (B+W)" ps-print-region
56+
:enable mark-active
57+
:help "Pretty-print marked region in black and white to PostScript printer"))
58+
(bindings--define-key menu [ps-print-buffer]
59+
'(menu-item "PostScript Print Buffer (B+W)" ps-print-buffer
60+
:enable (menu-bar-menu-frame-live-and-visible-p)
61+
:help "Pretty-print current buffer in black and white to PostScript printer"))
62+
(bindings--define-key menu [ps-print-region-faces]
63+
'(menu-item "PostScript Print Region"
64+
ps-print-region-with-faces
65+
:enable mark-active
66+
:help "Pretty-print marked region to PostScript printer"))
67+
(bindings--define-key menu [ps-print-buffer-faces]
68+
'(menu-item "PostScript Print Buffer"
69+
ps-print-buffer-with-faces
70+
:enable (menu-bar-menu-frame-live-and-visible-p)
71+
:help "Pretty-print current buffer to PostScript printer"))
72+
(bindings--define-key menu [print-region]
73+
'(menu-item "Print Region" print-region
74+
:enable mark-active
75+
:help "Print region between mark and current position"))
76+
(bindings--define-key menu [print-buffer]
77+
'(menu-item "Print Buffer" print-buffer
78+
:enable (menu-bar-menu-frame-live-and-visible-p)
79+
:help "Print current buffer with page headings"))
80+
menu))
81+
5282
;; Only declared obsolete (and only made a proper alias) in 23.3.
5383
(define-obsolete-variable-alias
5484
'menu-bar-files-menu 'menu-bar-file-menu "22.1")
@@ -63,13 +93,36 @@
6393
(bindings--define-key menu [separator-exit]
6494
menu-bar-separator)
6595

96+
(bindings--define-key menu [print]
97+
`(menu-item "Print" ,menu-bar-print-menu))
98+
99+
(bindings--define-key menu [separator-print]
100+
menu-bar-separator)
101+
102+
(unless (featurep 'ns)
103+
(bindings--define-key menu [close-tab]
104+
'(menu-item "Close Tab" tab-close
105+
:visible (fboundp 'tab-close)
106+
:help "Close currently selected tab"))
107+
(bindings--define-key menu [make-tab]
108+
'(menu-item "New Tab" tab-new
109+
:visible (fboundp 'tab-new)
110+
:help "Open a new tab"))
111+
112+
(bindings--define-key menu [separator-tab]
113+
menu-bar-separator))
114+
66115
;; Don't use delete-frame as event name because that is a special
67116
;; event.
68117
(bindings--define-key menu [delete-this-frame]
69118
'(menu-item "Delete Frame" delete-frame
70119
:visible (fboundp 'delete-frame)
71120
:enable (delete-frame-enabled-p)
72121
:help "Delete currently selected frame"))
122+
(bindings--define-key menu [make-frame-on-monitor]
123+
'(menu-item "New Frame on Monitor..." make-frame-on-monitor
124+
:visible (fboundp 'make-frame-on-monitor)
125+
:help "Open a new frame on another monitor"))
73126
(bindings--define-key menu [make-frame-on-display]
74127
'(menu-item "New Frame on Display..." make-frame-on-display
75128
:visible (fboundp 'make-frame-on-display)
@@ -102,36 +155,6 @@
102155
(bindings--define-key menu [separator-window]
103156
menu-bar-separator)
104157

105-
(bindings--define-key menu [ps-print-region]
106-
'(menu-item "PostScript Print Region (B+W)" ps-print-region
107-
:enable mark-active
108-
:help "Pretty-print marked region in black and white to PostScript printer"))
109-
(bindings--define-key menu [ps-print-buffer]
110-
'(menu-item "PostScript Print Buffer (B+W)" ps-print-buffer
111-
:enable (menu-bar-menu-frame-live-and-visible-p)
112-
:help "Pretty-print current buffer in black and white to PostScript printer"))
113-
(bindings--define-key menu [ps-print-region-faces]
114-
'(menu-item "PostScript Print Region"
115-
ps-print-region-with-faces
116-
:enable mark-active
117-
:help "Pretty-print marked region to PostScript printer"))
118-
(bindings--define-key menu [ps-print-buffer-faces]
119-
'(menu-item "PostScript Print Buffer"
120-
ps-print-buffer-with-faces
121-
:enable (menu-bar-menu-frame-live-and-visible-p)
122-
:help "Pretty-print current buffer to PostScript printer"))
123-
(bindings--define-key menu [print-region]
124-
'(menu-item "Print Region" print-region
125-
:enable mark-active
126-
:help "Print region between mark and current position"))
127-
(bindings--define-key menu [print-buffer]
128-
'(menu-item "Print Buffer" print-buffer
129-
:enable (menu-bar-menu-frame-live-and-visible-p)
130-
:help "Print current buffer with page headings"))
131-
132-
(bindings--define-key menu [separator-print]
133-
menu-bar-separator)
134-
135158
(bindings--define-key menu [recover-session]
136159
'(menu-item "Recover Crashed Session" recover-session
137160
:enable
@@ -1228,6 +1251,12 @@ mail status in mode line"))
12281251
(frame-visible-p
12291252
(symbol-value 'speedbar-frame))))))
12301253

1254+
(bindings--define-key menu [showhide-tab-line-mode]
1255+
'(menu-item "Window Tab Line" global-tab-line-mode
1256+
:help "Turn window-local tab-lines on/off"
1257+
:visible (fboundp 'global-tab-line-mode)
1258+
:button (:toggle . global-tab-line-mode)))
1259+
12311260
(bindings--define-key menu [showhide-window-divider]
12321261
`(menu-item "Window Divider" ,menu-bar-showhide-window-divider-menu
12331262
:visible (memq (window-system) '(x w32))))
@@ -1254,13 +1283,14 @@ mail status in mode line"))
12541283
(frame-parameter (menu-bar-frame-for-menubar)
12551284
'menu-bar-lines)))))
12561285

1257-
(bindings--define-key menu [showhide-tab-bar]
1258-
'(menu-item "Tab Bar" toggle-tab-bar-mode-from-frame
1259-
:help "Turn tab bar on/off"
1260-
:button
1261-
(:toggle . (menu-bar-positive-p
1262-
(frame-parameter (menu-bar-frame-for-menubar)
1263-
'tab-bar-lines)))))
1286+
(unless (featurep 'ns)
1287+
(bindings--define-key menu [showhide-tab-bar]
1288+
'(menu-item "Tab Bar" toggle-tab-bar-mode-from-frame
1289+
:help "Turn tab bar on/off"
1290+
:button
1291+
(:toggle . (menu-bar-positive-p
1292+
(frame-parameter (menu-bar-frame-for-menubar)
1293+
'tab-bar-lines))))))
12641294

12651295
(if (and (boundp 'menu-bar-showhide-tool-bar-menu)
12661296
(keymapp menu-bar-showhide-tool-bar-menu))
@@ -1720,6 +1750,9 @@ mail status in mode line"))
17201750
(bindings--define-key menu [compile]
17211751
'(menu-item "Compile..." compile
17221752
:help "Invoke compiler or Make, view compilation errors"))
1753+
(bindings--define-key menu [rgrep]
1754+
'(menu-item "Recursive Grep..." rgrep
1755+
:help "Interactively ask for parameters and search recursively"))
17231756
(bindings--define-key menu [grep]
17241757
'(menu-item "Search Files (Grep)..." grep
17251758
:help "Search files for strings or regexps (with Grep)"))

0 commit comments

Comments
 (0)