unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [patch] proposal tiny cleanup for window code
@ 2007-11-07 10:58 Dmitry Antipov
  2007-11-07 12:57 ` martin rudalics
  2007-11-08  4:42 ` Richard Stallman
  0 siblings, 2 replies; 5+ messages in thread
From: Dmitry Antipov @ 2007-11-07 10:58 UTC (permalink / raw)
  To: emacs-devel

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

I've found that too_small_ok member of struct window isn't used anywhere except size_window,
so it looks like there are no reasons to have too_small_ok within struct window...

Dmitry


[-- Attachment #2: too_small_ok-drop.patch --]
[-- Type: text/x-patch, Size: 3520 bytes --]

Index: doc/lispref/ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/doc/lispref/ChangeLog,v
retrieving revision 1.15
diff -u -r1.15 ChangeLog
--- doc/lispref/ChangeLog	31 Oct 2007 04:08:29 -0000	1.15
+++ doc/lispref/ChangeLog	7 Nov 2007 07:00:59 -0000
@@ -1,3 +1,7 @@
+2007-11-07  Dmitry Antipov  <dmantipov@yandex.ru>
+
+	* internals.texi (Window Internals): Remove description of too_small_ok.
+	
 2007-10-31  Richard Stallman  <rms@gnu.org>
 
 	* strings.texi (Creating Strings): Null strings from concat not unique.
Index: doc/lispref/internals.texi
===================================================================
RCS file: /sources/emacs/emacs/doc/lispref/internals.texi,v
retrieving revision 1.2
diff -u -r1.2 internals.texi
--- doc/lispref/internals.texi	6 Sep 2007 04:27:42 -0000	1.2
+++ doc/lispref/internals.texi	7 Nov 2007 07:00:59 -0000
@@ -1280,9 +1280,6 @@
 Non-@code{nil} means current value of @code{start} was the beginning of a line
 when it was chosen.
 
-@item too_small_ok
-Non-@code{nil} means don't delete this window for becoming ``too small.''
-
 @item height_fixed_p
 This field is temporarily set to 1 to fix the height of the selected
 window when the echo area is resized.
Index: src/ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/src/ChangeLog,v
retrieving revision 1.5979
diff -u -r1.5979 ChangeLog
--- src/ChangeLog	6 Nov 2007 09:27:17 -0000	1.5979
+++ src/ChangeLog	7 Nov 2007 07:01:01 -0000
@@ -1,3 +1,8 @@
+2007-11-07  Dmitry Antipov  <dmantipov@yandex.ru>
+
+	* window.h (struct window): Remove too_small_ok.
+	* window.c (size_window): Replace too_small_ok with it's value.
+	
 2007-11-06  Jan Dj^[,Ad^[(Brv  <jan.h.d@swipnet.se>
 
 	* gtkutil.c (xg_tool_bar_menu_proxy): Handle GTK_IMAGE_ICON_NAME and
Index: src/window.c
===================================================================
RCS file: /sources/emacs/emacs/src/window.c,v
retrieving revision 1.597
diff -u -r1.597 window.c
--- src/window.c	26 Oct 2007 20:56:47 -0000	1.597
+++ src/window.c	7 Nov 2007 07:01:01 -0000
@@ -3048,9 +3048,6 @@
       safe_min_size = window_min_size_2 (w, 0);
     }
 
-  if (old_size < min_size && nodelete_p != 2)
-    w->too_small_ok = Qt;
-
   /* Move the following test here since otherwise the
      preceding test doesn't make sense.  martin. */
   if (nodelete_p == 2)
@@ -3059,7 +3056,7 @@
   /* Maybe delete WINDOW if it's too small.  */
   if (nodelete_p != 1 && !NILP (w->parent))
     {
-      if (!MINI_WINDOW_P (w) && !NILP (w->too_small_ok))
+      if (!MINI_WINDOW_P (w) && old_size < min_size && nodelete_p != 2)
 	min_size = width_p ? MIN_SAFE_WINDOW_WIDTH : MIN_SAFE_WINDOW_HEIGHT;
       if (min_size < safe_min_size)
 	min_size = safe_min_size;
Index: src/window.h
===================================================================
RCS file: /sources/emacs/emacs/src/window.h,v
retrieving revision 1.73
diff -u -r1.73 window.h
--- src/window.h	2 Oct 2007 21:55:26 -0000	1.73
+++ src/window.h	7 Nov 2007 07:01:02 -0000
@@ -221,9 +221,6 @@
     /* If redisplay in this window goes beyond this buffer position,
        must run the redisplay-end-trigger-hook.  */
     Lisp_Object redisplay_end_trigger;
-    /* Non-nil means don't delete this window for becoming "too small".  */
-    Lisp_Object too_small_ok;
-
     /* Original window height and top before mini-window was
        enlarged. */
     Lisp_Object orig_total_lines, orig_top_line;

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

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

* Re: [patch] proposal tiny cleanup for window code
  2007-11-07 10:58 [patch] proposal tiny cleanup for window code Dmitry Antipov
@ 2007-11-07 12:57 ` martin rudalics
  2007-11-07 13:32   ` Dmitry Antipov
  2007-11-08  4:42 ` Richard Stallman
  1 sibling, 1 reply; 5+ messages in thread
From: martin rudalics @ 2007-11-07 12:57 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: emacs-devel

 > I've found that too_small_ok member of struct window isn't used anywhere
 > except size_window,
 > so it looks like there are no reasons to have too_small_ok within struct
 > window...

I fail to understand the use of that but the current code reads as

   if (old_size < min_size && nodelete_p != 2)
     w->too_small_ok = Qt;

   /* Move the following test here since otherwise the
      preceding test doesn't make sense.  martin. */
   if (nodelete_p == 2)
     nodelete_p = 0;

   /* Maybe delete WINDOW if it's too small.  */
   if (nodelete_p != 1 && !NILP (w->parent))
     {
       if (!MINI_WINDOW_P (w) && !NILP (w->too_small_ok))

hence too_small_ok is never set to t when nodelete_p initially equals 2.
With your change this becomes

   /* Move the following test here since otherwise the
      preceding test doesn't make sense.  martin. */
   if (nodelete_p == 2)
     nodelete_p = 0;

   /* Maybe delete WINDOW if it's too small.  */
   if (nodelete_p != 1 && !NILP (w->parent))
     {
       if (!MINI_WINDOW_P (w) && old_size < min_size && nodelete_p != 2)

hence (the "implied") too_small_ok can be set to t when nodelete_p
initially equals 2 and your version is not semantically equivalent to
the previous one.  Please verify again.

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

* Re: [patch] proposal tiny cleanup for window code
  2007-11-07 12:57 ` martin rudalics
@ 2007-11-07 13:32   ` Dmitry Antipov
  2007-11-07 15:38     ` martin rudalics
  0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Antipov @ 2007-11-07 13:32 UTC (permalink / raw)
  To: martin rudalics; +Cc: emacs-devel

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

martin rudalics wrote:

> hence (the "implied") too_small_ok can be set to t when nodelete_p
> initially equals 2 and your version is not semantically equivalent to
> the previous one.  Please verify again.

Argh, you're right. But, it still should be enough to make too_small_ok
local instead of a member of struct window...

Dmitry


[-- Attachment #2: too_small_ok-drop-2.patch --]
[-- Type: text/x-patch, Size: 3897 bytes --]

Index: doc/lispref/ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/doc/lispref/ChangeLog,v
retrieving revision 1.15
diff -u -r1.15 ChangeLog
--- doc/lispref/ChangeLog	31 Oct 2007 04:08:29 -0000	1.15
+++ doc/lispref/ChangeLog	7 Nov 2007 13:39:04 -0000
@@ -1,3 +1,7 @@
+2007-11-07  Dmitry Antipov  <dmantipov@yandex.ru>
+
+	* internals.texi (Window Internals): Remove description of too_small_ok.
+	
 2007-10-31  Richard Stallman  <rms@gnu.org>
 
 	* strings.texi (Creating Strings): Null strings from concat not unique.
Index: doc/lispref/internals.texi
===================================================================
RCS file: /sources/emacs/emacs/doc/lispref/internals.texi,v
retrieving revision 1.2
diff -u -r1.2 internals.texi
--- doc/lispref/internals.texi	6 Sep 2007 04:27:42 -0000	1.2
+++ doc/lispref/internals.texi	7 Nov 2007 13:39:04 -0000
@@ -1280,9 +1280,6 @@
 Non-@code{nil} means current value of @code{start} was the beginning of a line
 when it was chosen.
 
-@item too_small_ok
-Non-@code{nil} means don't delete this window for becoming ``too small.''
-
 @item height_fixed_p
 This field is temporarily set to 1 to fix the height of the selected
 window when the echo area is resized.
Index: src/ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/src/ChangeLog,v
retrieving revision 1.5979
diff -u -r1.5979 ChangeLog
--- src/ChangeLog	6 Nov 2007 09:27:17 -0000	1.5979
+++ src/ChangeLog	7 Nov 2007 13:39:04 -0000
@@ -1,3 +1,8 @@
+2007-11-07  Dmitry Antipov  <dmantipov@yandex.ru>
+
+	* window.h (struct window): Remove too_small_ok.
+	* window.c (size_window): New local variable prevent_deletion_p.
+	
 2007-11-06  Jan Dj^[,Ad^[(Brv  <jan.h.d@swipnet.se>
 
 	* gtkutil.c (xg_tool_bar_menu_proxy): Handle GTK_IMAGE_ICON_NAME and
Index: src/window.c
===================================================================
RCS file: /sources/emacs/emacs/src/window.c,v
retrieving revision 1.597
diff -u -r1.597 window.c
--- src/window.c	26 Oct 2007 20:56:47 -0000	1.597
+++ src/window.c	7 Nov 2007 13:39:10 -0000
@@ -3027,7 +3027,7 @@
   struct window *w = XWINDOW (window);
   struct window *c;
   Lisp_Object child, *forward, *sideward;
-  int old_size, min_size, safe_min_size;
+  int old_size, min_size, safe_min_size, prevent_deletion_p;
 
   check_min_window_sizes ();
   size = max (0, size);
@@ -3048,8 +3048,8 @@
       safe_min_size = window_min_size_2 (w, 0);
     }
 
-  if (old_size < min_size && nodelete_p != 2)
-    w->too_small_ok = Qt;
+  /* Don't delete this window even if it becomes "too small".  */
+  prevent_deletion_p = (old_size < min_size && nodelete_p != 2);
 
   /* Move the following test here since otherwise the
      preceding test doesn't make sense.  martin. */
@@ -3059,7 +3059,7 @@
   /* Maybe delete WINDOW if it's too small.  */
   if (nodelete_p != 1 && !NILP (w->parent))
     {
-      if (!MINI_WINDOW_P (w) && !NILP (w->too_small_ok))
+      if (!MINI_WINDOW_P (w) && prevent_deletion_p)
 	min_size = width_p ? MIN_SAFE_WINDOW_WIDTH : MIN_SAFE_WINDOW_HEIGHT;
       if (min_size < safe_min_size)
 	min_size = safe_min_size;
Index: src/window.h
===================================================================
RCS file: /sources/emacs/emacs/src/window.h,v
retrieving revision 1.73
diff -u -r1.73 window.h
--- src/window.h	2 Oct 2007 21:55:26 -0000	1.73
+++ src/window.h	7 Nov 2007 13:39:10 -0000
@@ -221,9 +221,6 @@
     /* If redisplay in this window goes beyond this buffer position,
        must run the redisplay-end-trigger-hook.  */
     Lisp_Object redisplay_end_trigger;
-    /* Non-nil means don't delete this window for becoming "too small".  */
-    Lisp_Object too_small_ok;
-
     /* Original window height and top before mini-window was
        enlarged. */
     Lisp_Object orig_total_lines, orig_top_line;

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

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

* Re: [patch] proposal tiny cleanup for window code
  2007-11-07 13:32   ` Dmitry Antipov
@ 2007-11-07 15:38     ` martin rudalics
  0 siblings, 0 replies; 5+ messages in thread
From: martin rudalics @ 2007-11-07 15:38 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: emacs-devel

> Argh, you're right. But, it still should be enough to make too_small_ok
> local instead of a member of struct window...

OK.  But did you understand what the code does?  Is that test
needed at all?  IIRC it was dead until I reshuffled it a couple
of months ago.

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

* Re: [patch] proposal tiny cleanup for window code
  2007-11-07 10:58 [patch] proposal tiny cleanup for window code Dmitry Antipov
  2007-11-07 12:57 ` martin rudalics
@ 2007-11-08  4:42 ` Richard Stallman
  1 sibling, 0 replies; 5+ messages in thread
From: Richard Stallman @ 2007-11-08  4:42 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: emacs-devel

It could be that we can delete too_small_ok.  Or maybe it is a bug
that its value is not used.

I think the original aim of too_small_ok was that once a window was
allowed to get smaller than the normal minimum, it would forever
remain allowed to get smaller than the normal minimum.

It could be that the addition of `adjust-window-trailing-edge',
and the resulting simplification of functions to change the sizes
of lots of windows, made this idea unnecessary.  But it would
be best for someone to study the code and check that.

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

end of thread, other threads:[~2007-11-08  4:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-07 10:58 [patch] proposal tiny cleanup for window code Dmitry Antipov
2007-11-07 12:57 ` martin rudalics
2007-11-07 13:32   ` Dmitry Antipov
2007-11-07 15:38     ` martin rudalics
2007-11-08  4:42 ` Richard Stallman

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