aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2019-11-28 00:35:53 +0200
committerJuri Linkov2019-11-28 00:35:53 +0200
commit7921811726b878c21df99208cbfcfdb9634378b9 (patch)
tree22e8b2dced4d6e7836349d914eb03df395f1073a
parentf655967b83378b56390904a503ec0f1a19a1a7e9 (diff)
downloademacs-7921811726b878c21df99208cbfcfdb9634378b9.tar.gz
emacs-7921811726b878c21df99208cbfcfdb9634378b9.zip
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'.
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/bindings.el2
-rw-r--r--lisp/menu-bar.el107
3 files changed, 76 insertions, 37 deletions
diff --git a/etc/NEWS b/etc/NEWS
index f3f9f2f2c65..cb73e46358a 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -509,6 +509,10 @@ RGB triplets with a single hexadecimal digit per component.
509** The toolbar now shows the equivalent key binding in its tooltips. 509** The toolbar now shows the equivalent key binding in its tooltips.
510 510
511--- 511---
512** The File menu-bar menu was re-arranged: Print menu items moved to
513submenu, and also added the new entries for tabs.
514
515---
512** 'scroll-lock-mode' is now bound to the 'Scroll_Lock' key globally. 516** 'scroll-lock-mode' is now bound to the 'Scroll_Lock' key globally.
513Note that this key binding will not work on MS-Windows systems if 517Note that this key binding will not work on MS-Windows systems if
514'w32-scroll-lock-modifier' is non-nil. 518'w32-scroll-lock-modifier' is non-nil.
diff --git a/lisp/bindings.el b/lisp/bindings.el
index 16da2bdf9a6..738928b478e 100644
--- a/lisp/bindings.el
+++ b/lisp/bindings.el
@@ -933,9 +933,11 @@ if `inhibit-field-text-motion' is non-nil."
933(define-key ctl-x-map [right] 'next-buffer) 933(define-key ctl-x-map [right] 'next-buffer)
934(define-key ctl-x-map [C-right] 'next-buffer) 934(define-key ctl-x-map [C-right] 'next-buffer)
935(define-key global-map [XF86Forward] 'next-buffer) 935(define-key global-map [XF86Forward] 'next-buffer)
936(put 'next-buffer :advertised-binding [?\C-x right])
936(define-key ctl-x-map [left] 'previous-buffer) 937(define-key ctl-x-map [left] 'previous-buffer)
937(define-key ctl-x-map [C-left] 'previous-buffer) 938(define-key ctl-x-map [C-left] 'previous-buffer)
938(define-key global-map [XF86Back] 'previous-buffer) 939(define-key global-map [XF86Back] 'previous-buffer)
940(put 'previous-buffer :advertised-binding [?\C-x left])
939 941
940(let ((map minibuffer-local-map)) 942(let ((map minibuffer-local-map))
941 (define-key map "\en" 'next-history-element) 943 (define-key map "\en" 'next-history-element)
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index c404145dff4..b6e7d06aa64 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -49,6 +49,36 @@
49;; It gets modified in place when menu-bar-update-buffers is called. 49;; It gets modified in place when menu-bar-update-buffers is called.
50(defvar global-buffers-menu-map (make-sparse-keymap "Buffers")) 50(defvar global-buffers-menu-map (make-sparse-keymap "Buffers"))
51 51
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
52;; Only declared obsolete (and only made a proper alias) in 23.3. 82;; Only declared obsolete (and only made a proper alias) in 23.3.
53(define-obsolete-variable-alias 83(define-obsolete-variable-alias
54 'menu-bar-files-menu 'menu-bar-file-menu "22.1") 84 'menu-bar-files-menu 'menu-bar-file-menu "22.1")
@@ -63,6 +93,25 @@
63 (bindings--define-key menu [separator-exit] 93 (bindings--define-key menu [separator-exit]
64 menu-bar-separator) 94 menu-bar-separator)
65 95
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
66 ;; Don't use delete-frame as event name because that is a special 115 ;; Don't use delete-frame as event name because that is a special
67 ;; event. 116 ;; event.
68 (bindings--define-key menu [delete-this-frame] 117 (bindings--define-key menu [delete-this-frame]
@@ -70,6 +119,10 @@
70 :visible (fboundp 'delete-frame) 119 :visible (fboundp 'delete-frame)
71 :enable (delete-frame-enabled-p) 120 :enable (delete-frame-enabled-p)
72 :help "Delete currently selected frame")) 121 :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"))
73 (bindings--define-key menu [make-frame-on-display] 126 (bindings--define-key menu [make-frame-on-display]
74 '(menu-item "New Frame on Display..." make-frame-on-display 127 '(menu-item "New Frame on Display..." make-frame-on-display
75 :visible (fboundp 'make-frame-on-display) 128 :visible (fboundp 'make-frame-on-display)
@@ -102,36 +155,6 @@
102 (bindings--define-key menu [separator-window] 155 (bindings--define-key menu [separator-window]
103 menu-bar-separator) 156 menu-bar-separator)
104 157
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
135 (bindings--define-key menu [recover-session] 158 (bindings--define-key menu [recover-session]
136 '(menu-item "Recover Crashed Session" recover-session 159 '(menu-item "Recover Crashed Session" recover-session
137 :enable 160 :enable
@@ -1228,6 +1251,12 @@ mail status in mode line"))
1228 (frame-visible-p 1251 (frame-visible-p
1229 (symbol-value 'speedbar-frame)))))) 1252 (symbol-value 'speedbar-frame))))))
1230 1253
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
1231 (bindings--define-key menu [showhide-window-divider] 1260 (bindings--define-key menu [showhide-window-divider]
1232 `(menu-item "Window Divider" ,menu-bar-showhide-window-divider-menu 1261 `(menu-item "Window Divider" ,menu-bar-showhide-window-divider-menu
1233 :visible (memq (window-system) '(x w32)))) 1262 :visible (memq (window-system) '(x w32))))
@@ -1254,13 +1283,14 @@ mail status in mode line"))
1254 (frame-parameter (menu-bar-frame-for-menubar) 1283 (frame-parameter (menu-bar-frame-for-menubar)
1255 'menu-bar-lines))))) 1284 'menu-bar-lines)))))
1256 1285
1257 (bindings--define-key menu [showhide-tab-bar] 1286 (unless (featurep 'ns)
1258 '(menu-item "Tab Bar" toggle-tab-bar-mode-from-frame 1287 (bindings--define-key menu [showhide-tab-bar]
1259 :help "Turn tab bar on/off" 1288 '(menu-item "Tab Bar" toggle-tab-bar-mode-from-frame
1260 :button 1289 :help "Turn tab bar on/off"
1261 (:toggle . (menu-bar-positive-p 1290 :button
1262 (frame-parameter (menu-bar-frame-for-menubar) 1291 (:toggle . (menu-bar-positive-p
1263 'tab-bar-lines))))) 1292 (frame-parameter (menu-bar-frame-for-menubar)
1293 'tab-bar-lines))))))
1264 1294
1265 (if (and (boundp 'menu-bar-showhide-tool-bar-menu) 1295 (if (and (boundp 'menu-bar-showhide-tool-bar-menu)
1266 (keymapp menu-bar-showhide-tool-bar-menu)) 1296 (keymapp menu-bar-showhide-tool-bar-menu))
@@ -1720,6 +1750,9 @@ mail status in mode line"))
1720 (bindings--define-key menu [compile] 1750 (bindings--define-key menu [compile]
1721 '(menu-item "Compile..." compile 1751 '(menu-item "Compile..." compile
1722 :help "Invoke compiler or Make, view compilation errors")) 1752 :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"))
1723 (bindings--define-key menu [grep] 1756 (bindings--define-key menu [grep]
1724 '(menu-item "Search Files (Grep)..." grep 1757 '(menu-item "Search Files (Grep)..." grep
1725 :help "Search files for strings or regexps (with Grep)")) 1758 :help "Search files for strings or regexps (with Grep)"))