all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Missing frame parameters on tty's
@ 2015-12-02 22:15 Alan Mackenzie
  2015-12-02 23:07 ` Juanma Barranquero
  2015-12-03  7:34 ` Eli Zaretskii
  0 siblings, 2 replies; 13+ messages in thread
From: Alan Mackenzie @ 2015-12-02 22:15 UTC (permalink / raw
  To: emacs-devel

Hello, Emacs.

In my initial investigation of bug #19706, an immediate cause of the
failure is clear - `frameset-move-onscreen' executes:

    (frame-parameter frame 'left)

, but on a tty this parameter is nil.  This is insanity, and was an
accident waiting to happen (it has now happened).

The correct values of frame parameters 'left and 'top on a tty cannot be
other than 0.

There are two ways of fixing bug #19706:

The first is to put in special case handling for missing frame
parameters, pray that the same error isn't already programmed into our
source anywhere else, and trust our highly skilled hackers never to
blunder into the same trap again.

The second is to set the frame parameters appropriately for tty's.

I think I've made it obvious which course I prefer.

-- 
Alan Mackenzie (Nuremberg, Germany).



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Missing frame parameters on tty's
  2015-12-02 22:15 Missing frame parameters on tty's Alan Mackenzie
@ 2015-12-02 23:07 ` Juanma Barranquero
  2015-12-03  7:34 ` Eli Zaretskii
  1 sibling, 0 replies; 13+ messages in thread
From: Juanma Barranquero @ 2015-12-02 23:07 UTC (permalink / raw
  To: Alan Mackenzie; +Cc: Emacs developers

[-- Attachment #1: Type: text/plain, Size: 725 bytes --]

On Wed, Dec 2, 2015 at 11:15 PM, Alan Mackenzie <acm@muc.de> wrote:

> There are two ways of fixing bug #19706:
>
> The first is to put in special case handling for missing frame
> parameters, pray that the same error isn't already programmed into our
> source anywhere else, and trust our highly skilled hackers never to
> blunder into the same trap again.

The framesets code already tries to deal with the different parameter lists
in graphic vs. tty frames. Seems like it doesn't work right in this case.
I'll take a look ASAP.

> The second is to set the frame parameters appropriately for tty's.

Well, IIUC, reducing differences between parameter lists in different kinds
of frames is always good, if at all possible.

[-- Attachment #2: Type: text/html, Size: 938 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Missing frame parameters on tty's
  2015-12-02 22:15 Missing frame parameters on tty's Alan Mackenzie
  2015-12-02 23:07 ` Juanma Barranquero
@ 2015-12-03  7:34 ` Eli Zaretskii
  2015-12-03  8:30   ` Alan Mackenzie
  1 sibling, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2015-12-03  7:34 UTC (permalink / raw
  To: Alan Mackenzie; +Cc: emacs-devel

> Date: Wed, 2 Dec 2015 22:15:34 +0000
> From: Alan Mackenzie <acm@muc.de>
> 
> In my initial investigation of bug #19706, an immediate cause of the
> failure is clear - `frameset-move-onscreen' executes:
> 
>     (frame-parameter frame 'left)
> 
> , but on a tty this parameter is nil.  This is insanity, and was an
> accident waiting to happen (it has now happened).

Code that accesses frame parameters should expect any particular
parameter to appear there, it should be resistant in the face of alist
elements missing completely.  There are many more frame parameters
that will never be present in a parameters alist of TTY frames (or any
other frame, for that matter).

> The correct values of frame parameters 'left and 'top on a tty cannot be
> other than 0.

Yes, and since a TTY frame cannot be moved anyway, the code in
question should already make a special case for such frames.

> There are two ways of fixing bug #19706:
> 
> The first is to put in special case handling for missing frame
> parameters, pray that the same error isn't already programmed into our
> source anywhere else, and trust our highly skilled hackers never to
> blunder into the same trap again.
> 
> The second is to set the frame parameters appropriately for tty's.
> 
> I think I've made it obvious which course I prefer.

I hope I explained why I disagree with you.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Missing frame parameters on tty's
  2015-12-03  7:34 ` Eli Zaretskii
@ 2015-12-03  8:30   ` Alan Mackenzie
  2015-12-03 10:27     ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: Alan Mackenzie @ 2015-12-03  8:30 UTC (permalink / raw
  To: Eli Zaretskii; +Cc: emacs-devel

Hello, Eli.

On Thu, Dec 03, 2015 at 09:34:42AM +0200, Eli Zaretskii wrote:
> > Date: Wed, 2 Dec 2015 22:15:34 +0000
> > From: Alan Mackenzie <acm@muc.de>

> > In my initial investigation of bug #19706, an immediate cause of the
> > failure is clear - `frameset-move-onscreen' executes:

> >     (frame-parameter frame 'left)

> > , but on a tty this parameter is nil.  This is insanity, and was an
> > accident waiting to happen (it has now happened).

> Code that accesses frame parameters should expect any particular
> parameter to appear there, it should be resistant in the face of alist
> elements missing completely.  There are many more frame parameters
> that will never be present in a parameters alist of TTY frames (or any
> other frame, for that matter).

Yes, there are 56 frame parameters on an X Emacs I just fired up, and 19
on my Linux tty session.  I'm not suggesting the numbers should be made
equal - rather that the two particular parameters 'top and 'left should
be present in all frames.

> > The correct values of frame parameters 'left and 'top on a tty cannot be
> > other than 0.

> Yes, and since a TTY frame cannot be moved anyway, the code in
> question should already make a special case for such frames.

We have an error here because a special case wasn't made, and it is
understandable that it wasn't made - the best of us are only human, after
all.  Who on earth would think that only half of the "geometry
parameters" would be present?

The thing is, this error is going to happen again, at some stage.  We
could prevent this now.

> > There are two ways of fixing bug #19706:

> > The first is to put in special case handling for missing frame
> > parameters, pray that the same error isn't already programmed into our
> > source anywhere else, and trust our highly skilled hackers never to
> > blunder into the same trap again.

> > The second is to set the frame parameters appropriately for tty's.

> > I think I've made it obvious which course I prefer.

> I hope I explained why I disagree with you.

I don't think you have.  You haven't pointed out any disadvantage in a
tty frame having (top . 0) and (left . 0).

-- 
Alan Mackenzie (Nuremberg, Germany).



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Missing frame parameters on tty's
  2015-12-03  8:30   ` Alan Mackenzie
@ 2015-12-03 10:27     ` Eli Zaretskii
  2015-12-03 11:18       ` Alan Mackenzie
  0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2015-12-03 10:27 UTC (permalink / raw
  To: Alan Mackenzie; +Cc: emacs-devel

> Date: Thu, 3 Dec 2015 08:30:01 +0000
> Cc: emacs-devel@gnu.org
> From: Alan Mackenzie <acm@muc.de>
> 
> > Code that accesses frame parameters should expect any particular
> > parameter to appear there, it should be resistant in the face of alist
> > elements missing completely.  There are many more frame parameters
> > that will never be present in a parameters alist of TTY frames (or any
> > other frame, for that matter).
> 
> Yes, there are 56 frame parameters on an X Emacs I just fired up, and 19
> on my Linux tty session.  I'm not suggesting the numbers should be made
> equal - rather that the two particular parameters 'top and 'left should
> be present in all frames.

Why single out those two?  Especially since it make no sense at all to
have them on TTY frames.

> > Yes, and since a TTY frame cannot be moved anyway, the code in
> > question should already make a special case for such frames.
> 
> We have an error here because a special case wasn't made, and it is
> understandable that it wasn't made - the best of us are only human, after
> all.  Who on earth would think that only half of the "geometry
> parameters" would be present?

You don't need to think about this specifically.  You need to be
prepared to handle the case that the frame parameter -- any frame
parameter -- is missing from the parameters' alist.

> The thing is, this error is going to happen again, at some stage.  We
> could prevent this now.

But the same could happen with any other parameter that is missing on
TTY frames, no?

> > I hope I explained why I disagree with you.
> 
> I don't think you have.  You haven't pointed out any disadvantage in a
> tty frame having (top . 0) and (left . 0).

I just don't understand what makes these two frame parameters special.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Missing frame parameters on tty's
  2015-12-03 10:27     ` Eli Zaretskii
@ 2015-12-03 11:18       ` Alan Mackenzie
  2015-12-03 11:34         ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: Alan Mackenzie @ 2015-12-03 11:18 UTC (permalink / raw
  To: Eli Zaretskii; +Cc: emacs-devel

Hello, Eli.

On Thu, Dec 03, 2015 at 12:27:45PM +0200, Eli Zaretskii wrote:
> > Date: Thu, 3 Dec 2015 08:30:01 +0000
> > Cc: emacs-devel@gnu.org
> > From: Alan Mackenzie <acm@muc.de>

[ .... ]

> > Yes, there are 56 frame parameters on an X Emacs I just fired up, and 19
> > on my Linux tty session.  I'm not suggesting the numbers should be made
> > equal - rather that the two particular parameters 'top and 'left should
> > be present in all frames.

> Why single out those two?

Because they're the two over which a misunderstanding has happened.  I
actually have another theory on that (see below).

> Especially since it make no sense at all to have them on TTY frames.

I think it does.  A tty frame's top left corner starts 0 "pixels" from
the top and from the left of the screen.  To have them on a TTY avoids
the need for two special cases (GUI and TTY) when handling 'top, 'left,
'height, and 'width.

> > > Yes, and since a TTY frame cannot be moved anyway, the code in
> > > question should already make a special case for such frames.

> > We have an error here because a special case wasn't made, and it is
> > understandable that it wasn't made - the best of us are only human, after
> > all.  Who on earth would think that only half of the "geometry
> > parameters" would be present?

> You don't need to think about this specifically.  You need to be
> prepared to handle the case that the frame parameter -- any frame
> parameter -- is missing from the parameters' alist.

OK, in theory: I'll take your word for it, if you tell me this is
generally done in practice too.

> > The thing is, this error is going to happen again, at some stage.  We
> > could prevent this now.

> But the same could happen with any other parameter that is missing on
> TTY frames, no?

Not with most of them, no.  Many are so obviously irrelevant to TTY
frames that nobody would think about using them (like those in Elisp
chapter "Window Management Parameters")

> > > I hope I explained why I disagree with you.

> > I don't think you have.  You haven't pointed out any disadvantage in a
> > tty frame having (top . 0) and (left . 0).

> I just don't understand what makes these two frame parameters special.

That their absence has already caused an error.  I think it is intutively
more likely that these two will cause such a misunderstanding than any
others absent from a TTY.

Anyhow, I've been reading the "Window Frame Parameters" chapter in the
Elisp manual, in particular "Position Parameters".  The description of
`left' and `top' immediately follow a statement that measurements on a
TTY are in terms of characters or lines.  This cannot help but give the
impression `left' and `top' _are_ available on TTYs.  Perhaps if we
aren't going to give TTYs these parameters, we should amend that manual
page to say explicitly that TTYs don't have them.

-- 
Alan Mackenzie (Nuremberg, Germany).



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Missing frame parameters on tty's
  2015-12-03 11:18       ` Alan Mackenzie
@ 2015-12-03 11:34         ` Eli Zaretskii
  2016-01-18 16:02           ` Alan Mackenzie
  0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2015-12-03 11:34 UTC (permalink / raw
  To: Alan Mackenzie; +Cc: emacs-devel

> Date: Thu, 3 Dec 2015 11:18:15 +0000
> Cc: emacs-devel@gnu.org
> From: Alan Mackenzie <acm@muc.de>
> 
> > Why single out those two?
> 
> Because they're the two over which a misunderstanding has happened.

Doesn't sound like a compelling reason to me.

> > Especially since it make no sense at all to have them on TTY frames.
> 
> I think it does.  A tty frame's top left corner starts 0 "pixels" from
> the top and from the left of the screen.

And it cannot start at any other point.  What sense does it make to
have frame parameters whose values are known in advance, and cannot be
changed?

> Anyhow, I've been reading the "Window Frame Parameters" chapter in the
> Elisp manual, in particular "Position Parameters".  The description of
> `left' and `top' immediately follow a statement that measurements on a
> TTY are in terms of characters or lines.  This cannot help but give the
> impression `left' and `top' _are_ available on TTYs.  Perhaps if we
> aren't going to give TTYs these parameters, we should amend that manual
> page to say explicitly that TTYs don't have them.

Patches to that effect are welcome.

Thanks.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Missing frame parameters on tty's
  2015-12-03 11:34         ` Eli Zaretskii
@ 2016-01-18 16:02           ` Alan Mackenzie
  2016-01-18 16:11             ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: Alan Mackenzie @ 2016-01-18 16:02 UTC (permalink / raw
  To: Eli Zaretskii; +Cc: emacs-devel

Hello, Eli.

On Thu, Dec 03, 2015 at 01:34:35PM +0200, Eli Zaretskii wrote:
> > Date: Thu, 3 Dec 2015 11:18:15 +0000
> > Cc: emacs-devel@gnu.org
> > From: Alan Mackenzie <acm@muc.de>

[ .... ]

> > Anyhow, I've been reading the "Window Frame Parameters" chapter in the
> > Elisp manual, in particular "Position Parameters".  The description of
> > `left' and `top' immediately follow a statement that measurements on a
> > TTY are in terms of characters or lines.  This cannot help but give the
> > impression `left' and `top' _are_ available on TTYs.  Perhaps if we
> > aren't going to give TTYs these parameters, we should amend that manual
> > page to say explicitly that TTYs don't have them.

> Patches to that effect are welcome.

How about this one, then?


diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index 5d873ac..18932cb 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -1188,8 +1188,8 @@ Position Parameters
 @cindex window position on display
 @cindex frame position
 
-  Position parameters' values are normally measured in pixels, but on
-text terminals they count characters or lines instead.
+  Position parameters' values are measured in pixels.  None of them
+exist on text terminal frames.
 
 @table @code
 @vindex left, a frame parameter


> Thanks.

-- 
Alan Mackenzie (Nuremberg, Germany).



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: Missing frame parameters on tty's
  2016-01-18 16:02           ` Alan Mackenzie
@ 2016-01-18 16:11             ` Eli Zaretskii
  2016-01-18 17:03               ` Alan Mackenzie
  0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2016-01-18 16:11 UTC (permalink / raw
  To: Alan Mackenzie; +Cc: emacs-devel

> Date: Mon, 18 Jan 2016 16:02:14 +0000
> Cc: emacs-devel@gnu.org
> From: Alan Mackenzie <acm@muc.de>
> 
> --- a/doc/lispref/frames.texi
> +++ b/doc/lispref/frames.texi
> @@ -1188,8 +1188,8 @@ Position Parameters
>  @cindex window position on display
>  @cindex frame position
>  
> -  Position parameters' values are normally measured in pixels, but on
> -text terminals they count characters or lines instead.
> +  Position parameters' values are measured in pixels.  None of them
> +exist on text terminal frames.

I'd suggest something like

  (Note that none of these parameters exist on text-mode frames.)




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Missing frame parameters on tty's
  2016-01-18 16:11             ` Eli Zaretskii
@ 2016-01-18 17:03               ` Alan Mackenzie
  2016-01-18 17:07                 ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: Alan Mackenzie @ 2016-01-18 17:03 UTC (permalink / raw
  To: Eli Zaretskii; +Cc: emacs-devel

Hello again, Eli.

On Mon, Jan 18, 2016 at 06:11:09PM +0200, Eli Zaretskii wrote:
> > Date: Mon, 18 Jan 2016 16:02:14 +0000
> > Cc: emacs-devel@gnu.org
> > From: Alan Mackenzie <acm@muc.de>

> > --- a/doc/lispref/frames.texi
> > +++ b/doc/lispref/frames.texi
> > @@ -1188,8 +1188,8 @@ Position Parameters
> >  @cindex window position on display
> >  @cindex frame position

> > -  Position parameters' values are normally measured in pixels, but on
> > -text terminals they count characters or lines instead.
> > +  Position parameters' values are measured in pixels.  None of them
> > +exist on text terminal frames.

> I'd suggest something like

>   (Note that none of these parameters exist on text-mode frames.)

OK, but I'm not too keen on "text-mode" frames - there's a danger of
confusion with the major mode of that name.  How about:

    (Note that none of these parameters exist on text terminal frames.}

, using the original term "text terminal", but keeping the sentence in
parenteses?  After all, the main purpose is to alert Emacs Lisp hackers
to the possibility of these frame parameters being nil; exactly when
they are going to be nil is of secondary importance.

-- 
Alan Mackenzie (Nuremberg, Germany).



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Missing frame parameters on tty's
  2016-01-18 17:03               ` Alan Mackenzie
@ 2016-01-18 17:07                 ` Eli Zaretskii
  2016-01-18 17:55                   ` Alan Mackenzie
  0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2016-01-18 17:07 UTC (permalink / raw
  To: Alan Mackenzie; +Cc: emacs-devel

> Date: Mon, 18 Jan 2016 17:03:32 +0000
> Cc: emacs-devel@gnu.org
> From: Alan Mackenzie <acm@muc.de>
> 
> > I'd suggest something like
> 
> >   (Note that none of these parameters exist on text-mode frames.)
> 
> OK, but I'm not too keen on "text-mode" frames - there's a danger of
> confusion with the major mode of that name.  How about:
> 
>     (Note that none of these parameters exist on text terminal frames.}
> 
> , using the original term "text terminal", but keeping the sentence in
> parenteses?  After all, the main purpose is to alert Emacs Lisp hackers
> to the possibility of these frame parameters being nil; exactly when
> they are going to be nil is of secondary importance.

The official terminology is "TTY frames" or "text-mode frames".  But I
won't insist.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Missing frame parameters on tty's
  2016-01-18 17:07                 ` Eli Zaretskii
@ 2016-01-18 17:55                   ` Alan Mackenzie
  2016-01-18 18:41                     ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: Alan Mackenzie @ 2016-01-18 17:55 UTC (permalink / raw
  To: Eli Zaretskii; +Cc: emacs-devel

Hello, Eli.

On Mon, Jan 18, 2016 at 07:07:46PM +0200, Eli Zaretskii wrote:
> > Date: Mon, 18 Jan 2016 17:03:32 +0000
> > Cc: emacs-devel@gnu.org
> > From: Alan Mackenzie <acm@muc.de>

> > > I'd suggest something like

> > >   (Note that none of these parameters exist on text-mode frames.)

> > OK, but I'm not too keen on "text-mode" frames - there's a danger of
> > confusion with the major mode of that name.  How about:

> >     (Note that none of these parameters exist on text terminal frames.}

> > , using the original term "text terminal", but keeping the sentence in
> > parenteses?  After all, the main purpose is to alert Emacs Lisp hackers
> > to the possibility of these frame parameters being nil; exactly when
> > they are going to be nil is of secondary importance.

> The official terminology is "TTY frames" or "text-mode frames".  But I
> won't insist.

OK.  It's probably less important than other things, but I think the
following will be satisfactory to both of us:


diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index 5d873ac..614b7db 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -1188,8 +1188,8 @@ Position Parameters
 @cindex window position on display
 @cindex frame position
 
-  Position parameters' values are normally measured in pixels, but on
-text terminals they count characters or lines instead.
+  Position parameters' values are measured in pixels.  (Note that none
+of these parameters exist on TTY frames.)
 
 @table @code
 @vindex left, a frame parameter


I'll commit it soon if (as expected) I don't hear back from you.

-- 
Alan Mackenzie (Nuremberg, Germany).



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: Missing frame parameters on tty's
  2016-01-18 17:55                   ` Alan Mackenzie
@ 2016-01-18 18:41                     ` Eli Zaretskii
  0 siblings, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2016-01-18 18:41 UTC (permalink / raw
  To: Alan Mackenzie; +Cc: emacs-devel

> Date: Mon, 18 Jan 2016 17:55:19 +0000
> From: Alan Mackenzie <acm@muc.de>
> Cc: emacs-devel@gnu.org
> 
> OK.  It's probably less important than other things, but I think the
> following will be satisfactory to both of us:
> 
> 
> diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
> index 5d873ac..614b7db 100644
> --- a/doc/lispref/frames.texi
> +++ b/doc/lispref/frames.texi
> @@ -1188,8 +1188,8 @@ Position Parameters
>  @cindex window position on display
>  @cindex frame position
>  
> -  Position parameters' values are normally measured in pixels, but on
> -text terminals they count characters or lines instead.
> +  Position parameters' values are measured in pixels.  (Note that none
> +of these parameters exist on TTY frames.)
>  
>  @table @code
>  @vindex left, a frame parameter
> 
> 
> I'll commit it soon if (as expected) I don't hear back from you.

Please do (even though you did hear from me), and thanks.



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2016-01-18 18:41 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-02 22:15 Missing frame parameters on tty's Alan Mackenzie
2015-12-02 23:07 ` Juanma Barranquero
2015-12-03  7:34 ` Eli Zaretskii
2015-12-03  8:30   ` Alan Mackenzie
2015-12-03 10:27     ` Eli Zaretskii
2015-12-03 11:18       ` Alan Mackenzie
2015-12-03 11:34         ` Eli Zaretskii
2016-01-18 16:02           ` Alan Mackenzie
2016-01-18 16:11             ` Eli Zaretskii
2016-01-18 17:03               ` Alan Mackenzie
2016-01-18 17:07                 ` Eli Zaretskii
2016-01-18 17:55                   ` Alan Mackenzie
2016-01-18 18:41                     ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.