aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorJuri Linkov2019-12-05 01:03:45 +0200
committerJuri Linkov2019-12-05 01:03:45 +0200
commitf336ae77cc422d82ea2738238b68234bc4c40966 (patch)
tree4e36ea4b02e4f9988c90cfab853cb8ddbd443921 /lisp
parent1e4c6f8333989ffe16cdffa2e082a061274f1e4e (diff)
downloademacs-f336ae77cc422d82ea2738238b68234bc4c40966.tar.gz
emacs-f336ae77cc422d82ea2738238b68234bc4c40966.zip
* lisp/windmove.el (windmove-display-new-tab): New command.
(windmove-display-default-keybindings): Bind it to '?t'. (windmove-display-in-direction): Call tab-bar-new-tab when 'dir' is 'new-tab'.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/windmove.el26
1 files changed, 19 insertions, 7 deletions
diff --git a/lisp/windmove.el b/lisp/windmove.el
index 16a5ca81284..7d3ef0fb649 100644
--- a/lisp/windmove.el
+++ b/lisp/windmove.el
@@ -467,12 +467,17 @@ When `switch-to-buffer-obey-display-actions' is non-nil,
467 (minibuffer-depth (minibuffer-depth)) 467 (minibuffer-depth (minibuffer-depth))
468 (action (lambda (buffer alist) 468 (action (lambda (buffer alist)
469 (unless (> (minibuffer-depth) minibuffer-depth) 469 (unless (> (minibuffer-depth) minibuffer-depth)
470 (let ((window (if (eq dir 'same-window) 470 (let ((window (cond
471 (selected-window) 471 ((eq dir 'new-tab)
472 (window-in-direction 472 (let ((tab-bar-new-tab-choice t))
473 dir nil nil 473 (tab-bar-new-tab))
474 (and arg (prefix-numeric-value arg)) 474 (selected-window))
475 windmove-wrap-around))) 475 ((eq dir 'same-window)
476 (selected-window))
477 (t (window-in-direction
478 dir nil nil
479 (and arg (prefix-numeric-value arg))
480 windmove-wrap-around))))
476 (type 'reuse)) 481 (type 'reuse))
477 (unless window 482 (unless window
478 (setq window (split-window nil nil dir) type 'window)) 483 (setq window (split-window nil nil dir) type 'window))
@@ -536,6 +541,12 @@ See the logic of the prefix ARG in `windmove-display-in-direction'."
536 (windmove-display-in-direction 'same-window arg)) 541 (windmove-display-in-direction 'same-window arg))
537 542
538;;;###autoload 543;;;###autoload
544(defun windmove-display-new-tab (&optional arg)
545 "Display the next buffer in a new tab."
546 (interactive "P")
547 (windmove-display-in-direction 'new-tab arg))
548
549;;;###autoload
539(defun windmove-display-default-keybindings (&optional modifiers) 550(defun windmove-display-default-keybindings (&optional modifiers)
540 "Set up keybindings for directional buffer display. 551 "Set up keybindings for directional buffer display.
541Keys are bound to commands that display the next buffer in the specified 552Keys are bound to commands that display the next buffer in the specified
@@ -549,7 +560,8 @@ Default value of MODIFIERS is `shift-meta'."
549 (global-set-key (vector (append modifiers '(right))) 'windmove-display-right) 560 (global-set-key (vector (append modifiers '(right))) 'windmove-display-right)
550 (global-set-key (vector (append modifiers '(up))) 'windmove-display-up) 561 (global-set-key (vector (append modifiers '(up))) 'windmove-display-up)
551 (global-set-key (vector (append modifiers '(down))) 'windmove-display-down) 562 (global-set-key (vector (append modifiers '(down))) 'windmove-display-down)
552 (global-set-key (vector (append modifiers '(?0))) 'windmove-display-same-window)) 563 (global-set-key (vector (append modifiers '(?0))) 'windmove-display-same-window)
564 (global-set-key (vector (append modifiers '(?t))) 'windmove-display-new-tab))
553 565
554 566
555;;; Directional window deletion 567;;; Directional window deletion