all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Problem in temp-buffer-resize-mode
@ 2007-08-02  4:58 Eli Barzilay
  2007-08-02 10:19 ` martin rudalics
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Barzilay @ 2007-08-02  4:58 UTC (permalink / raw)
  To: bug-gnu-emacs

Try this (using version 22.1.1 on Fedora):

  (set-fringe-mode 1)
  (temp-buffer-resize-mode 1)

and you'll see that temp buffers are not resized.  The problem is that
the small fringe makes (window-width) bigger than (frame-width), which
makes the test in `resize-temp-buffer-window' fail.

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!

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

* Re: Problem in temp-buffer-resize-mode
  2007-08-02  4:58 Problem in temp-buffer-resize-mode Eli Barzilay
@ 2007-08-02 10:19 ` martin rudalics
  2007-08-02 23:42   ` Richard Stallman
  0 siblings, 1 reply; 4+ messages in thread
From: martin rudalics @ 2007-08-02 10:19 UTC (permalink / raw)
  To: Eli Barzilay; +Cc: bug-gnu-emacs

 > Try this (using version 22.1.1 on Fedora):
 >
 >   (set-fringe-mode 1)
 >   (temp-buffer-resize-mode 1)
 >
 > and you'll see that temp buffers are not resized.  The problem is that
 > the small fringe makes (window-width) bigger than (frame-width), which
 > makes the test in `resize-temp-buffer-window' fail.

Thanks for reporting this bug.  In fact a test like

   (=  (frame-width) (window-width))

is used quite frequently in Elisp code and may fail in all these cases
just as it did for you.  FWIW these tests should be replaced by calling
a function `window-full-width-p' (the function `display-buffer' uses to
check whether it should split the largest window).

In any case something is inherently wrong with `frame-width' and
`window-width' if the latter may return a larger value than the former.

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

* Re: Problem in temp-buffer-resize-mode
  2007-08-02 10:19 ` martin rudalics
@ 2007-08-02 23:42   ` Richard Stallman
  2007-08-04  8:45     ` martin rudalics
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Stallman @ 2007-08-02 23:42 UTC (permalink / raw)
  To: martin rudalics; +Cc: eli, emacs-devel

    Thanks for reporting this bug.  In fact a test like

       (=  (frame-width) (window-width))

    is used quite frequently in Elisp code and may fail in all these cases
    just as it did for you.  FWIW these tests should be replaced by calling
    a function `window-full-width-p' (the function `display-buffer' uses to
    check whether it should split the largest window).

Would you like to make these fixes, then ack?  They should be fixed in
Emacs 22, and will then get transferred to the trunk.

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

* Re: Problem in temp-buffer-resize-mode
  2007-08-02 23:42   ` Richard Stallman
@ 2007-08-04  8:45     ` martin rudalics
  0 siblings, 0 replies; 4+ messages in thread
From: martin rudalics @ 2007-08-04  8:45 UTC (permalink / raw)
  To: rms; +Cc: eli, emacs-devel

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

 >     In fact a test like
 >
 >        (=  (frame-width) (window-width))
 >
 >     is used quite frequently in Elisp code and may fail in all these cases
 >     just as it did for you.  FWIW these tests should be replaced by calling
 >     a function `window-full-width-p' (the function `display-buffer' uses to
 >     check whether it should split the largest window).
 >
 > Would you like to make these fixes, then ack?  They should be fixed in
 > Emacs 22, and will then get transferred to the trunk.

`window-full-width-p' is not available in Elisp yet, hence please
confirm whether we want to do this.  I attached the corresponding patch
for window.c, the patches for window.h and help.el are equally trivial.

This probably needs a Lisp Changes entry in NEWS like

*** New function `window-full-width-p'
returns t iff window is as wide as its frame.

and maybe an entry in the Elisp manual.

If you think we should do this, I'd install it simultaneously in Emacs
22 and the trunk.  This way I could merge in the fix to avoid windows
without modelines which at the moment is in the trunk only.

[-- Attachment #2: window.c.patch --]
[-- Type: text/plain, Size: 1035 bytes --]

*** window.c	Thu Jul 26 07:28:00 2007
--- window.c	Sat Aug  4 10:32:54 2007
***************
*** 557,562 ****
--- 557,571 ----
    return make_number (window_box_text_cols (decode_any_window (window)));
  }
  
+ DEFUN ("window-full-width-p", Fwindow_full_width_p, Swindow_full_width_p, 0, 1, 0,
+        doc: /* Return t if WINDOW is as wide as its frame.
+ WINDOW defaults to the selected window.  */)
+      (window)
+      Lisp_Object window;
+ {
+   return WINDOW_FULL_WIDTH_P (decode_any_window (window)) ? Qt : Qnil;
+ }
+ 
  DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0,
         doc: /* Return the number of columns by which WINDOW is scrolled from left margin.
  WINDOW defaults to the selected window.  */)
***************
*** 7515,7520 ****
--- 7524,7530 ----
    defsubr (&Swindow_buffer);
    defsubr (&Swindow_height);
    defsubr (&Swindow_width);
+   defsubr (&Swindow_full_width_p);
    defsubr (&Swindow_hscroll);
    defsubr (&Sset_window_hscroll);
    defsubr (&Swindow_redisplay_end_trigger);

[-- 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] 4+ messages in thread

end of thread, other threads:[~2007-08-04  8:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-02  4:58 Problem in temp-buffer-resize-mode Eli Barzilay
2007-08-02 10:19 ` martin rudalics
2007-08-02 23:42   ` Richard Stallman
2007-08-04  8:45     ` martin rudalics

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.