diff options
author | Drew Adams <drew.adams@oracle.com> | 2021-09-01 11:42:48 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2021-09-01 11:42:48 +0200 |
commit | 2c662e6d66165db8ead2f4d19a61af521807b8ba (patch) | |
tree | fc33e2008b784bc9dcf8f561089409c1bb939117 /lisp/frame.el | |
parent | a4e3e0f89e1e06fd87e809f8b578fae59c34a9a0 (diff) | |
download | emacs-2c662e6d66165db8ead2f4d19a61af521807b8ba.tar.gz emacs-2c662e6d66165db8ead2f4d19a61af521807b8ba.tar.bz2 emacs-2c662e6d66165db8ead2f4d19a61af521807b8ba.zip |
Add new command `clone-frame'
* doc/emacs/frames.texi (Creating Frames): Document it.
* lisp/frame.el (clone-frame): New command and keystroke (bug#34715).
Diffstat (limited to 'lisp/frame.el')
-rw-r--r-- | lisp/frame.el | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lisp/frame.el b/lisp/frame.el index 28601b81a48..f36a34db7d7 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -787,6 +787,23 @@ When called from Lisp, returns the new frame." (make-frame) (select-frame (make-frame)))) +(defun clone-frame (&optional frame use-default-parameters) + "Make a new frame with the same parameters as FRAME. +With a prefix arg (USE-DEFAULT-PARAMETERS), use +`default-frame-alist' instead. + +FRAME defaults to the selected frame. The frame is created on the +same terminal as FRAME. If the terminal is a text-only terminal then +also select the new frame." + (interactive "i\nP") + (if use-default-parameters + (make-frame-command) + (let* ((default-frame-alist (frame-parameters frame)) + (new-frame (make-frame))) + (unless (display-graphic-p) + (select-frame new-frame)) + new-frame))) + (defvar before-make-frame-hook nil "Functions to run before `make-frame' creates a new frame.") @@ -2807,6 +2824,7 @@ See also `toggle-frame-maximized'." (define-key ctl-x-5-map "0" #'delete-frame) (define-key ctl-x-5-map "o" #'other-frame) (define-key ctl-x-5-map "5" #'other-frame-prefix) +(define-key ctl-x-5-map "c" #'clone-frame) (define-key global-map [f11] #'toggle-frame-fullscreen) (define-key global-map [(meta f10)] #'toggle-frame-maximized) (define-key esc-map [f10] #'toggle-frame-maximized) |