emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master f336ae7: * lisp/windmove.el (windmove-display-new-tab): New comma


From: Juri Linkov
Subject: master f336ae7: * lisp/windmove.el (windmove-display-new-tab): New command.
Date: Wed, 4 Dec 2019 18:03:53 -0500 (EST)

branch: master
commit f336ae77cc422d82ea2738238b68234bc4c40966
Author: Juri Linkov <address@hidden>
Commit: Juri Linkov <address@hidden>

    * 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'.
---
 etc/NEWS         |  3 ++-
 lisp/windmove.el | 26 +++++++++++++++++++-------
 2 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 3d17b8f..20b8617 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -820,7 +820,8 @@ displays the buffer from the next command in that window.  
For example,
 'S-M-right C-h i' displays the "*Info*" buffer in the right window,
 creating the window if necessary.  A special key can be customized to
 display the buffer in the same window, for example, 'S-M-0 C-h e'
-displays the "*Messages*" buffer in the same window.
+displays the "*Messages*" buffer in the same window.  'S-M-t C-h C-n'
+displays NEWS in a new tab.
 
 *** Windmove also supports directional window deletion.
 The new command 'windmove-delete-default-keybindings' binds default
diff --git a/lisp/windmove.el b/lisp/windmove.el
index 16a5ca8..7d3ef0f 100644
--- a/lisp/windmove.el
+++ b/lisp/windmove.el
@@ -467,12 +467,17 @@ When `switch-to-buffer-obey-display-actions' is non-nil,
          (minibuffer-depth (minibuffer-depth))
          (action (lambda (buffer alist)
                    (unless (> (minibuffer-depth) minibuffer-depth)
-                     (let ((window (if (eq dir 'same-window)
-                                       (selected-window)
-                                     (window-in-direction
-                                      dir nil nil
-                                      (and arg (prefix-numeric-value arg))
-                                      windmove-wrap-around)))
+                     (let ((window (cond
+                                    ((eq dir 'new-tab)
+                                     (let ((tab-bar-new-tab-choice t))
+                                       (tab-bar-new-tab))
+                                     (selected-window))
+                                    ((eq dir 'same-window)
+                                     (selected-window))
+                                    (t (window-in-direction
+                                        dir nil nil
+                                        (and arg (prefix-numeric-value arg))
+                                        windmove-wrap-around))))
                            (type 'reuse))
                        (unless window
                          (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'."
   (windmove-display-in-direction 'same-window arg))
 
 ;;;###autoload
+(defun windmove-display-new-tab (&optional arg)
+  "Display the next buffer in a new tab."
+  (interactive "P")
+  (windmove-display-in-direction 'new-tab arg))
+
+;;;###autoload
 (defun windmove-display-default-keybindings (&optional modifiers)
   "Set up keybindings for directional buffer display.
 Keys are bound to commands that display the next buffer in the specified
@@ -549,7 +560,8 @@ Default value of MODIFIERS is `shift-meta'."
   (global-set-key (vector (append modifiers '(right))) 'windmove-display-right)
   (global-set-key (vector (append modifiers '(up)))    'windmove-display-up)
   (global-set-key (vector (append modifiers '(down)))  'windmove-display-down)
-  (global-set-key (vector (append modifiers '(?0)))    
'windmove-display-same-window))
+  (global-set-key (vector (append modifiers '(?0)))    
'windmove-display-same-window)
+  (global-set-key (vector (append modifiers '(?t)))    
'windmove-display-new-tab))
 
 
 ;;; Directional window deletion



reply via email to

[Prev in Thread] Current Thread [Next in Thread]