unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#16738: Errors while resizing vertically
@ 2014-02-13 10:06 E Sabof
  2014-02-14 11:39 ` martin rudalics
  2014-02-21 13:07 ` martin rudalics
  0 siblings, 2 replies; 13+ messages in thread
From: E Sabof @ 2014-02-13 10:06 UTC (permalink / raw)
  To: 16738

Another one without a clear recipe. I am using the following function on a fairly regular basis:

(defun es-maximize-window-vertically (&optional window)
    (interactive)
    (cl-callf window-normalize-window window)
    (unless (eq window (frame-root-window))
      (window-resize window (window-max-delta window))))

In combination with:

(setq window-min-height 1)

Sometimes it causes errors such as the ones below. In this state a) I can't resize any windows, using the above function. b) I can still resize using the mouse. c) Once I do, I usually can resize once with this function, but then I get a similar error again.

Evgeni

BACKTRACE1:

Debugger entered--Lisp error: (error "Cannot resize window #<window 128 on *Ack-and-a-half*>")
  signal(error ("Cannot resize window #<window 128 on *Ack-and-a-half*>"))
  error("Cannot resize window %s" #<window 128 on *Backtrace*>)
  window-resize(#<window 128 on *Backtrace*> 28)
  (if (eq window (frame-root-window)) nil (window-resize window (window-max-delta window)))
  es-maximize-window-vertically()
  call-interactively(es-maximize-window-vertically nil nil)
  command-execute(es-maximize-window-vertically)

BACKTRACE2

Debugger entered--Lisp error: (args-out-of-range -17 0 2147483647)
  set-window-new-pixel(#<window 299 on *mu4e-headers*> -17 t)
  window--resize-child-windows(#<window 301> -595 nil #<window 303 on *Backtrace*> nil nil nil nil)
  window--resize-siblings(#<window 303 on *Backtrace*> 595 nil nil)
  window-resize(#<window 303 on *Backtrace*> 35)
  (if (eq window (frame-root-window)) nil (window-resize window (window-max-delta window)))
  es-maximize-window-vertically()
  call-interactively(es-maximize-window-vertically nil nil)
  command-execute(es-maximize-window-vertically)





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

* bug#16738: Errors while resizing vertically
  2014-02-13 10:06 bug#16738: Errors while resizing vertically E Sabof
@ 2014-02-14 11:39 ` martin rudalics
  2014-02-15  2:08   ` E Sabof
  2014-02-21 13:07   ` martin rudalics
  2014-02-21 13:07 ` martin rudalics
  1 sibling, 2 replies; 13+ messages in thread
From: martin rudalics @ 2014-02-14 11:39 UTC (permalink / raw)
  To: E Sabof; +Cc: Paul Eggert, 16738

 > Debugger entered--Lisp error: (error "Cannot resize window #<window 128 on *Ack-and-a-half*>")
 >   signal(error ("Cannot resize window #<window 128 on *Ack-and-a-half*>"))
 >   error("Cannot resize window %s" #<window 128 on *Backtrace*>)
 >   window-resize(#<window 128 on *Backtrace*> 28)
 >   (if (eq window (frame-root-window)) nil (window-resize window (window-max-delta window)))
 >   es-maximize-window-vertically()
 >   call-interactively(es-maximize-window-vertically nil nil)
 >   command-execute(es-maximize-window-vertically)

I can easily reproduce such an error here.  Do you have a boxed mode- or
header-line, or anything that makes these lines higher or lower than an
average normal line?

I'll check in a fix for this soon, but I still see a related bug whose
cause I wasn't able to identify yet.

 > BACKTRACE2
 >
 > Debugger entered--Lisp error: (args-out-of-range -17 0 2147483647)
 >   set-window-new-pixel(#<window 299 on *mu4e-headers*> -17 t)
 >   window--resize-child-windows(#<window 301> -595 nil #<window 303 on *Backtrace*> nil nil nil nil)
 >   window--resize-siblings(#<window 303 on *Backtrace*> 595 nil nil)
 >   window-resize(#<window 303 on *Backtrace*> 35)
 >   (if (eq window (frame-root-window)) nil (window-resize window (window-max-delta window)))
 >   es-maximize-window-vertically()
 >   call-interactively(es-maximize-window-vertically nil nil)
 >   command-execute(es-maximize-window-vertically)

This sounds strange.  Paul, how can such a thing happen?

martin





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

* bug#16738: Errors while resizing vertically
  2014-02-14 11:39 ` martin rudalics
@ 2014-02-15  2:08   ` E Sabof
  2014-02-16 10:32     ` martin rudalics
  2014-02-21 13:07   ` martin rudalics
  1 sibling, 1 reply; 13+ messages in thread
From: E Sabof @ 2014-02-15  2:08 UTC (permalink / raw)
  To: martin rudalics; +Cc: Paul Eggert, 16738


> I can easily reproduce such an error here.  Do you have a boxed mode- or
> header-line, or anything that makes these lines higher or lower than an
> average normal line?

My header-line has an overline + underline, which apparently make the face 2 pixels higher. I might also have been using non-standard size font-lock faces.

Evgeni





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

* bug#16738: Errors while resizing vertically
  2014-02-15  2:08   ` E Sabof
@ 2014-02-16 10:32     ` martin rudalics
  0 siblings, 0 replies; 13+ messages in thread
From: martin rudalics @ 2014-02-16 10:32 UTC (permalink / raw)
  To: E Sabof; +Cc: Paul Eggert, 16738

> My header-line has an overline + underline, which apparently make the face 2 pixels higher. I might also have been using non-standard size font-lock faces.

This explains it.  You shouldn't see the bug with "normal" header-
and mode-lines.

martin






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

* bug#16738: Errors while resizing vertically
  2014-02-13 10:06 bug#16738: Errors while resizing vertically E Sabof
  2014-02-14 11:39 ` martin rudalics
@ 2014-02-21 13:07 ` martin rudalics
  2014-09-19  8:18   ` martin rudalics
  1 sibling, 1 reply; 13+ messages in thread
From: martin rudalics @ 2014-02-21 13:07 UTC (permalink / raw)
  To: E Sabof; +Cc: 16738

> Another one without a clear recipe. I am using the following function on a fairly regular basis:
> 
> (defun es-maximize-window-vertically (&optional window)
>     (interactive)
>     (cl-callf window-normalize-window window)
>     (unless (eq window (frame-root-window))
>       (window-resize window (window-max-delta window))))
> 
> In combination with:
> 
> (setq window-min-height 1)
> 
> Sometimes it causes errors such as the ones below. In this state a) I can't resize any windows, using the above function. b) I can still resize using the mouse. c) Once I do, I usually can resize once with this function, but then I get a similar error again.
> 
> Evgeni
> 
> BACKTRACE1:
> 
> Debugger entered--Lisp error: (error "Cannot resize window #<window 128 on *Ack-and-a-half*>")
>   signal(error ("Cannot resize window #<window 128 on *Ack-and-a-half*>"))
>   error("Cannot resize window %s" #<window 128 on *Backtrace*>)
>   window-resize(#<window 128 on *Backtrace*> 28)
>   (if (eq window (frame-root-window)) nil (window-resize window (window-max-delta window)))
>   es-maximize-window-vertically()
>   call-interactively(es-maximize-window-vertically nil nil)
>   command-execute(es-maximize-window-vertically)

Hopefully fixed with revision 116504 on trunk.  Please try again.

martin






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

* bug#16738: Errors while resizing vertically
  2014-02-14 11:39 ` martin rudalics
  2014-02-15  2:08   ` E Sabof
@ 2014-02-21 13:07   ` martin rudalics
  2014-02-21 20:29     ` Paul Eggert
  1 sibling, 1 reply; 13+ messages in thread
From: martin rudalics @ 2014-02-21 13:07 UTC (permalink / raw)
  To: Paul Eggert; +Cc: E Sabof, 16738

 >  > Debugger entered--Lisp error: (args-out-of-range -17 0 2147483647)
 >  >   set-window-new-pixel(#<window 299 on *mu4e-headers*> -17 t)
 >  >   window--resize-child-windows(#<window 301> -595 nil #<window 303 on
 > *Backtrace*> nil nil nil nil)
 >  >   window--resize-siblings(#<window 303 on *Backtrace*> 595 nil nil)
 >  >   window-resize(#<window 303 on *Backtrace*> 35)
 >  >   (if (eq window (frame-root-window)) nil (window-resize window
 > (window-max-delta window)))
 >  >   es-maximize-window-vertically()
 >  >   call-interactively(es-maximize-window-vertically nil nil)
 >  >   command-execute(es-maximize-window-vertically)
 >
 > This sounds strange.  Paul, how can such a thing happen?

Paul Eggert - this was your change:

	Minor integer overflow fixes (Bug#16033).
	* window.c (Fset_window_new_pixel): Don't let new_pixel go negative.
	This improves on the previous fix to this function.

martin





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

* bug#16738: Errors while resizing vertically
  2014-02-21 13:07   ` martin rudalics
@ 2014-02-21 20:29     ` Paul Eggert
  2014-02-21 21:29       ` martin rudalics
  0 siblings, 1 reply; 13+ messages in thread
From: Paul Eggert @ 2014-02-21 20:29 UTC (permalink / raw)
  To: martin rudalics; +Cc: E Sabof, 16738

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

My change adjusted set-window-new-pixel so that it rejects attempts to 
set the new pixel size to a negative value. Here, new-pixel is currently 
0, so (set-window-new-pixel window-17 t) is attempting to change 
new-pixel to be -17.

Are negative new-pixel values allowed?  If so, the attached patch should 
fix the problem.  If not, the problem's probably in the caller.



[-- Attachment #2: newpixel.diff --]
[-- Type: text/x-patch, Size: 674 bytes --]

=== modified file 'src/window.c'
--- src/window.c	2014-02-21 08:02:05 +0000
+++ src/window.c	2014-02-21 20:25:41 +0000
@@ -3702,8 +3702,9 @@
   (Lisp_Object window, Lisp_Object size, Lisp_Object add)
 {
   struct window *w = decode_valid_window (window);
-  EMACS_INT size_min = NILP (add) ? 0 : - XINT (w->new_pixel);
-  EMACS_INT size_max = size_min + min (INT_MAX, MOST_POSITIVE_FIXNUM);
+  EMACS_INT new_pixel = NILP (add) ? 0 : XINT (w->new_pixel);
+  EMACS_INT size_min = max (INT_MIN, MOST_NEGATIVE_FIXNUM) - new_pixel;
+  EMACS_INT size_max = min (INT_MAX, MOST_POSITIVE_FIXNUM) - new_pixel;
 
   CHECK_RANGED_INTEGER (size, size_min, size_max);
   if (NILP (add))


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

* bug#16738: Errors while resizing vertically
  2014-02-21 20:29     ` Paul Eggert
@ 2014-02-21 21:29       ` martin rudalics
  2014-02-24  0:03         ` E Sabof
  0 siblings, 1 reply; 13+ messages in thread
From: martin rudalics @ 2014-02-21 21:29 UTC (permalink / raw)
  To: Paul Eggert; +Cc: E Sabof, 16738

 > My change adjusted set-window-new-pixel so that it rejects attempts to
 > set the new pixel size to a negative value. Here, new-pixel is currently
 > 0, so (set-window-new-pixel window-17 t) is attempting to change
 > new-pixel to be -17.

Indeed.  Storing a negative pixel value is an error.

 > Are negative new-pixel values allowed?  If so, the attached patch should
 > fix the problem.  If not, the problem's probably in the caller.

There was a bug in the caller - hopefully fixed now.  No further action
needed from your side.

Thanks, martin





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

* bug#16738: Errors while resizing vertically
  2014-02-21 21:29       ` martin rudalics
@ 2014-02-24  0:03         ` E Sabof
  2014-02-24  7:40           ` martin rudalics
  0 siblings, 1 reply; 13+ messages in thread
From: E Sabof @ 2014-02-24  0:03 UTC (permalink / raw)
  To: martin rudalics; +Cc: Paul Eggert, 16738

I've tried the new code. With the following:

(setq window-min-height 1)
(set-face-attribute 'mode-line nil :overline "black")

,I'm unable to make windows any shorter than 2.

Evgeni





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

* bug#16738: Errors while resizing vertically
  2014-02-24  0:03         ` E Sabof
@ 2014-02-24  7:40           ` martin rudalics
  2014-02-24 13:06             ` E Sabof
  0 siblings, 1 reply; 13+ messages in thread
From: martin rudalics @ 2014-02-24  7:40 UTC (permalink / raw)
  To: E Sabof; +Cc: 16738

 > I've tried the new code. With the following:
 >
 > (setq window-min-height 1)
 > (set-face-attribute 'mode-line nil :overline "black")
 >
 > ,I'm unable to make windows any shorter than 2.

2 canonical lines.  But this is to be expected?  Otherwise, Emacs would
truncate the text line by the extra pixels needed for the mode line.

Whenever using a non-standard sized mode- or header-line _and_ a small
window-min-height/-width I recommend setting `window-resize-pixelwise'
to t.

martin





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

* bug#16738: Errors while resizing vertically
  2014-02-24  7:40           ` martin rudalics
@ 2014-02-24 13:06             ` E Sabof
  2014-02-26 10:15               ` martin rudalics
  0 siblings, 1 reply; 13+ messages in thread
From: E Sabof @ 2014-02-24 13:06 UTC (permalink / raw)
  To: martin rudalics; +Cc: 16738


martin rudalics <rudalics@gmx.at> writes:

> 2 canonical lines.  But this is to be expected?  Otherwise, Emacs would
> truncate the text line by the extra pixels needed for the mode line.

The finer details of pixel and character coexistence on graphical frames tend escape me. If I encounter any more errors, I will report them.

Evgeni





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

* bug#16738: Errors while resizing vertically
  2014-02-24 13:06             ` E Sabof
@ 2014-02-26 10:15               ` martin rudalics
  0 siblings, 0 replies; 13+ messages in thread
From: martin rudalics @ 2014-02-26 10:15 UTC (permalink / raw)
  To: E Sabof; +Cc: 16738

 >> 2 canonical lines.  But this is to be expected?  Otherwise, Emacs would
 >> truncate the text line by the extra pixels needed for the mode line.
 >
 > The finer details of pixel and character coexistence on graphical frames tend escape me. If I encounter any more errors, I will report them.

Suppose you have a canonical character height of 8 pixels and a header
and a mode line with 2 additional pixels each.  If you now set
`window-min-height' to 1, Emacs will display a text line of 4 pixels
height if we do not round appropriately.  That wouldn't look good.

martin





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

* bug#16738: Errors while resizing vertically
  2014-02-21 13:07 ` martin rudalics
@ 2014-09-19  8:18   ` martin rudalics
  0 siblings, 0 replies; 13+ messages in thread
From: martin rudalics @ 2014-09-19  8:18 UTC (permalink / raw)
  To: E Sabof; +Cc: 16738-done

> Hopefully fixed with revision 116504 on trunk.  Please try again.

Closing.

martin







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

end of thread, other threads:[~2014-09-19  8:18 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-13 10:06 bug#16738: Errors while resizing vertically E Sabof
2014-02-14 11:39 ` martin rudalics
2014-02-15  2:08   ` E Sabof
2014-02-16 10:32     ` martin rudalics
2014-02-21 13:07   ` martin rudalics
2014-02-21 20:29     ` Paul Eggert
2014-02-21 21:29       ` martin rudalics
2014-02-24  0:03         ` E Sabof
2014-02-24  7:40           ` martin rudalics
2014-02-24 13:06             ` E Sabof
2014-02-26 10:15               ` martin rudalics
2014-02-21 13:07 ` martin rudalics
2014-09-19  8:18   ` martin rudalics

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