From: Ship Mints <shipmints@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: rudalics@gmx.at, 74750@debbugs.gnu.org
Subject: bug#74750: clone-frame and make-frame pixelwise issues
Date: Mon, 16 Dec 2024 12:51:14 -0500 [thread overview]
Message-ID: <CAN+1Hbp+mBvXrzumrE91oN_uNJBfG7GPC0NT7zXEMgjtXwR+Pg@mail.gmail.com> (raw)
In-Reply-To: <86msgvpm8p.fsf@gnu.org>
[-- Attachment #1.1: Type: text/plain, Size: 1827 bytes --]
Updated patch with docstring amendments.
The tty test you're asking about was already in place, I merely added the
missing frame argument that ensures the test is against the source frame
rather than the ambient selected-frame. As to its utility, I can go only by
the docstring sentence that reads "If the terminal is a text-only terminal
then also select the new frame." Seems to have originated with this
commit 2c662e6d66165db8ead2f4d19a61af521807b8ba in 2021 when clone-frame
was introduced.
On Mon, Dec 16, 2024 at 12:32 PM Eli Zaretskii <eliz@gnu.org> wrote:
> > From: Ship Mints <shipmints@gmail.com>
> > Date: Mon, 16 Dec 2024 11:39:02 -0500
> > Cc: Eli Zaretskii <eliz@gnu.org>, 74750@debbugs.gnu.org
> >
> > Patch attached.
>
> Thanks.
>
> > (defun clone-frame (&optional frame no-windows)
> > "Make a new frame with the same parameters and windows as FRAME.
> > With a prefix arg NO-WINDOWS, don't clone the window configuration.
> > +When the user option `frame-resize-pixelwise' is non-nil, and FRAME is
>
> Please avoid using "when" as a conditional; use "if" instead. "When"
> can be interpreted as time-related condition, which is not what you
> want.
>
> > +not text-only, clone the originating frame's pixel size. Otherwise, use
> > +the number of FRAME's columns and lines for the clone.
>
> This uses double negation, which makes the documentation harder to
> understand. Suggest to rephrase:
>
> By default, clone the pixel-size of the original frame, but if
> `frame-resize-pixelwise' is nil or FRAME is a text-only frame, use
> the FRAME's number of lines and columns for the clone.
>
> > - (unless (display-graphic-p)
> > + (unless (display-graphic-p frame)
> > (select-frame new-frame))
>
> Why do you need this condition?
>
[-- Attachment #1.2: Type: text/html, Size: 2804 bytes --]
[-- Attachment #2: 0001-Support-pixelwise-frame-cloning-bug-74750.patch --]
[-- Type: application/octet-stream, Size: 1997 bytes --]
From ae7de06ce1a285960c5c77955f66fb30a88a828c Mon Sep 17 00:00:00 2001
From: shipmints <shipmints@gmail.com>
Date: Mon, 16 Dec 2024 11:36:27 -0500
Subject: [PATCH] Support pixelwise frame cloning (bug#74750)
* lisp/frame.el (clone-frame):
Honor frame-resize-pixelwise when cloning a frame's geometry
via make-frame text-pixel feature.
Correctly specify source frame in display-graphic-p test for
tty selection behavior.
---
lisp/frame.el | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/lisp/frame.el b/lisp/frame.el
index 1b5aa8cff08..02f3f9f9dae 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -863,3 +863,6 @@ make-frame-command
(defun clone-frame (&optional frame no-windows)
"Make a new frame with the same parameters and windows as FRAME.
With a prefix arg NO-WINDOWS, don't clone the window configuration.
+If the user option `frame-resize-pixelwise' is non-nil, and FRAME is
+graphical, clone the originating frame's pixel size. Otherwise, use
+the number of FRAME's columns and lines for the clone.
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
@@ -875,10 +878,17 @@ clone-frame
(seq-remove (lambda (elem)
(memq (car elem) frame-internal-parameters))
(frame-parameters frame)))
- (new-frame (make-frame)))
+ new-frame)
+ (when (and frame-resize-pixelwise
+ (display-graphic-p frame))
+ (push (cons 'width (cons 'text-pixels (frame-text-width frame)))
+ default-frame-alist)
+ (push (cons 'height (cons 'text-pixels (frame-text-height frame)))
+ default-frame-alist))
+ (setq new-frame (make-frame))
(when windows
(window-state-put windows (frame-root-window new-frame) 'safe))
- (unless (display-graphic-p)
+ (unless (display-graphic-p frame)
(select-frame new-frame))
new-frame))
--
2.47.1
next prev parent reply other threads:[~2024-12-16 17:51 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-09 15:51 bug#74750: clone-frame and make-frame pixelwise issues Ship Mints
2024-12-10 12:27 ` Eli Zaretskii
2024-12-10 15:56 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-10 16:24 ` Ship Mints
2024-12-11 9:37 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-11 22:41 ` Ship Mints
2024-12-12 6:05 ` Eli Zaretskii
2024-12-12 9:22 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-13 10:30 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-13 16:28 ` Ship Mints
2024-12-13 18:15 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-13 18:25 ` Ship Mints
2024-12-14 8:27 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-15 20:34 ` Ship Mints
2024-12-16 9:23 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-16 9:32 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-16 10:40 ` Ship Mints
2024-12-16 10:48 ` Ship Mints
2024-12-16 15:49 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-16 15:55 ` Ship Mints
2024-12-16 16:01 ` Ship Mints
2024-12-16 16:02 ` Ship Mints
2024-12-16 16:39 ` Ship Mints
2024-12-16 17:06 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-16 17:32 ` Eli Zaretskii
2024-12-16 17:51 ` Ship Mints [this message]
2024-12-16 19:10 ` Eli Zaretskii
2024-12-16 19:13 ` Eli Zaretskii
2024-12-16 19:26 ` Ship Mints
2024-12-16 16:07 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-16 16:41 ` Ship Mints
2024-12-16 17:06 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-16 16:07 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAN+1Hbp+mBvXrzumrE91oN_uNJBfG7GPC0NT7zXEMgjtXwR+Pg@mail.gmail.com \
--to=shipmints@gmail.com \
--cc=74750@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=rudalics@gmx.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).