Received: (at 79649) by debbugs.gnu.org; 20 Oct 2025 11:29:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 20 07:29:03 2025
Received: from localhost ([127.0.0.1]:44296 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vAo4U-0000CH-Og
for submit <at> debbugs.gnu.org; Mon, 20 Oct 2025 07:29:03 -0400
Received: from mail.muc.de ([193.149.48.3]:53641)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <acm@HIDDEN>) id 1vAo4S-0000BU-9l
for 79649 <at> debbugs.gnu.org; Mon, 20 Oct 2025 07:29:01 -0400
Received: (qmail 23539 invoked by uid 3782); 20 Oct 2025 13:28:52 +0200
Received: from muc.de (p4fe15fa9.dip0.t-ipconnect.de [79.225.95.169]) (using
STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP;
Mon, 20 Oct 2025 13:28:52 +0200
Received: (qmail 5322 invoked by uid 1000); 20 Oct 2025 11:28:51 -0000
Date: Mon, 20 Oct 2025 11:28:51 +0000
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#79649: Let's have freedom for naming frames on a tty.
Message-ID: <aPYc8z2zzSARiS9n@HIDDEN>
References: <aPNl_EN-NdyiAWby@HIDDEN> <86ecr0ec6h.fsf@HIDDEN>
<aPPCHKBXBU0vrUn8@HIDDEN> <86plak17ir.fsf@HIDDEN>
<aPQARSoBxfqAlf-z@HIDDEN> <86frbf1p5z.fsf@HIDDEN>
<aPURuQpzjhbWp2_I@HIDDEN> <864iruzu79.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <864iruzu79.fsf@HIDDEN>
X-Submission-Agent: TMDA/1.3.x (Ph3nix)
From: Alan Mackenzie <acm@HIDDEN>
X-Primary-Address: acm@HIDDEN
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 79649
Cc: 79649 <at> debbugs.gnu.org, acm@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
Hello, Eli.
On Sun, Oct 19, 2025 at 20:18:18 +0300, Eli Zaretskii wrote:
> > Date: Sun, 19 Oct 2025 16:28:41 +0000
> > Cc: 79649 <at> debbugs.gnu.org, acm@HIDDEN
> > From: Alan Mackenzie <acm@HIDDEN>
[ .... ]
> > How about the following?
> A few comments below.
> > +/* Return a frame with the given NAME, a string, or nil. Note that if
> > + there are several frames with this NAME, the first found is returned.
> > + This function was inspired by Fget_buffer. */
> > +static Lisp_Object
> > +frame_get (Lisp_Object name)
> > +{
> > + Lisp_Object ptr = Vframe_list;
> > +
> > + CHECK_STRING (name);
> > + while (CONSP (ptr)
> > + && NILP (Fstring_equal (XFRAME (XCAR (ptr))->name, name)))
> > + ptr = XCDR (ptr);
> > + return NILP (ptr) ? Qnil : XCAR (ptr) ;
> Please use FOR_EACH_FRAME instead of a hand-written while loop.
DONE.
> > @@ -1427,7 +1444,10 @@ make_terminal_frame (struct terminal *terminal, Lisp_Object parent,
> > XSETFRAME (frame, f);
> > Vframe_list = Fcons (frame, Vframe_list);
> > - fset_name (f, make_formatted_string ("F%"PRIdMAX, ++tty_frame_count));
> > + do
> > + name = make_formatted_string ("F%"PRIdMAX, ++tty_frame_count);
> > + while (!NILP (frame_get (name)));
> This unnecessarily conses Lisp strings, potentially many of them.
> Can't we check if there's a frame by a name Fnnn, for several nnn,
> without making a Lisp string each time? Especially since we are
> looking for frames whose names are "F" followed by a string of digits?
I don't see this problem. In the above do-while loop, the vast bulk of
the time we don't loop at all, simply using the next tty_frame_count
value. If the user has created just a few F<num> frames, we might need
to loop a few times. Only if there were lots of such frames would there
be any significant looping.
The bulk of the looping will happen in frame_get, where we loop through
all frames each time we add an F<num> frame. There we need to extract
the C string from frame->name for each frame, and we do the same for the
argument NAME (in Fstring_equal). It doesn't seem worth the extra
messiness of the code to extract the C string from NAME just once and use
it in a loop, compared with simply using Fstring_equal.
Have I misunderstood what you meant?
> > @@ -3665,7 +3685,9 @@ set_term_frame_name (struct frame *f, Lisp_Object name)
> > if (frame_name_fnn_p (SSDATA (f->name), SBYTES (f->name)))
> > return;
> > - name = make_formatted_string ("F%"PRIdMAX, ++tty_frame_count);
> > + do
> > + name = make_formatted_string ("F%"PRIdMAX, ++tty_frame_count);
> > + while (!NILP (frame_get (name)));
> Same here. And maybe it's better to have a single function these two
> places will call.
I've written frame_next_F_name (void) for this.
> > @@ -3677,8 +3699,9 @@ set_term_frame_name (struct frame *f, Lisp_Object name)
> > /* Don't allow the user to set the frame name to F<num>, so it
> > doesn't clash with the names we generate for terminal frames. */
> > - if (frame_name_fnn_p (SSDATA (name), SBYTES (name)))
> > - error ("Frame names of the form F<num> are usurped by Emacs");
> > + if (frame_name_fnn_p (SSDATA (name), SBYTES (name))
> > + && !NILP (frame_get (name)))
> > + error ("Frame name of the form F<num> is already the name of a frame.");
> Since we are given a specific <num>, it is better to say
> error ("There is already a frame whose name is %s", name);
I was trying to avoid confusing the user by suggesting frame names in
general must be unique. I've come up with:
error ("Double use of frame name `%s' (not allowed for F<num>)",
SSDATA (name));
> Thanks.
Here's the current state of my patch:
diff --git a/src/frame.c b/src/frame.c
index 6a93945ce33..787b36a8cdc 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -163,6 +163,21 @@ check_tty (struct frame *f)
error ("tty frame should be used");
}
+/* Return a frame with the given NAME (a string) or nil. Note that if
+ there are several frames with this NAME, the first found is returned.
+ This function was inspired by Fget_buffer. */
+static Lisp_Object
+frame_get (Lisp_Object name)
+{
+ Lisp_Object _list_var, frame;
+
+ CHECK_STRING (name);
+ FOR_EACH_FRAME (_list_var, frame)
+ if (Fstring_equal (XFRAME (frame)->name, name))
+ return frame;
+ return Qnil;
+}
+
/* Return the value of frame parameter PROP in frame FRAME. */
Lisp_Object
@@ -1288,6 +1303,18 @@ make_minibuffer_frame (void)
static intmax_t tty_frame_count;
+/* Return the next never used frame name of the form "F<num>". */
+static Lisp_Object
+frame_next_F_name (void)
+{
+ Lisp_Object name;
+
+ do
+ name = make_formatted_string ("F%"PRIdMAX, ++tty_frame_count);
+ while (!NILP (frame_get (name)));
+ return name;
+}
+
struct frame *
make_initial_frame (void)
{
@@ -1427,7 +1454,7 @@ make_terminal_frame (struct terminal *terminal, Lisp_Object parent,
XSETFRAME (frame, f);
Vframe_list = Fcons (frame, Vframe_list);
- fset_name (f, make_formatted_string ("F%"PRIdMAX, ++tty_frame_count));
+ fset_name (f, frame_next_F_name());
SET_FRAME_VISIBLE (f, true);
@@ -3664,8 +3691,7 @@ set_term_frame_name (struct frame *f, Lisp_Object name)
before we do any consing. */
if (frame_name_fnn_p (SSDATA (f->name), SBYTES (f->name)))
return;
-
- name = make_formatted_string ("F%"PRIdMAX, ++tty_frame_count);
+ name = frame_next_F_name ();
}
else
{
@@ -3675,10 +3701,11 @@ set_term_frame_name (struct frame *f, Lisp_Object name)
if (! NILP (Fstring_equal (name, f->name)))
return;
- /* Don't allow the user to set the frame name to F<num>, so it
- doesn't clash with the names we generate for terminal frames. */
- if (frame_name_fnn_p (SSDATA (name), SBYTES (name)))
- error ("Frame names of the form F<num> are usurped by Emacs");
+ /* Stop the user setting the name to F<num> if it is already in use. */
+ if (frame_name_fnn_p (SSDATA (name), SBYTES (name))
+ && !NILP (frame_get (name)))
+ error ("Double use of frame name `%s' (not allowed for F<num>)",
+ SSDATA (name));
}
fset_name (f, name);
--
Alan Mackenzie (Nuremberg, Germany).
bug-gnu-emacs@HIDDEN:bug#79649; Package emacs.
Full text available.
Received: (at 79649) by debbugs.gnu.org; 19 Oct 2025 17:18:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 19 13:18:32 2025
Received: from localhost ([127.0.0.1]:37015 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vAX39-0002CY-T8
for submit <at> debbugs.gnu.org; Sun, 19 Oct 2025 13:18:32 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:37174)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1vAX34-0002CD-RX
for 79649 <at> debbugs.gnu.org; Sun, 19 Oct 2025 13:18:28 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
id 1vAX2y-0007st-OT; Sun, 19 Oct 2025 13:18:20 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
mime-version; bh=kAPYQN16lWaHV4nHJa4Co86Beo56z5+yH6fIJl2Pkg8=; b=HYwh5Pd9hDw7
GS2ongXham4XlWGEnfEBNJGlHHUzKYkmNhccBEjxzG3/DiQ3EhbwBLm+9X/V9fdBMDZHw+4zeE7E0
PrFPayrIiqzzC3LLFLIYS8Ic5zHpdC8SJmdU2ZPpNsXA8zzVbtSn8tZxSB+NumlVeMVMjtYgZpEYX
rN5raJHgZOcGDEaPE1exAw9IYj98XPU/b6e471g41RFMiHTj7vXBnxLHafkERtuwUjkVjjRitVI89
ebt7MNJ1CHR/gSyE0nQOjxizGl7U68Ay1NMBiJRAKum24D7z7Owz9lffFkSRZqIF63zDXN3pWRedC
VBXYp0oeZ/MaTgiXu6RimQ==;
Date: Sun, 19 Oct 2025 20:18:18 +0300
Message-Id: <864iruzu79.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Alan Mackenzie <acm@HIDDEN>
In-Reply-To: <aPURuQpzjhbWp2_I@HIDDEN> (message from Alan Mackenzie on
Sun, 19 Oct 2025 16:28:41 +0000)
Subject: Re: bug#79649: Let's have freedom for naming frames on a tty.
References: <aPNl_EN-NdyiAWby@HIDDEN> <86ecr0ec6h.fsf@HIDDEN>
<aPPCHKBXBU0vrUn8@HIDDEN> <86plak17ir.fsf@HIDDEN>
<aPQARSoBxfqAlf-z@HIDDEN>
<86frbf1p5z.fsf@HIDDEN> <aPURuQpzjhbWp2_I@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 79649
Cc: 79649 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)
> Date: Sun, 19 Oct 2025 16:28:41 +0000
> Cc: 79649 <at> debbugs.gnu.org, acm@HIDDEN
> From: Alan Mackenzie <acm@HIDDEN>
>
> > The select-frame-by-name usage is especially important on TTY frames,
> > where it is the only user-level way of selecting a random frame. It
> > must continue working reliably.
>
> Thanks, I didn't understand this yesterday. That seems to be the main
> difference between X and a tty, because on X one can use the mouse to
> switch frames easily.
Right. That was the motivation for writing select-frame-by-name in
the first place.
> I've modified the code such that a user can rename a frame Fn, and on
> making a new frame, tty_frame_count will be incremented as much as
> needed to avoid any existing frames called Fm.
>
> How about the following?
A few comments below.
> +/* Return a frame with the given NAME, a string, or nil. Note that if
> + there are several frames with this NAME, the first found is returned.
> + This function was inspired by Fget_buffer. */
> +static Lisp_Object
> +frame_get (Lisp_Object name)
> +{
> + Lisp_Object ptr = Vframe_list;
> +
> + CHECK_STRING (name);
> + while (CONSP (ptr)
> + && NILP (Fstring_equal (XFRAME (XCAR (ptr))->name, name)))
> + ptr = XCDR (ptr);
> + return NILP (ptr) ? Qnil : XCAR (ptr) ;
Please use FOR_EACH_FRAME instead of a hand-written while loop.
> @@ -1427,7 +1444,10 @@ make_terminal_frame (struct terminal *terminal, Lisp_Object parent,
> XSETFRAME (frame, f);
> Vframe_list = Fcons (frame, Vframe_list);
>
> - fset_name (f, make_formatted_string ("F%"PRIdMAX, ++tty_frame_count));
> + do
> + name = make_formatted_string ("F%"PRIdMAX, ++tty_frame_count);
> + while (!NILP (frame_get (name)));
This unnecessarily conses Lisp strings, potentially many of them.
Can't we check if there's a frame by a name Fnnn, for several nnn,
without making a Lisp string each time? Especially since we are
looking for frames whose names are "F" followed by a string of digits?
> @@ -3665,7 +3685,9 @@ set_term_frame_name (struct frame *f, Lisp_Object name)
> if (frame_name_fnn_p (SSDATA (f->name), SBYTES (f->name)))
> return;
>
> - name = make_formatted_string ("F%"PRIdMAX, ++tty_frame_count);
> + do
> + name = make_formatted_string ("F%"PRIdMAX, ++tty_frame_count);
> + while (!NILP (frame_get (name)));
Same here. And maybe it's better to have a single function these two
places will call.
> @@ -3677,8 +3699,9 @@ set_term_frame_name (struct frame *f, Lisp_Object name)
>
> /* Don't allow the user to set the frame name to F<num>, so it
> doesn't clash with the names we generate for terminal frames. */
> - if (frame_name_fnn_p (SSDATA (name), SBYTES (name)))
> - error ("Frame names of the form F<num> are usurped by Emacs");
> + if (frame_name_fnn_p (SSDATA (name), SBYTES (name))
> + && !NILP (frame_get (name)))
> + error ("Frame name of the form F<num> is already the name of a frame.");
Since we are given a specific <num>, it is better to say
error ("There is already a frame whose name is %s", name);
Thanks.
bug-gnu-emacs@HIDDEN:bug#79649; Package emacs.
Full text available.
Received: (at 79649) by debbugs.gnu.org; 19 Oct 2025 16:29:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 19 12:29:14 2025
Received: from localhost ([127.0.0.1]:36378 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vAWHR-0006Jp-I5
for submit <at> debbugs.gnu.org; Sun, 19 Oct 2025 12:29:14 -0400
Received: from mail.muc.de ([193.149.48.3]:10895)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <acm@HIDDEN>) id 1vAWH3-0006HD-4U
for 79649 <at> debbugs.gnu.org; Sun, 19 Oct 2025 12:29:09 -0400
Received: (qmail 71262 invoked by uid 3782); 19 Oct 2025 18:28:42 +0200
Received: from muc.de (p4fe154c0.dip0.t-ipconnect.de [79.225.84.192]) (using
STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP;
Sun, 19 Oct 2025 18:28:41 +0200
Received: (qmail 8193 invoked by uid 1000); 19 Oct 2025 16:28:41 -0000
Date: Sun, 19 Oct 2025 16:28:41 +0000
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#79649: Let's have freedom for naming frames on a tty.
Message-ID: <aPURuQpzjhbWp2_I@HIDDEN>
References: <aPNl_EN-NdyiAWby@HIDDEN> <86ecr0ec6h.fsf@HIDDEN>
<aPPCHKBXBU0vrUn8@HIDDEN> <86plak17ir.fsf@HIDDEN>
<aPQARSoBxfqAlf-z@HIDDEN> <86frbf1p5z.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <86frbf1p5z.fsf@HIDDEN>
X-Submission-Agent: TMDA/1.3.x (Ph3nix)
From: Alan Mackenzie <acm@HIDDEN>
X-Primary-Address: acm@HIDDEN
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 79649
Cc: 79649 <at> debbugs.gnu.org, acm@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
Hello, Eli.
On Sun, Oct 19, 2025 at 07:38:48 +0300, Eli Zaretskii wrote:
> > Date: Sat, 18 Oct 2025 21:01:57 +0000
> > Cc: 79649 <at> debbugs.gnu.org, acm@HIDDEN
> > From: Alan Mackenzie <acm@HIDDEN>
[ .... ]
> So it was not due to any "confusion".
OK.
> > Given the above, I think we could obsolete the restriction on frame names
> > Fn without any loss. What do think now?
> I disagree with your conclusions. select-frame-by-name should allow
> to select a specific single frame (with completion -- which cannot
> tolerate identical members in the collection), and the name of a TTY
> frame shown on the mode line should uniquely identify the frame.
> The select-frame-by-name usage is especially important on TTY frames,
> where it is the only user-level way of selecting a random frame. It
> must continue working reliably.
Thanks, I didn't understand this yesterday. That seems to be the main
difference between X and a tty, because on X one can use the mouse to
switch frames easily.
> So if you want to remove the restriction, please modify the code which
> assumes that new Fn names can be allocated by incrementing a counter
> without ever causing a name clash.
I've modified the code such that a user can rename a frame Fn, and on
making a new frame, tty_frame_count will be incremented as much as
needed to avoid any existing frames called Fm.
How about the following?
diff --git a/src/frame.c b/src/frame.c
index 6a93945ce33..0816342cff5 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -163,6 +163,21 @@ check_tty (struct frame *f)
error ("tty frame should be used");
}
+/* Return a frame with the given NAME, a string, or nil. Note that if
+ there are several frames with this NAME, the first found is returned.
+ This function was inspired by Fget_buffer. */
+static Lisp_Object
+frame_get (Lisp_Object name)
+{
+ Lisp_Object ptr = Vframe_list;
+
+ CHECK_STRING (name);
+ while (CONSP (ptr)
+ && NILP (Fstring_equal (XFRAME (XCAR (ptr))->name, name)))
+ ptr = XCDR (ptr);
+ return NILP (ptr) ? Qnil : XCAR (ptr) ;
+}
+
/* Return the value of frame parameter PROP in frame FRAME. */
Lisp_Object
@@ -1348,6 +1363,8 @@ make_initial_frame (void)
make_terminal_frame (struct terminal *terminal, Lisp_Object parent,
Lisp_Object params)
{
+ Lisp_Object name;
+
if (!terminal->name)
error ("Terminal is not live, can't create new frames on it");
@@ -1427,7 +1444,10 @@ make_terminal_frame (struct terminal *terminal, Lisp_Object parent,
XSETFRAME (frame, f);
Vframe_list = Fcons (frame, Vframe_list);
- fset_name (f, make_formatted_string ("F%"PRIdMAX, ++tty_frame_count));
+ do
+ name = make_formatted_string ("F%"PRIdMAX, ++tty_frame_count);
+ while (!NILP (frame_get (name)));
+ fset_name (f, name);
SET_FRAME_VISIBLE (f, true);
@@ -3665,7 +3685,9 @@ set_term_frame_name (struct frame *f, Lisp_Object name)
if (frame_name_fnn_p (SSDATA (f->name), SBYTES (f->name)))
return;
- name = make_formatted_string ("F%"PRIdMAX, ++tty_frame_count);
+ do
+ name = make_formatted_string ("F%"PRIdMAX, ++tty_frame_count);
+ while (!NILP (frame_get (name)));
}
else
{
@@ -3677,8 +3699,9 @@ set_term_frame_name (struct frame *f, Lisp_Object name)
/* Don't allow the user to set the frame name to F<num>, so it
doesn't clash with the names we generate for terminal frames. */
- if (frame_name_fnn_p (SSDATA (name), SBYTES (name)))
- error ("Frame names of the form F<num> are usurped by Emacs");
+ if (frame_name_fnn_p (SSDATA (name), SBYTES (name))
+ && !NILP (frame_get (name)))
+ error ("Frame name of the form F<num> is already the name of a frame.");
}
fset_name (f, name);
--
Alan Mackenzie (Nuremberg, Germany).
bug-gnu-emacs@HIDDEN:bug#79649; Package emacs.
Full text available.Received: (at 79649) by debbugs.gnu.org; 19 Oct 2025 04:39:08 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 19 00:39:08 2025 Received: from localhost ([127.0.0.1]:54748 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1vALCD-0002eu-Qq for submit <at> debbugs.gnu.org; Sun, 19 Oct 2025 00:39:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43972) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1vALC9-0002d0-Ug for 79649 <at> debbugs.gnu.org; Sun, 19 Oct 2025 00:39:03 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1vALC3-0002ur-Vi; Sun, 19 Oct 2025 00:38:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=fomYcZB3D1OXEXCbCoKnqBg3OnKqJAAUi1M8P3U2VKA=; b=ng7ygTTfWmMr wzdeAL8g7ddyRkSeV+ZC9LqsYZzfHoano5v47T0n4eYYS6JT0y/26gjaSKQTucsTM1EDrXxwOSAb3 ylrXC2nW2GiWkgcqjus+e/dfGb4adJiGWiMN3935uDKRikzebCgMcyJzJ/soJLT4polg4u82u1x4O LO74KyVPTR1ofNxfa3xb+Ecv+7yfpIfWQ+hw6K2SCx52YPEARGpR4He+Y1k/u5vZO87/Z41BNA9Da Sej7tXhH1edle0/CTlMVjtw50nQTo5Lff4Epf11MGdoe6Kzl0+FWX+gDUOoXQe/gzv/WGuKpzFCom EmcEOGpGpneGnNwrlpL5pA==; Date: Sun, 19 Oct 2025 07:38:48 +0300 Message-Id: <86frbf1p5z.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Alan Mackenzie <acm@HIDDEN> In-Reply-To: <aPQARSoBxfqAlf-z@HIDDEN> (message from Alan Mackenzie on Sat, 18 Oct 2025 21:01:57 +0000) Subject: Re: bug#79649: Let's have freedom for naming frames on a tty. References: <aPNl_EN-NdyiAWby@HIDDEN> <86ecr0ec6h.fsf@HIDDEN> <aPPCHKBXBU0vrUn8@HIDDEN> <86plak17ir.fsf@HIDDEN> <aPQARSoBxfqAlf-z@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79649 Cc: 79649 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > Date: Sat, 18 Oct 2025 21:01:57 +0000 > Cc: 79649 <at> debbugs.gnu.org, acm@HIDDEN > From: Alan Mackenzie <acm@HIDDEN> > > I think that in the early days of frames, the various concepts were in a > flurry of confusion, and the restrictions on Fn were imposed before that > confusion chrystallised into a fixed system. I wrote that code. It was more than 25 years ago, but I still remember well my discussions with RMS about the issues we are talking about here, and the decision which came out of those discussions to implement this restriction as a simple way of resolving those issues. (Unfortunately, my email archives don't go back that much, so I have only my memory to rely upon. But it is very vivid in this case.) So it was not due to any "confusion". > Given the above, I think we could obsolete the restriction on frame names > Fn without any loss. What do think now? I disagree with your conclusions. select-frame-by-name should allow to select a specific single frame (with completion -- which cannot tolerate identical members in the collection), and the name of a TTY frame shown on the mode line should uniquely identify the frame. The select-frame-by-name usage is especially important on TTY frames, where it is the only user-level way of selecting a random frame. It must continue working reliably. So if you want to remove the restriction, please modify the code which assumes that new Fn names can be allocated by incrementing a counter without ever causing a name clash.
bug-gnu-emacs@HIDDEN:bug#79649; Package emacs.
Full text available.Received: (at 79649) by debbugs.gnu.org; 18 Oct 2025 21:02:10 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Oct 18 17:02:10 2025 Received: from localhost ([127.0.0.1]:49598 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1vAE41-0004M7-LF for submit <at> debbugs.gnu.org; Sat, 18 Oct 2025 17:02:10 -0400 Received: from mail.muc.de ([193.149.48.3]:10277) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <acm@HIDDEN>) id 1vAE3x-0004Jq-7T for 79649 <at> debbugs.gnu.org; Sat, 18 Oct 2025 17:02:07 -0400 Received: (qmail 21873 invoked by uid 3782); 18 Oct 2025 23:01:57 +0200 Received: from muc.de (p4fe15dc3.dip0.t-ipconnect.de [79.225.93.195]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 18 Oct 2025 23:01:57 +0200 Received: (qmail 20910 invoked by uid 1000); 18 Oct 2025 21:01:57 -0000 Date: Sat, 18 Oct 2025 21:01:57 +0000 To: Eli Zaretskii <eliz@HIDDEN> Subject: Re: bug#79649: Let's have freedom for naming frames on a tty. Message-ID: <aPQARSoBxfqAlf-z@HIDDEN> References: <aPNl_EN-NdyiAWby@HIDDEN> <86ecr0ec6h.fsf@HIDDEN> <aPPCHKBXBU0vrUn8@HIDDEN> <86plak17ir.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <86plak17ir.fsf@HIDDEN> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie <acm@HIDDEN> X-Primary-Address: acm@HIDDEN X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79649 Cc: 79649 <at> debbugs.gnu.org, acm@HIDDEN X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Hello, Eli. On Sat, Oct 18, 2025 at 19:47:40 +0300, Eli Zaretskii wrote: > > Date: Sat, 18 Oct 2025 16:36:44 +0000 > > Cc: 79649 <at> debbugs.gnu.org, acm@HIDDEN > > From: Alan Mackenzie <acm@HIDDEN> > > > It's a restriction we decided to have many years ago, when TTY Emacs > > > was taught to use more than a single frame. The reason is that Emacs > > > itself gives such names to TTY frames when some Lisp program or a user > > > creates a new TTY frame. Allowing such names for frames would cause > > > name clashes (frames with identical names etc.), problems with > > > select-frame-by-name, etc. Not allowing these names is an easy way of > > > preventing such problems, with minimal or no user-level consequences. > > Two frames with the same name cannot be created (although I haven't > > tried this recently. If they can, that's a bug). No, I was mistaken. Emacs quite happily allows duplicate frame names, both on a tty and in X (and probably in the other environments, too). > That's a misunderstanding. The name clashes I had in mind are when we > create a new TTY frame. Currently, we maintain a single static > counter, and use that to generate the Fn (where n is a number) frame > name. This will break if users and Lisp programs are allowed to give > such names, because when we create a frame for the N-th time, there > could already be a frame whose name is FN. It seems a frame name is no big thing. It doesn't identify a frame the way a buffer name identifies a buffer. Its main purpose seems to be its display on the title line (X) or mode line (tty). It can also be used to select a frame with select-frame-by-name. If there are frame name duplicates, the earliest one in an alist wins. I think that's about it. I filtered all the atoms in the obarray with mapatoms for symbol-name matches to "frame" and "name" and came up with only 10 matches. > There's also the case of resetting the frame's 'name' parameter to > nil, which could also go awry, see set_term_frame_name and > store_frame_param which calls it. nil, meaning "Rename to the next Fn". That could possibly clash with a user named frame Fn, but so what? Users renaming frames is probably quite rare, and any user doing this probably understands what she is doing. Such an action is unlikely to lead to a bug report. ;-) > > All these problems you mention must surely occur in Emacs in X, where > > there're no such restrictions. The user-level consequences are not > > major, but sufficient to cause irritation. > GUI frames are different, as we don't generate names there. No, the frame name seems to be the name of the initial buffer in it combined with the name of the machine it's running on, or something like that. > > > Sorry, no, not without some additional changes, which would remove the > > > reasons for the restriction (see above). Having perused the source code and tried things out, I see no particular reason for this continued restriction. > > I suspect the tradeoffs have changed in the last 28 years. I will try > > to reproduce the problems outlined above, and to fix them too. I think that in the early days of frames, the various concepts were in a flurry of confusion, and the restrictions on Fn were imposed before that confusion chrystallised into a fixed system. Given the above, I think we could obsolete the restriction on frame names Fn without any loss. What do think now? > OK, thanks. -- Alan Mackenzie (Nuremberg, Germany).
bug-gnu-emacs@HIDDEN:bug#79649; Package emacs.
Full text available.Received: (at 79649) by debbugs.gnu.org; 18 Oct 2025 16:47:51 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Oct 18 12:47:51 2025 Received: from localhost ([127.0.0.1]:46009 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1vAA5u-0000Tl-Mn for submit <at> debbugs.gnu.org; Sat, 18 Oct 2025 12:47:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35294) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1vAA5s-0000TQ-TG for 79649 <at> debbugs.gnu.org; Sat, 18 Oct 2025 12:47:49 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1vAA5n-0000dE-0p; Sat, 18 Oct 2025 12:47:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=w+RHhtuwQaSJyqv1sH1U16yLo22aIdrSF8KIECWUGoE=; b=ADY6JWfxkiiC zovm3KhNbE0Vn8njm3bgxnByscUdonz1a8o4eKsLCVLAvsz65v+60T9paeNKbzGPKPO/r53GB4zKJ 7smdTP7ae7ZBha5U18ZIOgw1LmiLBnFgnmDkR5QOeR2sx6IBN4ecUfGRbK8Cxmj2S+aH3nzJ/ld75 blxxLL6JNsTaZltvlXdE/yq0lB9x0CDnw+NFMUiq16azwmDBIg/itg+W+98waLLyt3ICHROP2OWrt cCCjZenHgNJOI2Rm2R6feDxlcofkf5rnARFni5BK8168aVhm9t2ZOXV23KYTSfNWtmBz8G79uq4jT kPB9BCHgfNmZwaLTuOwRmA==; Date: Sat, 18 Oct 2025 19:47:40 +0300 Message-Id: <86plak17ir.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Alan Mackenzie <acm@HIDDEN> In-Reply-To: <aPPCHKBXBU0vrUn8@HIDDEN> (message from Alan Mackenzie on Sat, 18 Oct 2025 16:36:44 +0000) Subject: Re: bug#79649: Let's have freedom for naming frames on a tty. References: <aPNl_EN-NdyiAWby@HIDDEN> <86ecr0ec6h.fsf@HIDDEN> <aPPCHKBXBU0vrUn8@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79649 Cc: 79649 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > Date: Sat, 18 Oct 2025 16:36:44 +0000 > Cc: 79649 <at> debbugs.gnu.org, acm@HIDDEN > From: Alan Mackenzie <acm@HIDDEN> > > > It's a restriction we decided to have many years ago, when TTY Emacs > > was taught to use more than a single frame. The reason is that Emacs > > itself gives such names to TTY frames when some Lisp program or a user > > creates a new TTY frame. Allowing such names for frames would cause > > name clashes (frames with identical names etc.), problems with > > select-frame-by-name, etc. Not allowing these names is an easy way of > > preventing such problems, with minimal or no user-level consequences. > > Two frames with the same name cannot be created (although I haven't > tried this recently. If they can, that's a bug). That's a misunderstanding. The name clashes I had in mind are when we create a new TTY frame. Currently, we maintain a single static counter, and use that to generate the Fn (where n is a number) frame name. This will break if users and Lisp programs are allowed to give such names, because when we create a frame for the N-th time, there could already be a frame whose name is FN. There's also the case of resetting the frame's 'name' parameter to nil, which could also go awry, see set_term_frame_name and store_frame_param which calls it. > All these problems > you mention must surely occur in Emacs in X, where there're no such > restrictions. The user-level consequences are not major, but sufficient > to cause irritation. GUI frames are different, as we don't generate names there. > > Sorry, no, not without some additional changes, which would remove the > > reasons for the restriction (see above). > > I suspect the tradeoffs have changed in the last 28 years. I will try > to reproduce the problems outlined above, and to fix them too. OK, thanks.
bug-gnu-emacs@HIDDEN:bug#79649; Package emacs.
Full text available.Received: (at 79649) by debbugs.gnu.org; 18 Oct 2025 16:36:54 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Oct 18 12:36:54 2025 Received: from localhost ([127.0.0.1]:45832 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1vA9vK-0007ro-7E for submit <at> debbugs.gnu.org; Sat, 18 Oct 2025 12:36:54 -0400 Received: from mail.muc.de ([193.149.48.3]:36185) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <acm@HIDDEN>) id 1vA9vH-0007rX-Gb for 79649 <at> debbugs.gnu.org; Sat, 18 Oct 2025 12:36:52 -0400 Received: (qmail 66408 invoked by uid 3782); 18 Oct 2025 18:36:45 +0200 Received: from muc.de (p4fe15dc3.dip0.t-ipconnect.de [79.225.93.195]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 18 Oct 2025 18:36:44 +0200 Received: (qmail 23938 invoked by uid 1000); 18 Oct 2025 16:36:44 -0000 Date: Sat, 18 Oct 2025 16:36:44 +0000 To: Eli Zaretskii <eliz@HIDDEN> Subject: Re: bug#79649: Let's have freedom for naming frames on a tty. Message-ID: <aPPCHKBXBU0vrUn8@HIDDEN> References: <aPNl_EN-NdyiAWby@HIDDEN> <86ecr0ec6h.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <86ecr0ec6h.fsf@HIDDEN> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie <acm@HIDDEN> X-Primary-Address: acm@HIDDEN X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79649 Cc: 79649 <at> debbugs.gnu.org, acm@HIDDEN X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Hello, Eli. On Sat, Oct 18, 2025 at 13:28:38 +0300, Eli Zaretskii wrote: > > Date: Sat, 18 Oct 2025 10:03:40 +0000 > > From: Alan Mackenzie <acm@HIDDEN> > > Currently, on a tty, attempting to name a frame "F2" throws an error > > rater than renaming the frame. This is a Bad Thing. > It's a restriction we decided to have many years ago, when TTY Emacs > was taught to use more than a single frame. The reason is that Emacs > itself gives such names to TTY frames when some Lisp program or a user > creates a new TTY frame. Allowing such names for frames would cause > name clashes (frames with identical names etc.), problems with > select-frame-by-name, etc. Not allowing these names is an easy way of > preventing such problems, with minimal or no user-level consequences. Two frames with the same name cannot be created (although I haven't tried this recently. If they can, that's a bug). All these problems you mention must surely occur in Emacs in X, where there're no such restrictions. The user-level consequences are not major, but sufficient to cause irritation. > In your case, what prevents you from changing the command to use some > other name, like Frame%d or somesuch? Why is it important that the > frames are called F1, F2, etc.? Aesthetically, it is good to have the frame named by the keyboard key that switches to it. Also, F1, F2, ... take up little space on the mode line. > > For some years now, I've been running an Emacs with this restriction > > removed, and haven't hit any problems. In the deleted frame scenario > > above, I just rename the "recreated" frame with: > > (modify-frame-parameters frame `((name . ,(format "F%s" (1+ n))))) > > I am asking for the restriction to be lifted in the Emacs master. The > > following patch is suggested: > Sorry, no, not without some additional changes, which would remove the > reasons for the restriction (see above). I suspect the tradeoffs have changed in the last 28 years. I will try to reproduce the problems outlined above, and to fix them too. -- Alan Mackenzie (Nuremberg, Germany).
bug-gnu-emacs@HIDDEN:bug#79649; Package emacs.
Full text available.Received: (at 79649) by debbugs.gnu.org; 18 Oct 2025 10:28:51 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Oct 18 06:28:51 2025 Received: from localhost ([127.0.0.1]:39742 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1vA4B9-0001bp-50 for submit <at> debbugs.gnu.org; Sat, 18 Oct 2025 06:28:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59070) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1vA4B6-0001bQ-Du for 79649 <at> debbugs.gnu.org; Sat, 18 Oct 2025 06:28:49 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1vA4B0-0005C9-CR; Sat, 18 Oct 2025 06:28:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=F0k0BgaQkzFC3iQEvNMe0Dhbqpv9SWhPu8biBHTjIAs=; b=hl1U+9NBcoPM DeMoS0mTdAeptObZC8OEf4ZK9MYF9YOqNAifLrOBLiTpJvQICUfeS2dyfsUYIgnVK8iDUaxba2dOm sOvQmmqUg33f1S4bn6b8VukjA+c/fq737V3nm5q6MSVx4NkNg+f1zAgxpydOAHG3H242+A5UDaW/V v6RFHHqO0Leq9xsEVzItEs4OGB/XfLLg5zd1OjC2t2eKFhuPA/pHmTp8YIA8wVegls0Ck9meS4mYH BBsUaWGTmWEFZBEiEH7rARyNpbLKWqHrTrntLYygVvZWLJFQzlUo8zCz7WJ9ZDWCXVqwDnmtOZ03v jzztLqKh39fIZ6zZz5mH+A==; Date: Sat, 18 Oct 2025 13:28:38 +0300 Message-Id: <86ecr0ec6h.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Alan Mackenzie <acm@HIDDEN> In-Reply-To: <aPNl_EN-NdyiAWby@HIDDEN> (message from Alan Mackenzie on Sat, 18 Oct 2025 10:03:40 +0000) Subject: Re: bug#79649: Let's have freedom for naming frames on a tty. References: <aPNl_EN-NdyiAWby@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79649 Cc: 79649 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > Date: Sat, 18 Oct 2025 10:03:40 +0000 > From: Alan Mackenzie <acm@HIDDEN> > > Currently, on a tty, attempting to name a frame "F2" throws an error > rater than renaming the frame. This is a Bad Thing. It's a restriction we decided to have many years ago, when TY Emacs was taught to use more than a single frame. The reason is that Emacs itself gives such names to TTY frames when some Lisp program or a user creates a new TTY frame. Allowing such names for frames would cause name clashes (frames with identical names etc.), problems with select-frame-by-name, etc. Not allowing these names is an easy way of preventing such problems, with minimal or no user-level consequences. In your case, what prevents you from changing the command to use some other name, like Frame%d or somesuch? Why is it important that the frames are called F1, F2, etc.? > For some years now, I've been running an Emacs with this restriction > removed, and haven't hit any problems. In the deleted frame scenario > above, I just rename the "recreated" frame with: > > (modify-frame-parameters frame `((name . ,(format "F%s" (1+ n))))) > > I am asking for the restriction to be lifted in the Emacs master. The > following patch is suggested: Sorry, no, not without some additional changes, which would remove the reasons for the restriction (see above).
bug-gnu-emacs@HIDDEN:bug#79649; Package emacs.
Full text available.
Received: (at submit) by debbugs.gnu.org; 18 Oct 2025 10:04:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Oct 18 06:04:08 2025
Received: from localhost ([127.0.0.1]:39407 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vA3nD-00088e-Qr
for submit <at> debbugs.gnu.org; Sat, 18 Oct 2025 06:04:08 -0400
Received: from lists.gnu.org ([2001:470:142::17]:41256)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <acm@HIDDEN>) id 1vA3nB-000881-GE
for submit <at> debbugs.gnu.org; Sat, 18 Oct 2025 06:04:05 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from <acm@HIDDEN>) id 1vA3n4-0007Js-T8
for bug-gnu-emacs@HIDDEN; Sat, 18 Oct 2025 06:03:58 -0400
Received: from mail.muc.de ([193.149.48.3])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from <acm@HIDDEN>) id 1vA3n2-0001ct-Qy
for bug-gnu-emacs@HIDDEN; Sat, 18 Oct 2025 06:03:58 -0400
Received: (qmail 39479 invoked by uid 3782); 18 Oct 2025 12:03:41 +0200
Received: from muc.de (p4fe15dc3.dip0.t-ipconnect.de [79.225.93.195]) (using
STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP;
Sat, 18 Oct 2025 12:03:40 +0200
Received: (qmail 20875 invoked by uid 1000); 18 Oct 2025 10:03:40 -0000
Date: Sat, 18 Oct 2025 10:03:40 +0000
To: bug-gnu-emacs@HIDDEN
Subject: Let's have freedom for naming frames on a tty.
Message-ID: <aPNl_EN-NdyiAWby@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
X-Submission-Agent: TMDA/1.3.x (Ph3nix)
From: Alan Mackenzie <acm@HIDDEN>
X-Primary-Address: acm@HIDDEN
Received-SPF: pass client-ip=193.149.48.3; envelope-from=acm@HIDDEN;
helo=mail.muc.de
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,
SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.1 (/)
Hello, Emacs.
Currently, on a tty, attempting to name a frame "F2" throws an error
rater than renaming the frame. This is a Bad Thing.
On my set up on a Linux Console, I use the function keys on the keyboard
to switch between frames. <F4> switches to frame "F4", and so on.
Normally this isn't a problem, since Emacs names successive frames "F1",
"F2", "F3", ... anyway. But if a frame gets deleted for any reason, say
frame "F2", and another frame created, the new frame will be called "F4"
rather than "F2". So my function key <F2> now switches to frame "F4".
This is not good.
For some years now, I've been running an Emacs with this restriction
removed, and haven't hit any problems. In the deleted frame scenario
above, I just rename the "recreated" frame with:
(modify-frame-parameters frame `((name . ,(format "F%s" (1+ n)))))
I am asking for the restriction to be lifted in the Emacs master. The
following patch is suggested:
diff --git a/src/frame.c b/src/frame.c
index 6a93945ce33..7d1195c04a1 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -3674,11 +3674,6 @@ set_term_frame_name (struct frame *f, Lisp_Object name)
/* Don't change the name if it's already NAME. */
if (! NILP (Fstring_equal (name, f->name)))
return;
-
- /* Don't allow the user to set the frame name to F<num>, so it
- doesn't clash with the names we generate for terminal frames. */
- if (frame_name_fnn_p (SSDATA (name), SBYTES (name)))
- error ("Frame names of the form F<num> are usurped by Emacs");
}
fset_name (f, name);
--
Alan Mackenzie (Nuremberg, Germany).
Alan Mackenzie <acm@HIDDEN>:bug-gnu-emacs@HIDDEN.
Full text available.bug-gnu-emacs@HIDDEN:bug#79649; Package emacs.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.