[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 32261ed: New command make-frame-on-current-monitor to use in wind
From: |
Juri Linkov |
Subject: |
master 32261ed: New command make-frame-on-current-monitor to use in windmove (bug#39875) |
Date: |
Thu, 5 Mar 2020 19:19:09 -0500 (EST) |
branch: master
commit 32261ed15bc4fb7b9d2cf955286aa21562d2fc8e
Author: Juri Linkov <address@hidden>
Commit: Juri Linkov <address@hidden>
New command make-frame-on-current-monitor to use in windmove (bug#39875)
* lisp/frame.el (make-frame-on-current-monitor): New command.
* lisp/windmove.el (windmove-display-in-direction):
Use make-frame-on-current-monitor for 'new-frame'.
(windmove-display-new-frame): New command.
(windmove-display-default-keybindings): Bind
windmove-display-new-frame to 'f' key.
* lisp/window.el (display-buffer-in-direction): Fix quotes in docstring.
---
lisp/frame.el | 12 ++++++++++++
lisp/windmove.el | 12 ++++++++++++
lisp/window.el | 10 +++++-----
3 files changed, 29 insertions(+), 5 deletions(-)
diff --git a/lisp/frame.el b/lisp/frame.el
index 16ee758..dc8dabc 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -713,6 +713,18 @@ The optional argument PARAMETERS specifies additional
frame parameters."
(x-display-list))))
(make-frame (cons (cons 'display display) parameters)))
+(defun make-frame-on-current-monitor (&optional parameters)
+ "Make a frame on the currently selected monitor.
+Like `make-frame-on-monitor' and with the same PARAMETERS as in `make-frame'."
+ (interactive)
+ (let* ((monitor-workarea
+ (cdr (assq 'workarea (frame-monitor-attributes))))
+ (geometry-parameters
+ (when monitor-workarea
+ `((top . ,(nth 1 monitor-workarea))
+ (left . ,(nth 0 monitor-workarea))))))
+ (make-frame (append geometry-parameters parameters))))
+
(defun make-frame-on-monitor (monitor &optional display parameters)
"Make a frame on monitor MONITOR.
The optional argument DISPLAY can be a display name, and the optional
diff --git a/lisp/windmove.el b/lisp/windmove.el
index 40adb49..94d2b75 100644
--- a/lisp/windmove.el
+++ b/lisp/windmove.el
@@ -474,6 +474,11 @@ When `switch-to-buffer-obey-display-actions' is non-nil,
(tab-bar-new-tab))
(setq type 'tab)
(selected-window))
+ ((eq dir 'new-frame)
+ (window--maybe-raise-frame
+ (make-frame-on-current-monitor
pop-up-frame-alist))
+ (setq type 'frame)
+ (selected-window))
((eq dir 'same-window)
(selected-window))
(t (window-in-direction
@@ -542,6 +547,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-frame (&optional arg)
+ "Display the next buffer in a new frame."
+ (interactive "P")
+ (windmove-display-in-direction 'new-frame arg))
+
+;;;###autoload
(defun windmove-display-new-tab (&optional arg)
"Display the next buffer in a new tab."
(interactive "P")
@@ -562,6 +573,7 @@ Default value of MODIFIERS is `shift-meta'."
(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 '(?f)))
'windmove-display-new-frame)
(global-set-key (vector (append modifiers '(?t)))
'windmove-display-new-tab))
diff --git a/lisp/window.el b/lisp/window.el
index b1a0294..bbd4e9b 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -7891,15 +7891,15 @@ Info node `(elisp) Buffer Display Action Alists' for
details of
such alists.
ALIST has to contain a `direction' entry whose value should be
-one of `left', `above' (or `up'), `right' and `below' (or
-'down'). Other values are usually interpreted as `below'.
+one of `left', `above' (or `up'), `right' and `below' (or `down').
+Other values are usually interpreted as `below'.
If ALIST also contains a `window' entry, its value specifies a
reference window. That value can be a special symbol like
-'main' (which stands for the selected frame's main window) or
-'root' (standings for the selected frame's root window) or an
+`main' (which stands for the selected frame's main window) or
+`root' (standings for the selected frame's root window) or an
arbitrary valid window. Any other value (or omitting the
-'window' entry) means to use the selected window as reference
+`window' entry) means to use the selected window as reference
window.
This function tries to reuse or split a window such that the
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 32261ed: New command make-frame-on-current-monitor to use in windmove (bug#39875),
Juri Linkov <=