More tab bar related key bindings.
* lisp/subr.el (ctl-x-6-map, ctl-x-6-prefix): Move here from tab-bar.el to make it available to other modes like dired for 'C-x 6 d'. * lisp/dired.el (dired-other-tab): New command bound to 'C-x 6 d'. * lisp/tab-bar.el: Bind 'C-x 6 o' to tab-next. * doc/emacs/frames.texi (Tab Bars): Describe C-x 6 prefix key bindings.
This commit is contained in:
parent
e3fcf1f38b
commit
6b915359ef
5 changed files with 62 additions and 5 deletions
|
@ -1255,12 +1255,58 @@ use persistent named window configurations without using the tab bar
|
|||
by typing the related commands: @kbd{M-x tab-new}, @kbd{M-x tab-next},
|
||||
@kbd{M-x tab-list}, @kbd{M-x tab-close}, etc.
|
||||
|
||||
@kindex C-x 6
|
||||
The prefix key @kbd{C-x 6} is analogous to @kbd{C-x 5}.
|
||||
Whereas each @kbd{C-x 5} command pops up a buffer in a different frame
|
||||
(@pxref{Creating Frames}), the @kbd{C-x 6} commands use a different
|
||||
tab with a different window configuration in the selected frame.
|
||||
|
||||
The various @kbd{C-x 6} commands differ in how they find or create the
|
||||
buffer to select:
|
||||
|
||||
@table @kbd
|
||||
@item C-x 6 2
|
||||
@kindex C-x 6 2
|
||||
@findex tab-new
|
||||
Add a new tab (@code{tab-new}). You can control the choice of the
|
||||
buffer displayed in a new tab by customizing the variable
|
||||
@code{tab-bar-new-tab-choice}.
|
||||
@item C-x 6 b @var{bufname} @key{RET}
|
||||
Select buffer @var{bufname} in another tab. This runs
|
||||
@code{switch-to-buffer-other-tab}.
|
||||
@item C-x 6 f @var{filename} @key{RET}
|
||||
Visit file @var{filename} and select its buffer in another tab. This
|
||||
runs @code{find-file-other-tab}. @xref{Visiting}.
|
||||
@item C-x 6 d @var{directory} @key{RET}
|
||||
Select a Dired buffer for directory @var{directory} in another tab.
|
||||
This runs @code{dired-other-tab}. @xref{Dired}.
|
||||
@end table
|
||||
|
||||
@vindex tab-bar-new-tab-choice
|
||||
By default, a new tab starts with the current buffer that was
|
||||
current before calling the command that adds a new tab. To start a
|
||||
new tab with other buffers, customize the variable
|
||||
@code{tab-bar-new-tab-choice}.
|
||||
|
||||
The following commands are used to delete and operate on tabs:
|
||||
|
||||
@table @kbd
|
||||
@item C-x 6 0
|
||||
@kindex C-x 6 0
|
||||
@findex tab-close
|
||||
Close the selected tab (@code{tab-close}). It has no effect if there
|
||||
is only one tab.
|
||||
|
||||
@item C-x 6 o
|
||||
@kindex C-x 6 o
|
||||
@kindex C-TAB
|
||||
@findex tab-next
|
||||
Switch to another tab. If you repeat this command, it cycles through
|
||||
all the tabs on the selected frame. With a positive numeric argument
|
||||
N, it switches to the next Nth tab; with a negative argument −N, it
|
||||
switches back to the previous Nth tab.
|
||||
@end table
|
||||
|
||||
@node Dialog Boxes
|
||||
@section Using Dialog Boxes
|
||||
@cindex dialog boxes
|
||||
|
|
3
etc/NEWS
3
etc/NEWS
|
@ -2058,6 +2058,9 @@ tabs with a mouse.
|
|||
Tab-related commands are available even when the Tab-Bar mode is
|
||||
disabled: by default, they enable Tab-Bar mode in that case.
|
||||
|
||||
Read the new Info node "(emacs) Tab Bars" for full description
|
||||
of all related features.
|
||||
|
||||
*** Tab-Line mode
|
||||
The new command 'global-tab-line-mode' enables the tab-line above each
|
||||
window, which you can use to switch buffers in the window. Selecting
|
||||
|
|
|
@ -835,6 +835,13 @@ If DIRNAME is already in a Dired buffer, that buffer is used without refresh."
|
|||
(interactive (dired-read-dir-and-switches "in other frame "))
|
||||
(switch-to-buffer-other-frame (dired-noselect dirname switches)))
|
||||
|
||||
;;;###autoload (define-key ctl-x-6-map "d" 'dired-other-tab)
|
||||
;;;###autoload
|
||||
(defun dired-other-tab (dirname &optional switches)
|
||||
"\"Edit\" directory DIRNAME. Like `dired' but makes a new tab."
|
||||
(interactive (dired-read-dir-and-switches "in other tab "))
|
||||
(switch-to-buffer-other-tab (dired-noselect dirname switches)))
|
||||
|
||||
;;;###autoload
|
||||
(defun dired-noselect (dir-or-list &optional switches)
|
||||
"Like `dired' but returns the Dired buffer as value, does not select it."
|
||||
|
|
|
@ -1238,6 +1238,11 @@ The normal global definition of the character C-x indirects to this keymap.")
|
|||
(defalias 'ctl-x-5-prefix ctl-x-5-map)
|
||||
(define-key ctl-x-map "5" 'ctl-x-5-prefix)
|
||||
|
||||
(defvar ctl-x-6-map (make-sparse-keymap)
|
||||
"Keymap for tab commands.")
|
||||
(defalias 'ctl-x-6-prefix ctl-x-6-map)
|
||||
(define-key ctl-x-map "6" 'ctl-x-6-prefix)
|
||||
|
||||
|
||||
;;;; Event manipulation functions.
|
||||
|
||||
|
|
|
@ -793,11 +793,6 @@ in the selected frame."
|
|||
(tab-bar-list-select))
|
||||
|
||||
|
||||
(defvar ctl-x-6-map (make-sparse-keymap)
|
||||
"Keymap for tab commands.")
|
||||
(defalias 'ctl-x-6-prefix ctl-x-6-map)
|
||||
(define-key ctl-x-map "6" 'ctl-x-6-prefix)
|
||||
|
||||
(defun switch-to-buffer-other-tab (buffer-or-name &optional norecord)
|
||||
"Switch to buffer BUFFER-OR-NAME in another tab.
|
||||
Like \\[switch-to-buffer-other-frame] (which see), but creates a new tab."
|
||||
|
@ -825,6 +820,7 @@ Like \\[find-file-other-frame] (which see), but creates a new tab."
|
|||
|
||||
(define-key ctl-x-6-map "2" 'tab-new)
|
||||
(define-key ctl-x-6-map "0" 'tab-close)
|
||||
(define-key ctl-x-6-map "o" 'tab-next)
|
||||
(define-key ctl-x-6-map "b" 'switch-to-buffer-other-tab)
|
||||
(define-key ctl-x-6-map "f" 'find-file-other-tab)
|
||||
(define-key ctl-x-6-map "\C-f" 'find-file-other-tab)
|
||||
|
|
Loading…
Add table
Reference in a new issue