diff options
| author | Juri Linkov | 2019-02-25 23:11:34 +0200 |
|---|---|---|
| committer | Juri Linkov | 2019-02-25 23:11:34 +0200 |
| commit | 57d2f24005a2e553fa8225eaff8465e5fad06d46 (patch) | |
| tree | 833d4926b5f6ed92cca3d6e3d3cdd7ab87401f2c | |
| parent | e73adad8371fd7ea4696908af00cbe1675708322 (diff) | |
| download | emacs-57d2f24005a2e553fa8225eaff8465e5fad06d46.tar.gz emacs-57d2f24005a2e553fa8225eaff8465e5fad06d46.zip | |
* lisp/frame.el (make-frame-on-monitor): New command. (Bug#34516)
(make-frame-on-display): Add completion on available display names.
| -rw-r--r-- | etc/NEWS | 4 | ||||
| -rw-r--r-- | lisp/frame.el | 36 |
2 files changed, 39 insertions, 1 deletions
| @@ -1140,6 +1140,10 @@ when given in a string. Previously, '(any "\x80-\xff")' would match | |||
| 1140 | characters U+0080...U+00FF. Now the expression matches raw bytes in | 1140 | characters U+0080...U+00FF. Now the expression matches raw bytes in |
| 1141 | the 128...255 range, as expected. | 1141 | the 128...255 range, as expected. |
| 1142 | 1142 | ||
| 1143 | ** Frames | ||
| 1144 | |||
| 1145 | *** New command 'make-frame-on-monitor' makes a frame on the specified monitor. | ||
| 1146 | |||
| 1143 | 1147 | ||
| 1144 | * New Modes and Packages in Emacs 27.1 | 1148 | * New Modes and Packages in Emacs 27.1 |
| 1145 | 1149 | ||
diff --git a/lisp/frame.el b/lisp/frame.el index dc81302939e..8a4a0b6639b 100644 --- a/lisp/frame.el +++ b/lisp/frame.el | |||
| @@ -644,9 +644,43 @@ Return nil if we don't know how to interpret DISPLAY." | |||
| 644 | (defun make-frame-on-display (display &optional parameters) | 644 | (defun make-frame-on-display (display &optional parameters) |
| 645 | "Make a frame on display DISPLAY. | 645 | "Make a frame on display DISPLAY. |
| 646 | The optional argument PARAMETERS specifies additional frame parameters." | 646 | The optional argument PARAMETERS specifies additional frame parameters." |
| 647 | (interactive "sMake frame on display: ") | 647 | (interactive (list (completing-read |
| 648 | (format "Make frame on display: ") | ||
| 649 | (delete-dups | ||
| 650 | (mapcar (lambda (frame) | ||
| 651 | (frame-parameter frame 'display)) | ||
| 652 | (frame-list)))))) | ||
| 648 | (make-frame (cons (cons 'display display) parameters))) | 653 | (make-frame (cons (cons 'display display) parameters))) |
| 649 | 654 | ||
| 655 | (defun make-frame-on-monitor (monitor &optional display parameters) | ||
| 656 | "Make a frame on monitor MONITOR. | ||
| 657 | The optional argument DISPLAY can be a display name, and the optional | ||
| 658 | argument PARAMETERS specifies additional frame parameters." | ||
| 659 | (interactive (list (completing-read | ||
| 660 | (format "Make frame on monitor: ") | ||
| 661 | (mapcar (lambda (a) | ||
| 662 | (cdr (assq 'name a))) | ||
| 663 | (display-monitor-attributes-list))))) | ||
| 664 | (let* ((monitor-geometry | ||
| 665 | (car (delq nil (mapcar (lambda (a) | ||
| 666 | (when (equal (cdr (assq 'name a)) monitor) | ||
| 667 | (cdr (assq 'workarea a)))) | ||
| 668 | (display-monitor-attributes-list display))))) | ||
| 669 | (frame-geometry | ||
| 670 | (when monitor-geometry | ||
| 671 | (x-parse-geometry (format "%dx%d+%d+%d" | ||
| 672 | (nth 2 monitor-geometry) | ||
| 673 | (nth 3 monitor-geometry) | ||
| 674 | (nth 0 monitor-geometry) | ||
| 675 | (nth 1 monitor-geometry))))) | ||
| 676 | (frame-geometry-in-pixels | ||
| 677 | (when frame-geometry | ||
| 678 | `((top . ,(cdr (assq 'top frame-geometry))) | ||
| 679 | (left . ,(cdr (assq 'left frame-geometry))) | ||
| 680 | (height . (text-pixels . ,(cdr (assq 'height frame-geometry)))) | ||
| 681 | (width . (text-pixels . ,(cdr (assq 'width frame-geometry)))))))) | ||
| 682 | (make-frame (append frame-geometry-in-pixels parameters)))) | ||
| 683 | |||
| 650 | (declare-function x-close-connection "xfns.c" (terminal)) | 684 | (declare-function x-close-connection "xfns.c" (terminal)) |
| 651 | 685 | ||
| 652 | (defun close-display-connection (display) | 686 | (defun close-display-connection (display) |