diff options
| author | Juri Linkov | 2019-10-23 23:53:08 +0300 |
|---|---|---|
| committer | Juri Linkov | 2019-10-23 23:53:08 +0300 |
| commit | 9f52f61be501534c53aada7ffb47c3f1fa6cf98b (patch) | |
| tree | 29b4b54383736dc5d26fc0c70640005b36e33898 | |
| parent | 666686a3880a748d1c000682ce06914d59764849 (diff) | |
| download | emacs-9f52f61be501534c53aada7ffb47c3f1fa6cf98b.tar.gz emacs-9f52f61be501534c53aada7ffb47c3f1fa6cf98b.zip | |
* lisp/tab-bar.el: Rename tab-bar-swap-tabs to tab-bar-move-tab-to.
* lisp/tab-bar.el (tab-bar-move-tab-to): Rename from tab-bar-swap-tabs.
Change logic to push the moved tab between existing tabs.
(tab-bar-move-tab): Call tab-bar-move-tab-to instead of tab-bar-swap-tabs.
(tab-move-to): Rename alias from tab-swap.
| -rw-r--r-- | lisp/tab-bar.el | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 7ea319c0e95..8a4ad03d1d1 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el | |||
| @@ -525,15 +525,18 @@ to the numeric argument. ARG counts from 1." | |||
| 525 | (defalias 'tab-bar-select-tab-by-name 'tab-bar-switch-to-tab) | 525 | (defalias 'tab-bar-select-tab-by-name 'tab-bar-switch-to-tab) |
| 526 | 526 | ||
| 527 | 527 | ||
| 528 | (defun tab-bar-swap-tabs (to-index &optional from-index) | 528 | (defun tab-bar-move-tab-to (to-index &optional from-index) |
| 529 | "Exchange positions of two tabs referred by FROM-INDEX and TO-INDEX. | 529 | "Move tab from FROM-INDEX position to new position at TO-INDEX. |
| 530 | FROM-INDEX defaults to the current tab index. | 530 | FROM-INDEX defaults to the current tab index. |
| 531 | FROM-INDEX and TO-INDEX count from 1." | 531 | FROM-INDEX and TO-INDEX count from 1." |
| 532 | (interactive "P") | 532 | (interactive "P") |
| 533 | (let* ((tabs (funcall tab-bar-tabs-function)) | 533 | (let* ((tabs (funcall tab-bar-tabs-function)) |
| 534 | (from-index (or from-index (1+ (tab-bar--current-tab-index tabs))))) | 534 | (from-index (or from-index (1+ (tab-bar--current-tab-index tabs)))) |
| 535 | (cl-rotatef (nth (1- from-index) tabs) | 535 | (from-tab (nth (1- from-index) tabs)) |
| 536 | (nth (1- to-index) tabs)))) | 536 | (to-index (max 0 (min (1- to-index) (1- (length tabs)))))) |
| 537 | (setq tabs (delq from-tab tabs)) | ||
| 538 | (cl-pushnew from-tab (nthcdr to-index tabs)) | ||
| 539 | (set-frame-parameter nil 'tabs tabs))) | ||
| 537 | 540 | ||
| 538 | (defun tab-bar-move-tab (&optional arg) | 541 | (defun tab-bar-move-tab (&optional arg) |
| 539 | "Move the current tab ARG positions to the right. | 542 | "Move the current tab ARG positions to the right. |
| @@ -542,7 +545,7 @@ If a negative ARG, move the current tab ARG positions to the left." | |||
| 542 | (let* ((tabs (funcall tab-bar-tabs-function)) | 545 | (let* ((tabs (funcall tab-bar-tabs-function)) |
| 543 | (from-index (or (tab-bar--current-tab-index tabs) 0)) | 546 | (from-index (or (tab-bar--current-tab-index tabs) 0)) |
| 544 | (to-index (mod (+ from-index arg) (length tabs)))) | 547 | (to-index (mod (+ from-index arg) (length tabs)))) |
| 545 | (tab-bar-swap-tabs (1+ to-index) (1+ from-index)))) | 548 | (tab-bar-move-tab-to (1+ to-index) (1+ from-index)))) |
| 546 | 549 | ||
| 547 | 550 | ||
| 548 | (defcustom tab-bar-new-tab-to 'right | 551 | (defcustom tab-bar-new-tab-to 'right |
| @@ -774,8 +777,8 @@ function `tab-bar-tab-name-function'." | |||
| 774 | (defalias 'tab-select 'tab-bar-select-tab) | 777 | (defalias 'tab-select 'tab-bar-select-tab) |
| 775 | (defalias 'tab-next 'tab-bar-switch-to-next-tab) | 778 | (defalias 'tab-next 'tab-bar-switch-to-next-tab) |
| 776 | (defalias 'tab-previous 'tab-bar-switch-to-prev-tab) | 779 | (defalias 'tab-previous 'tab-bar-switch-to-prev-tab) |
| 777 | (defalias 'tab-swap 'tab-bar-swap-tabs) | ||
| 778 | (defalias 'tab-move 'tab-bar-move-tab) | 780 | (defalias 'tab-move 'tab-bar-move-tab) |
| 781 | (defalias 'tab-move-to 'tab-bar-move-tab-to) | ||
| 779 | (defalias 'tab-rename 'tab-bar-rename-tab) | 782 | (defalias 'tab-rename 'tab-bar-rename-tab) |
| 780 | (defalias 'tab-list 'tab-bar-list) | 783 | (defalias 'tab-list 'tab-bar-list) |
| 781 | 784 | ||