Subject: Re: bug#34715: 26.1; (1) Add `clone-frame', (2) bind it to `C-x 5 2'

From: Eli Zaretskii <[email-masked]>
Date: Mon, 04 Mar 2019 18:12:21 +0200

> Date: Sat, 2 Mar 2019 16:47:47 -0800 (PST)
> From: Drew Adams <[email-masked]>
> 
> 1. Add a `clone-frame' command such as this one, which is similar to
>    what I've been using:
> 
> (defun clone-frame (&optional frame no-clone)
>   "Make a new frame with the same parameters as FRAME.
> With a prefix arg, don't clone - just call `make-frame-command'.
> 
> 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 no-clone
>       (make-frame-command)
>     (let* ((default-frame-alist  (frame-parameters frame))
>            (new-fr               (make-frame)))
>       (unless (display-graphic-p) (select-frame new-fr))
>       new-fr)))
> 
> 2. Use it, not `make-frame-command', as the binding of `C-x 5 2'.

I'm okay with adding a new command, but rebinding "C-x 5 2" by default
at the same time is a non-starter.  We should first let people use the
new command, and should see how many of them ask to change the default
binding.

>    Why change the default behavior of `C-x 5 2'?  If I want the buffer
>    of the selected window shown in another frame then I typically want
>    that frame to have the same parameters.

That's what default-frame-alist is for.  If you are used to change the
parameters of your frames a lot during their lifetime, which
presumably means each of your frames might look and work differently,
it is not entirely clear to me that "C-x 5 2" should produce a clone
of the random frame where you just happened to type the command.  It
could even cause trouble/unexpected behavior, with some exotic
parameters, at least in principle.

So I think we definitely should collect more experience before
changing this veteran binding.

> 3. BTW, I think it would be good to add this to the doc string of
>    `make-frame-command':
> 
>    Return the new frame.

"When called from Lisp, return the new frame."