unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Function: window-fringes
@ 2006-08-15  0:34 Nick Roberts
  2006-08-15  8:57 ` Kim F. Storm
  2006-08-15 21:03 ` Chong Yidong
  0 siblings, 2 replies; 10+ messages in thread
From: Nick Roberts @ 2006-08-15  0:34 UTC (permalink / raw)



On a text-only terminal, I think window-fringes should always return (0 0 nil).

-- 
Nick                                           http://www.inet.net.nz/~nickrob

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

* Re: Function: window-fringes
  2006-08-15  0:34 Function: window-fringes Nick Roberts
@ 2006-08-15  8:57 ` Kim F. Storm
  2006-08-15 10:05   ` Nick Roberts
  2006-08-15 21:03 ` Chong Yidong
  1 sibling, 1 reply; 10+ messages in thread
From: Kim F. Storm @ 2006-08-15  8:57 UTC (permalink / raw)
  Cc: emacs-devel

Nick Roberts <nickrob@snap.net.nz> writes:

> On a text-only terminal, I think window-fringes should always return (0 0 nil).

Ok.  Pls. fix it.


-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

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

* Re: Function: window-fringes
  2006-08-15  8:57 ` Kim F. Storm
@ 2006-08-15 10:05   ` Nick Roberts
  2006-08-15 18:40     ` Richard Stallman
  2006-08-15 20:40     ` Kim F. Storm
  0 siblings, 2 replies; 10+ messages in thread
From: Nick Roberts @ 2006-08-15 10:05 UTC (permalink / raw)
  Cc: emacs-devel

 > > On a text-only terminal, I think window-fringes should always return
 > > (0 0 nil).
 > 
 > Ok.  Pls. fix it.

Well it's a bit of a shot in the dark.  In future with multi-tty, where
some windows might be graphic and others text-only, it might be better to
condition on the selected window:

  if (WINDOW_FRAME_COLUMN_WIDTH (w) == 1)

But maybe that's not orthodox at the moment.

-- 
Nick                                           http://www.inet.net.nz/~nickrob

*** window.c	19 Jul 2006 01:29:55 +1200	1.553
--- window.c	15 Aug 2006 21:59:53 +1200	
***************
*** 6687,6696 ****
       Lisp_Object window;
  {
    struct window *w = decode_window (window);
!   return Fcons (make_number (WINDOW_LEFT_FRINGE_WIDTH (w)),
! 		Fcons (make_number (WINDOW_RIGHT_FRINGE_WIDTH (w)),
! 		       Fcons ((WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) ?
! 			       Qt : Qnil), Qnil)));
  }
  
  
--- 6687,6700 ----
       Lisp_Object window;
  {
    struct window *w = decode_window (window);
!   if (EQ (Vwindow_system, Qnil))
!     return Fcons (make_number (0), (Fcons (make_number (0),
! 					   (Fcons (Qnil, Qnil)))));
!   else    
!     return Fcons (make_number (WINDOW_LEFT_FRINGE_WIDTH (w)),
! 		  Fcons (make_number (WINDOW_RIGHT_FRINGE_WIDTH (w)),
! 			 Fcons ((WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) ?
! 				 Qt : Qnil), Qnil)));
  }

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

* Re: Function: window-fringes
  2006-08-15 10:05   ` Nick Roberts
@ 2006-08-15 18:40     ` Richard Stallman
  2006-08-15 22:20       ` Nick Roberts
  2006-08-15 20:40     ` Kim F. Storm
  1 sibling, 1 reply; 10+ messages in thread
From: Richard Stallman @ 2006-08-15 18:40 UTC (permalink / raw)
  Cc: emacs-devel, storm

    !   if (EQ (Vwindow_system, Qnil))
    !     return Fcons (make_number (0), (Fcons (make_number (0),
    ! 					   (Fcons (Qnil, Qnil)))));
    !   else    
    !     return Fcons (make_number (WINDOW_LEFT_FRINGE_WIDTH (w)),
    ! 		  Fcons (make_number (WINDOW_RIGHT_FRINGE_WIDTH (w)),
    ! 			 Fcons ((WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) ?
    ! 				 Qt : Qnil), Qnil)));

What causes the existing code to return anything other than (0 0 nil)
on a tty?  It seems to me that if that happens, it indicates a bug.
Rather than paper over the bug's effects in this one spot, we should
see what causes the bug.  Then we could perhaps paper it over anyway,
or perhaps fix it.

By the way, please put the ? operator (like all infix operators)
after the line break, not before.

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

* Re: Function: window-fringes
  2006-08-15 10:05   ` Nick Roberts
  2006-08-15 18:40     ` Richard Stallman
@ 2006-08-15 20:40     ` Kim F. Storm
  1 sibling, 0 replies; 10+ messages in thread
From: Kim F. Storm @ 2006-08-15 20:40 UTC (permalink / raw)
  Cc: emacs-devel

Nick Roberts <nickrob@snap.net.nz> writes:

>        Lisp_Object window;
>   {
>     struct window *w = decode_window (window);
> !   if (EQ (Vwindow_system, Qnil))

Isn't this better?
      
      if (!FRAME_WINDOW_P (WINDOW_XFRAME (w))) 


> !     return Fcons (make_number (0), (Fcons (make_number (0),
> ! 					   (Fcons (Qnil, Qnil)))));
> !   else    
> !     return Fcons (make_number (WINDOW_LEFT_FRINGE_WIDTH (w)),
> ! 		  Fcons (make_number (WINDOW_RIGHT_FRINGE_WIDTH (w)),
> ! 			 Fcons ((WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) ?
> ! 				 Qt : Qnil), Qnil)));
>   }
>   
>   
>
>

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

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

* Re: Function: window-fringes
  2006-08-15  0:34 Function: window-fringes Nick Roberts
  2006-08-15  8:57 ` Kim F. Storm
@ 2006-08-15 21:03 ` Chong Yidong
  1 sibling, 0 replies; 10+ messages in thread
From: Chong Yidong @ 2006-08-15 21:03 UTC (permalink / raw)
  Cc: emacs-devel

Nick Roberts <nickrob@snap.net.nz> writes:

> On a text-only terminal, I think window-fringes should always return (0 0 nil).

How do you make it return something other than (0 0 nil)?

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

* Re: Function: window-fringes
  2006-08-15 18:40     ` Richard Stallman
@ 2006-08-15 22:20       ` Nick Roberts
  2006-08-16 19:27         ` Richard Stallman
  0 siblings, 1 reply; 10+ messages in thread
From: Nick Roberts @ 2006-08-15 22:20 UTC (permalink / raw)
  Cc: emacs-devel, storm

Richard Stallman writes:
 >     !   if (EQ (Vwindow_system, Qnil))
 >     !     return Fcons (make_number (0), (Fcons (make_number (0),
 >     ! 					   (Fcons (Qnil, Qnil)))));
 >     !   else    
 >     !     return Fcons (make_number (WINDOW_LEFT_FRINGE_WIDTH (w)),
 >     ! 		  Fcons (make_number (WINDOW_RIGHT_FRINGE_WIDTH (w)),
 >     ! 			 Fcons ((WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) ?
 >     ! 				 Qt : Qnil), Qnil)));
 > 
 > What causes the existing code to return anything other than (0 0 nil)
 > on a tty?

You can set it with set-window-fringes, directly through the variables
left-fringe-width or right-fringe-width and probably with
modify-frame-parameters (or specifying frame parameters).

 >            It seems to me that if that happens, it indicates a bug.
 > Rather than paper over the bug's effects in this one spot, we should
 > see what causes the bug.  Then we could perhaps paper it over anyway,
 > or perhaps fix it.

I think this is the right change.  You can't stop a user from changing variable
values but window-fringes purports to return actual window attributes, not the
value of some variables

 > By the way, please put the ? operator (like all infix operators)
 > after the line break, not before.

OK.

-- 
Nick                                           http://www.inet.net.nz/~nickrob

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

* Re: Function: window-fringes
  2006-08-15 22:20       ` Nick Roberts
@ 2006-08-16 19:27         ` Richard Stallman
  2006-08-17  3:34           ` Nick Roberts
  0 siblings, 1 reply; 10+ messages in thread
From: Richard Stallman @ 2006-08-16 19:27 UTC (permalink / raw)
  Cc: emacs-devel, storm

    You can set it with set-window-fringes, directly through the variables
    left-fringe-width or right-fringe-width and probably with
    modify-frame-parameters (or specifying frame parameters).

Judging from reading the code, I don't think that the values of
left-fringe-width and right-fringe-width have any effect on the value
of WINDOW_LEFT_FRINGE_WIDTH, on a tty frame.  I don't think that
trying to specify the frame parameter has any effect on the frame
fringe width, on a tty frame.  Have you actually observed that either
of these actions has such an effect?

It looks like set-window-fringes really can set the frame width
slots.  I think that is the bug.  So let's change it not to set them
on a tty.

With the following change, does any of this problem persist?


*** window.c	18 Jul 2006 09:41:15 -0400	1.553
--- window.c	16 Aug 2006 12:47:34 -0400	
***************
*** 6657,6662 ****
--- 6657,6666 ----
    if (!NILP (right_width))
      CHECK_NATNUM (right_width);
  
+   /* Do nothing on a tty.  */
+   if (! FRAME_WINDOW_P (f))
+     return Qnil;
+ 
    if (!EQ (w->left_fringe_width, left_width)
        || !EQ (w->right_fringe_width, right_width)
        || !EQ (w->fringes_outside_margins, outside_margins))

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

* Re: Function: window-fringes
  2006-08-16 19:27         ` Richard Stallman
@ 2006-08-17  3:34           ` Nick Roberts
  2006-08-17 15:19             ` Richard Stallman
  0 siblings, 1 reply; 10+ messages in thread
From: Nick Roberts @ 2006-08-17  3:34 UTC (permalink / raw)
  Cc: emacs-devel, storm

Richard Stallman writes:
 >     You can set it with set-window-fringes, directly through the variables
 >     left-fringe-width or right-fringe-width and probably with
 >     modify-frame-parameters (or specifying frame parameters).
 > 
 > Judging from reading the code, I don't think that the values of
 > left-fringe-width and right-fringe-width have any effect on the value
 > of WINDOW_LEFT_FRINGE_WIDTH, on a tty frame.  I don't think that
 > trying to specify the frame parameter has any effect on the frame
 > fringe width, on a tty frame.  Have you actually observed that either
 > of these actions has such an effect?

Yes, I think you're right.  I must have made some false assumptions.

 > It looks like set-window-fringes really can set the frame width
 > slots.  I think that is the bug.  So let's change it not to set them
 > on a tty.
 > 
 > With the following change, does any of this problem persist?
 > 
 > 
 > *** window.c	18 Jul 2006 09:41:15 -0400	1.553
 > --- window.c	16 Aug 2006 12:47:34 -0400	
 > ***************
 > *** 6657,6662 ****
 > --- 6657,6666 ----
 >     if (!NILP (right_width))
 >       CHECK_NATNUM (right_width);
 >   
 > +   /* Do nothing on a tty.  */
 > +   if (! FRAME_WINDOW_P (f))
 > +     return Qnil;
 > + 
 >     if (!EQ (w->left_fringe_width, left_width)
 >         || !EQ (w->right_fringe_width, right_width)
 >         || !EQ (w->fringes_outside_margins, outside_margins))

It doesn't compile.

How about below? (using Kim's suggested condition for window-fringes).


-- 
Nick                                           http://www.inet.net.nz/~nickrob



*** window.c	19 Jul 2006 01:29:55 +1200	1.553
--- window.c	17 Aug 2006 15:26:32 +1200	
***************
*** 6656,6665 ****
      CHECK_NATNUM (left_width);
    if (!NILP (right_width))
      CHECK_NATNUM (right_width);
! 
!   if (!EQ (w->left_fringe_width, left_width)
!       || !EQ (w->right_fringe_width, right_width)
!       || !EQ (w->fringes_outside_margins, outside_margins))
      {
        w->left_fringe_width = left_width;
        w->right_fringe_width = right_width;
--- 6656,6667 ----
      CHECK_NATNUM (left_width);
    if (!NILP (right_width))
      CHECK_NATNUM (right_width);
!  
!       /* Do nothing on a tty.  */
!   if (FRAME_WINDOW_P (WINDOW_XFRAME (w))
!       && (!EQ (w->left_fringe_width, left_width)
! 	  || !EQ (w->right_fringe_width, right_width)
! 	  || !EQ (w->fringes_outside_margins, outside_margins)))
      {
        w->left_fringe_width = left_width;
        w->right_fringe_width = right_width;
***************
*** 6687,6696 ****
       Lisp_Object window;
  {
    struct window *w = decode_window (window);
    return Fcons (make_number (WINDOW_LEFT_FRINGE_WIDTH (w)),
  		Fcons (make_number (WINDOW_RIGHT_FRINGE_WIDTH (w)),
! 		       Fcons ((WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) ?
! 			       Qt : Qnil), Qnil)));
  }
  
  
--- 6689,6699 ----
       Lisp_Object window;
  {
    struct window *w = decode_window (window);
+ 
    return Fcons (make_number (WINDOW_LEFT_FRINGE_WIDTH (w)),
  		Fcons (make_number (WINDOW_RIGHT_FRINGE_WIDTH (w)),
! 		       Fcons ((WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
! 			       ? Qt : Qnil), Qnil)));
  }

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

* Re: Function: window-fringes
  2006-08-17  3:34           ` Nick Roberts
@ 2006-08-17 15:19             ` Richard Stallman
  0 siblings, 0 replies; 10+ messages in thread
From: Richard Stallman @ 2006-08-17 15:19 UTC (permalink / raw)
  Cc: emacs-devel, storm

    It doesn't compile.

Your way of fixing it seems right.  Please install it.

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

end of thread, other threads:[~2006-08-17 15:19 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-15  0:34 Function: window-fringes Nick Roberts
2006-08-15  8:57 ` Kim F. Storm
2006-08-15 10:05   ` Nick Roberts
2006-08-15 18:40     ` Richard Stallman
2006-08-15 22:20       ` Nick Roberts
2006-08-16 19:27         ` Richard Stallman
2006-08-17  3:34           ` Nick Roberts
2006-08-17 15:19             ` Richard Stallman
2006-08-15 20:40     ` Kim F. Storm
2006-08-15 21:03 ` Chong Yidong

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).