]> git.eshelyaron.com Git - emacs.git/commitdiff
More tab bar related key bindings.
authorJuri Linkov <juri@linkov.net>
Sat, 5 Oct 2019 21:54:46 +0000 (00:54 +0300)
committerJuri Linkov <juri@linkov.net>
Sat, 5 Oct 2019 21:54:46 +0000 (00:54 +0300)
* 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.

doc/emacs/frames.texi
etc/NEWS
lisp/dired.el
lisp/subr.el
lisp/tab-bar.el

index 43cdb2664d6c940c559b48beba074a3e48e0490a..ba1424aa2a3e73ed7c93c612a4b86aabd5b7e7f0 100644 (file)
@@ -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
index cadd6d9ef4b49a70a54689f54691e414a686514b..0edbec689449bbad39a15a220d06e7b56f16c176 100644 (file)
--- a/etc/NEWS
+++ b/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
index 854bc9f7d7e0148e45f71dd308a4dea66576ffd9..efe00d1ba40312b149efba3fc610803413150f7f 100644 (file)
@@ -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."
index 985bdc6b711ca829f4951e49a6f88143d1c2f904..b0a9a8395833b2d36c15015cbf6a748b9fe918d1 100644 (file)
@@ -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)
+
 \f
 ;;;; Event manipulation functions.
 
index d8d9bdac26dd163ab7b6b114a43a5f80cdad6ec2..27ae274eaa4e0f8bf68d9a0981034e081be4f64a 100644 (file)
@@ -793,11 +793,6 @@ in the selected frame."
   (tab-bar-list-select))
 
 \f
-(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)