diff options
| author | Juri Linkov | 2020-03-06 02:19:00 +0200 |
|---|---|---|
| committer | Juri Linkov | 2020-03-06 02:19:00 +0200 |
| commit | 32261ed15bc4fb7b9d2cf955286aa21562d2fc8e (patch) | |
| tree | 88507117a0ae1b52ff3a270018ba067174b93e49 | |
| parent | b5474ba1607fdca620cdee40a11cc0120697fc58 (diff) | |
| download | emacs-32261ed15bc4fb7b9d2cf955286aa21562d2fc8e.tar.gz emacs-32261ed15bc4fb7b9d2cf955286aa21562d2fc8e.zip | |
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.
| -rw-r--r-- | lisp/frame.el | 12 | ||||
| -rw-r--r-- | lisp/windmove.el | 12 | ||||
| -rw-r--r-- | lisp/window.el | 10 |
3 files changed, 29 insertions, 5 deletions
diff --git a/lisp/frame.el b/lisp/frame.el index 16ee7580f89..dc8dabc5a51 100644 --- a/lisp/frame.el +++ b/lisp/frame.el | |||
| @@ -713,6 +713,18 @@ The optional argument PARAMETERS specifies additional frame parameters." | |||
| 713 | (x-display-list)))) | 713 | (x-display-list)))) |
| 714 | (make-frame (cons (cons 'display display) parameters))) | 714 | (make-frame (cons (cons 'display display) parameters))) |
| 715 | 715 | ||
| 716 | (defun make-frame-on-current-monitor (&optional parameters) | ||
| 717 | "Make a frame on the currently selected monitor. | ||
| 718 | Like `make-frame-on-monitor' and with the same PARAMETERS as in `make-frame'." | ||
| 719 | (interactive) | ||
| 720 | (let* ((monitor-workarea | ||
| 721 | (cdr (assq 'workarea (frame-monitor-attributes)))) | ||
| 722 | (geometry-parameters | ||
| 723 | (when monitor-workarea | ||
| 724 | `((top . ,(nth 1 monitor-workarea)) | ||
| 725 | (left . ,(nth 0 monitor-workarea)))))) | ||
| 726 | (make-frame (append geometry-parameters parameters)))) | ||
| 727 | |||
| 716 | (defun make-frame-on-monitor (monitor &optional display parameters) | 728 | (defun make-frame-on-monitor (monitor &optional display parameters) |
| 717 | "Make a frame on monitor MONITOR. | 729 | "Make a frame on monitor MONITOR. |
| 718 | The optional argument DISPLAY can be a display name, and the optional | 730 | The optional argument DISPLAY can be a display name, and the optional |
diff --git a/lisp/windmove.el b/lisp/windmove.el index 40adb49e20f..94d2b75210d 100644 --- a/lisp/windmove.el +++ b/lisp/windmove.el | |||
| @@ -474,6 +474,11 @@ When `switch-to-buffer-obey-display-actions' is non-nil, | |||
| 474 | (tab-bar-new-tab)) | 474 | (tab-bar-new-tab)) |
| 475 | (setq type 'tab) | 475 | (setq type 'tab) |
| 476 | (selected-window)) | 476 | (selected-window)) |
| 477 | ((eq dir 'new-frame) | ||
| 478 | (window--maybe-raise-frame | ||
| 479 | (make-frame-on-current-monitor pop-up-frame-alist)) | ||
| 480 | (setq type 'frame) | ||
| 481 | (selected-window)) | ||
| 477 | ((eq dir 'same-window) | 482 | ((eq dir 'same-window) |
| 478 | (selected-window)) | 483 | (selected-window)) |
| 479 | (t (window-in-direction | 484 | (t (window-in-direction |
| @@ -542,6 +547,12 @@ See the logic of the prefix ARG in `windmove-display-in-direction'." | |||
| 542 | (windmove-display-in-direction 'same-window arg)) | 547 | (windmove-display-in-direction 'same-window arg)) |
| 543 | 548 | ||
| 544 | ;;;###autoload | 549 | ;;;###autoload |
| 550 | (defun windmove-display-new-frame (&optional arg) | ||
| 551 | "Display the next buffer in a new frame." | ||
| 552 | (interactive "P") | ||
| 553 | (windmove-display-in-direction 'new-frame arg)) | ||
| 554 | |||
| 555 | ;;;###autoload | ||
| 545 | (defun windmove-display-new-tab (&optional arg) | 556 | (defun windmove-display-new-tab (&optional arg) |
| 546 | "Display the next buffer in a new tab." | 557 | "Display the next buffer in a new tab." |
| 547 | (interactive "P") | 558 | (interactive "P") |
| @@ -562,6 +573,7 @@ Default value of MODIFIERS is `shift-meta'." | |||
| 562 | (global-set-key (vector (append modifiers '(up))) 'windmove-display-up) | 573 | (global-set-key (vector (append modifiers '(up))) 'windmove-display-up) |
| 563 | (global-set-key (vector (append modifiers '(down))) 'windmove-display-down) | 574 | (global-set-key (vector (append modifiers '(down))) 'windmove-display-down) |
| 564 | (global-set-key (vector (append modifiers '(?0))) 'windmove-display-same-window) | 575 | (global-set-key (vector (append modifiers '(?0))) 'windmove-display-same-window) |
| 576 | (global-set-key (vector (append modifiers '(?f))) 'windmove-display-new-frame) | ||
| 565 | (global-set-key (vector (append modifiers '(?t))) 'windmove-display-new-tab)) | 577 | (global-set-key (vector (append modifiers '(?t))) 'windmove-display-new-tab)) |
| 566 | 578 | ||
| 567 | 579 | ||
diff --git a/lisp/window.el b/lisp/window.el index b1a0294ae91..bbd4e9b6dfc 100644 --- a/lisp/window.el +++ b/lisp/window.el | |||
| @@ -7891,15 +7891,15 @@ Info node `(elisp) Buffer Display Action Alists' for details of | |||
| 7891 | such alists. | 7891 | such alists. |
| 7892 | 7892 | ||
| 7893 | ALIST has to contain a `direction' entry whose value should be | 7893 | ALIST has to contain a `direction' entry whose value should be |
| 7894 | one of `left', `above' (or `up'), `right' and `below' (or | 7894 | one of `left', `above' (or `up'), `right' and `below' (or `down'). |
| 7895 | 'down'). Other values are usually interpreted as `below'. | 7895 | Other values are usually interpreted as `below'. |
| 7896 | 7896 | ||
| 7897 | If ALIST also contains a `window' entry, its value specifies a | 7897 | If ALIST also contains a `window' entry, its value specifies a |
| 7898 | reference window. That value can be a special symbol like | 7898 | reference window. That value can be a special symbol like |
| 7899 | 'main' (which stands for the selected frame's main window) or | 7899 | `main' (which stands for the selected frame's main window) or |
| 7900 | 'root' (standings for the selected frame's root window) or an | 7900 | `root' (standings for the selected frame's root window) or an |
| 7901 | arbitrary valid window. Any other value (or omitting the | 7901 | arbitrary valid window. Any other value (or omitting the |
| 7902 | 'window' entry) means to use the selected window as reference | 7902 | `window' entry) means to use the selected window as reference |
| 7903 | window. | 7903 | window. |
| 7904 | 7904 | ||
| 7905 | This function tries to reuse or split a window such that the | 7905 | This function tries to reuse or split a window such that the |