emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r116690: More window code related fixes and document


From: Martin Rudalics
Subject: [Emacs-diffs] trunk r116690: More window code related fixes and documentation changes.
Date: Thu, 06 Mar 2014 13:42:28 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 116690
revision-id: address@hidden
parent: address@hidden
committer: martin rudalics <address@hidden>
branch nick: trunk
timestamp: Thu 2014-03-06 14:41:58 +0100
message:
  More window code related fixes and documentation changes.
  
  * window.c (Fother_window_for_scrolling): Check that
  Vother_window_scroll_buffer is a buffer.
  * window.el (fit-frame-to-buffer, fit-frame-to-buffer-margins):
  Fix doc-strings.
  (fit-frame-to-buffer): New argument ONLY.  Remove dependency on
  fit-frame-to-buffer variable.  Fix doc-string.
  (fit-window-to-buffer): Set ONLY argument in call of
  fit-frame-to-buffer.  Fix doc-string.
  * frames.texi (Size and Position): Rewrite entries for
  `fit-frame-to-buffer' and `fit-frame-to-buffer-margins'.  Add
  description for `fit-frame-to-buffer-sizes'.
  * windows.texi (Resizing Windows): Add descriptions for
  pixelwise resizing.  Add entries for `window-resize-pixelwise'
  and `fit-window-to-buffer-horizontally'.  Rewrite
  `fit-window-to-buffer' entry.
modified:
  doc/lispref/ChangeLog          changelog-20091113204419-o5vbwnq5f7feedwu-6155
  doc/lispref/frames.texi        
frames.texi-20091113204419-o5vbwnq5f7feedwu-6180
  doc/lispref/windows.texi       
windows.texi-20091113204419-o5vbwnq5f7feedwu-6224
  etc/NEWS                       news-20100311060928-aoit31wvzf25yr1z-1
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/window.el                 window.el-20091113204419-o5vbwnq5f7feedwu-94
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/window.c                   window.c-20091113204419-o5vbwnq5f7feedwu-231
=== modified file 'doc/lispref/ChangeLog'
--- a/doc/lispref/ChangeLog     2014-03-06 12:39:47 +0000
+++ b/doc/lispref/ChangeLog     2014-03-06 13:41:58 +0000
@@ -1,3 +1,13 @@
+2014-03-06  Martin Rudalics  <address@hidden>
+
+       * frames.texi (Size and Position): Rewrite entries for
+       `fit-frame-to-buffer' and `fit-frame-to-buffer-margins'.  Add
+       description for `fit-frame-to-buffer-sizes'.
+       * windows.texi (Resizing Windows): Add descriptions for
+       pixelwise resizing.  Add entries for `window-resize-pixelwise'
+       and `fit-window-to-buffer-horizontally'.  Rewrite
+       `fit-window-to-buffer' entry.
+
 2014-03-06  Xue Fuqiao  <address@hidden>
 
        * internals.texi (Window Internals): Remove field `region_showing'.

=== modified file 'doc/lispref/frames.texi'
--- a/doc/lispref/frames.texi   2014-03-05 13:50:48 +0000
+++ b/doc/lispref/frames.texi   2014-03-06 13:41:58 +0000
@@ -1180,19 +1180,48 @@
 
 @c FIXME?  Belongs more in Emacs manual than here?
 @c But, e.g., fit-window-to-buffer is in this manual.
address@hidden Command fit-frame-to-buffer &optional frame max-height min-height
-This command adjusts the height of @var{frame} (the default is the
-selected frame) to fit its contents.  The optional arguments
address@hidden and @var{min-height} specify the maximum and minimum
-new frame heights, respectively.
-
address@hidden fit-frame-to-buffer-bottom-margin
-The default minimum height corresponds to @code{window-min-height}.
-The default maximum height is the screen height below the current top
-position of the frame, minus any margin specified by the option
address@hidden
+If you have a frame that displays only one window, you can fit that
+frame to its buffer using the command @code{fit-frame-to-buffer}.
+
address@hidden Command fit-frame-to-buffer &optional frame max-height 
min-height max-width min-width only
+This command adjusts the size of @var{frame} to display the contents of
+its buffer exactly.  @var{frame} can be any live frame and defaults to
+the selected one.  Fitting is done only if @var{frame}'s root window is
+live.  The arguments @var{max-height}, @var{min-height}, @var{max-width}
+and @var{min-width} specify bounds on the new total size of
address@hidden's root window.  @var{min-height} and @var{min-width} default
+to the values of @code{window-min-height} and @code{window-min-width}
+respectively.
+
+If the optional argument @var{only} is @code{vertically}, this function
+may resize the frame vertically only.  If @var{only} is
address@hidden, it may resize the frame horizontally only.
 @end deffn
 
+The behavior of @code{fit-frame-to-buffer} can be controlled with the
+help of the two options listed next.
+
address@hidden fit-frame-to-buffer-margins
+This option can be used to specify margins around frames to be fit by
address@hidden  Such margins can be useful to avoid, for
+example, that such frames overlap the taskbar.
+
+It specifies the numbers of pixels to be left free on the left, above,
+the right, and below a frame that shall be fit.  The default specifies
address@hidden for each which means to use no margins.  The value specified
+here can be overridden for a specific frame by that frame's
address@hidden parameter, if present.
address@hidden defopt
+
address@hidden fit-frame-to-buffer-sizes
+This option specifies size boundaries for @code{fit-frame-to-buffer}.
+It specifies the total maximum and minimum lines and maximum and minimum
+columns of the root window of any frame that shall be fit to its buffer.
+If any of these values is address@hidden, it overrides the corresponding
+argument of @code{fit-frame-to-buffer}.
address@hidden defopt
+
+
 @node Geometry
 @subsection Geometry
 

=== modified file 'doc/lispref/windows.texi'
--- a/doc/lispref/windows.texi  2014-03-05 13:50:48 +0000
+++ b/doc/lispref/windows.texi  2014-03-06 13:41:58 +0000
@@ -691,10 +691,9 @@
 that the window cannot be resized.
 
 Normally, the variables @code{window-min-height} and
address@hidden specify the smallest allowable window size.
address@hidden Window,, Deleting and Rearranging Windows, emacs, The GNU
-Emacs Manual}.  However, if the optional argument @var{ignore} is
address@hidden, this function ignores @code{window-min-height} and
address@hidden specify the smallest allowable window size
+(@pxref{Window Sizes}).  However, if the optional argument @var{ignore}
+is address@hidden, this function ignores @code{window-min-height} and
 @code{window-min-width}, as well as @code{window-size-fixed}.  Instead,
 it considers the minimum-height window to be one consisting of a header,
 a mode line and a bottom divider (if any), plus a text area one line
@@ -755,44 +754,74 @@
 
 @cindex pixelwise, resizing windows
 @defopt window-resize-pixelwise
-If the value of this user option is address@hidden, window resizing
-operations will be pixelwise.  This currently affects the following
-functions: @code{split-window}, @code{maximize-window},
address@hidden, @code{fit-window-to-buffer} and
address@hidden, and all functions that symmetrically
-resize a parent window.
+If the value of this option is address@hidden, windows are resized in
+units of pixels.  This currently affects functions like
address@hidden (@pxref{Splitting Windows}), @code{maximize-window},
address@hidden, @code{fit-window-to-buffer},
address@hidden (all listed below) and
address@hidden (@pxref{Size and Position}).
 
 Note that when a frame's pixel size is not a multiple of the frame's
 character size, at least one window may get resized pixelwise even if
-this option is nil.  The default value of this user option is
+this option is @code{nil}.  The default value of this option is
 @code{nil}.
 @end defopt
 
   The following commands resize windows in more specific ways.  When
 called interactively, they act on the selected window.
 
address@hidden Command fit-window-to-buffer &optional window max-height 
min-height override
-This command adjusts the height of @var{window} to fit the text in it.
-It returns address@hidden if it was able to resize @var{window}, and
address@hidden otherwise.  If @var{window} is omitted or @code{nil}, it
-defaults to the selected window.  Otherwise, it should be a live
-window.
-
-The optional argument @var{max-height}, if address@hidden, specifies
-the maximum total height that this function can give @var{window}.
-The optional argument @var{min-height}, if address@hidden, specifies
-the minimum total height that it can give, which overrides the
-variable @code{window-min-height}.
-
-If the optional argument @var{override} is address@hidden, this
-function ignores any size restrictions imposed by
address@hidden and @code{window-min-width}.
-
address@hidden fit-frame-to-buffer
-If the option @code{fit-frame-to-buffer} is address@hidden, this
-command may resize the frame to fit its contents.
address@hidden Command fit-window-to-buffer &optional window max-height 
min-height max-width min-width
+This command adjusts the height or width of @var{window} to fit the text
+in it.  It returns address@hidden if it was able to resize @var{window},
+and @code{nil} otherwise.  If @var{window} is omitted or @code{nil}, it
+defaults to the selected window.  Otherwise, it should be a live window.
+
+If @var{window} is part of a vertical combination, this function adjusts
address@hidden's height.  The new height is calculated from the actual
+height of the accessible portion of its buffer.  The optional argument
address@hidden, if address@hidden, specifies the maximum total height
+that this function can give @var{window}.  The optional argument
address@hidden, if address@hidden, specifies the minimum total height
+that it can give, which overrides the variable @code{window-min-height}.
+Both @var{max-height} and @var{min-height} are specified in lines and
+include mode and header line and a bottom divider, if any.
+
+If @var{window} is part of a horizontal combination and the value of the
+option @code{fit-window-to-buffer-horizontally} (see below) is
address@hidden, this function adjusts @var{window}'s height.  The new
+width of @var{window} is calculated from the maximum length of its
+buffer's lines that follow the current start position of @var{window}.
+The optional argument @var{max-width} specifies a maximum width and
+defaults to the width of @var{window}'s frame.  The optional argument
address@hidden specifies a minimum width and defaults to
address@hidden  Both @var{max-width} and @var{min-width} are
+specified in columns and include fringes, margins and scrollbars, if
+any.
+
+If the option @code{fit-frame-to-buffer} (see below) is address@hidden,
+this function will try to resize the frame of @var{window} to fit its
+contents by calling @code{fit-frame-to-buffer} (@pxref{Size and
+Position}).
 @end deffn
 
address@hidden fit-window-to-buffer-horizontally
+If this is address@hidden, @code{fit-window-to-buffer} can resize
+windows horizontally.  If this is @code{nil} (the default)
address@hidden never resizes windows horizontally.  If this
+is @code{only}, it can resize windows horizontally only.  Any other
+value means @code{fit-window-to-buffer} can resize windows in both
+dimensions.
address@hidden defopt
+
address@hidden fit-frame-to-buffer
+If this option is address@hidden, @code{fit-window-to-buffer} can fit a
+frame to its buffer.  A frame is fit if and only if its root window is a
+live window and this option is address@hidden  If this is
address@hidden, frames are fit horizontally only.  If this is
address@hidden, frames are fit vertically only.  Any other
address@hidden value means frames can be resized in both dimensions.
address@hidden defopt
+
 @deffn Command shrink-window-if-larger-than-buffer &optional window
 This command attempts to reduce @var{window}'s height as much as
 possible while still showing its full buffer, but no less than
@@ -804,8 +833,12 @@
 This command does nothing if the window is already too short to
 display all of its buffer, or if any of the buffer is scrolled
 off-screen, or if the window is the only live window in its frame.
+
+This command calls @code{fit-window-to-buffer} (see above) to do its
+work.
 @end deffn
 
+
 @cindex balancing window sizes
 @deffn Command balance-windows &optional window-or-frame
 This function balances windows in a way that gives more space to

=== modified file 'etc/NEWS'
--- a/etc/NEWS  2014-03-06 04:11:08 +0000
+++ b/etc/NEWS  2014-03-06 13:41:58 +0000
@@ -226,6 +226,11 @@
 window sizes now have an additional argument that allows changes to apply,
 or values to be returned, in pixels instead of lines/columns.
 
++++
+*** The functions `window-body-height' and `window-body-width' now never
+count partially visible lines or columns if called with a nil PIXELWISE
+argument.
+
 *** Emacs can now draw dividers between adjacent windows.  To put
 dividers between side-by-side/vertically stacked windows customize the
 frame parameters `right-divider-width' and `bottom-divider-width' to
@@ -246,14 +251,13 @@
 `fit-frame-to-buffer' and `fit-window-to-buffer' to accurately fit a
 window to its buffer as it will be displayed.
 
-*** `fit-window-to-buffer' can now resize windows horizontally.
+*** `fit-window-to-buffer' can now resize windows in both dimensions.
 This behavior is controlled by the new option
-`fit-window-to-buffer-horizontally'.
+`fit-window-to-buffer-horizontally'.  The new option
+`fit-frame-to-buffer' allows to fit the window's frame to its buffer.
 
-*** `fit-frame-to-buffer' can now fit frames in both directions.
-This behavior is controlled by the option `fit-frame-to-buffer' which
-tells in which direction(s) the frame shall be fit.  The new options
-`fit-frame-to-buffer-margins' and `fit-frame-to-buffer-sizes' allow to
+*** `fit-frame-to-buffer' now fits frames in both dimensions.  The new
+options `fit-frame-to-buffer-margins' and `fit-frame-to-buffer-sizes'
 control the size of the frame and its position on screen.
 
 *** Temp Buffer Resize Mode can now adjust height and width of windows

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-03-06 13:23:04 +0000
+++ b/lisp/ChangeLog    2014-03-06 13:41:58 +0000
@@ -1,3 +1,12 @@
+2014-03-06  Martin Rudalics  <address@hidden>
+
+       * window.el (fit-frame-to-buffer, fit-frame-to-buffer-margins):
+       Fix doc-strings.
+       (fit-frame-to-buffer): New argument ONLY.  Remove dependency on
+       fit-frame-to-buffer variable.  Fix doc-string.
+       (fit-window-to-buffer): Set ONLY argument in call of
+       fit-frame-to-buffer.  Fix doc-string.
+
 2014-03-06  Michael Albinus  <address@hidden>
 
        * net/tramp.el (tramp-error): VEC-OR-PROC can be nil.

=== modified file 'lisp/window.el'
--- a/lisp/window.el    2014-03-05 13:50:48 +0000
+++ b/lisp/window.el    2014-03-06 13:41:58 +0000
@@ -6813,34 +6813,27 @@
 ;; `fit-frame-to-buffer' eventually wants to know the real frame sizes
 ;; counting title bar and outer borders.
 (defcustom fit-frame-to-buffer nil
-  "Non-nil means `fit-frame-to-buffer' can fit a frame to its buffer.
+  "Non-nil means `fit-window-to-buffer' can fit a frame to its buffer.
 A frame is fit if and only if its root window is a live window
 and this option is non-nil.  If this is `horizontally', frames
 are resized horizontally only.  If this is `vertically', frames
 are resized vertically only.  Any other non-nil value means
-frames can be resized in both dimensions.  See also
-`fit-frame-to-buffer-margins' and `fit-frame-to-buffer-sizes'.
-
-If this is non-nil and a window is the only window of its frame,
-`fit-window-to-buffer' will invoke `fit-frame-to-buffer' to fit
-the frame to its buffer."
+frames can be resized in both dimensions."
   :type 'boolean
   :version "24.4"
   :group 'help)
 
 (defcustom fit-frame-to-buffer-margins '(nil nil nil nil)
   "Margins around frame for `fit-frame-to-buffer'.
-This list specifies the numbers of pixels to be left free on the
-left, above, the right, and below a frame that shall be fit to
-its buffer.  The value specified here can be overridden for a
-specific frame by that frame's `fit-frame-to-buffer-margins'
-parameter, if present.
-
-This variable controls how fitting a frame to the size of its
-buffer coordinates with the size of your display.  If you don't
-specify a value here, the size of the display's workarea is used.
-
-See also `fit-frame-to-buffer-sizes'."
+This option allows to specify the numbers of pixels to be left
+free on the left, above, the right, and below a frame that shall
+be fit to its buffer.  Set these to avoid that such a frame
+obscurs other desktop objects like the taskbar.  The default is
+nil for each side which means to not add any margins.
+
+The value specified here can be overridden for a specific frame
+by that frame's `fit-frame-to-buffer-margins' parameter, if
+present.  See also `fit-frame-to-buffer-sizes'."
   :version "24.4"
   :type '(list
          (choice
@@ -6917,7 +6910,7 @@
             (<= left (- right margin)) (<= margin right))
     margin))
 
-(defun fit-frame-to-buffer (&optional frame max-height min-height max-width 
min-width)
+(defun fit-frame-to-buffer (&optional frame max-height min-height max-width 
min-width only)
   "Adjust size of FRAME to display the contents of its buffer exactly.
 FRAME can be any live frame and defaults to the selected one.
 Fit only if FRAME's root window is live.  MAX-HEIGHT, MIN-HEIGHT,
@@ -6925,9 +6918,12 @@
 FRAME's root window.  MIN-HEIGHT and MIN-WIDTH default to the values of
 `window-min-height' and `window-min-width' respectively.
 
-The option `fit-frame-to-buffer' controls whether this function
-has any effect.  New position and size of FRAME are additionally
-determined by the options `fit-frame-to-buffer-sizes' and
+If the optional argument ONLY is `vertically', resize the frame
+vertically only.  If ONLY is `horizontally', resize the frame
+horizontally only.
+
+The new position and size of FRAME can be additionally determined
+by customizing the options `fit-frame-to-buffer-sizes' and
 `fit-frame-to-buffer-margins' or the corresponding parameters of
 FRAME."
   (interactive)
@@ -6936,13 +6932,7 @@
               (fboundp 'display-monitor-attributes-list))
     (user-error "Cannot resize frame in non-graphic Emacs"))
   (setq frame (window-normalize-frame frame))
-  (when (and (window-live-p (frame-root-window frame))
-            fit-frame-to-buffer
-            (or (not window-size-fixed)
-                (and (eq window-size-fixed 'height)
-                     (not (eq fit-frame-to-buffer 'vertically)))
-                (and (eq window-size-fixed 'width)
-                     (not (eq fit-frame-to-buffer 'horizontally)))))
+  (when (window-live-p (frame-root-window frame))
     (with-selected-window (frame-root-window frame)
       (let* ((window (frame-root-window frame))
             (char-width (frame-char-width))
@@ -7069,11 +7059,11 @@
             (width (+ (car value) (window-right-divider-width)))
             (height (+ (cdr value) (window-bottom-divider-width))))
        ;; Don't change height or width when the window's size is fixed
-       ;; in either direction.
+       ;; in either direction or ONLY forbids it.
        (cond
-        ((eq window-size-fixed 'width)
+        ((or (eq window-size-fixed 'width) (eq only 'vertically))
          (setq width nil))
-        ((eq window-size-fixed 'height)
+        ((or (eq window-size-fixed 'height) (eq only 'horizontally))
          (setq height nil)))
        ;; Fit width to constraints.
        (when width
@@ -7141,13 +7131,13 @@
 WINDOW must be a live window and defaults to the selected one.
 
 If WINDOW is part of a vertical combination, adjust WINDOW's
-height.  The new height is calculated from the number of lines of
+height.  The new height is calculated from the actual height of
 the accessible portion of its buffer.  The optional argument
 MAX-HEIGHT specifies a maximum height and defaults to the height
 of WINDOW's frame.  The optional argument MIN-HEIGHT specifies a
 minimum height and defaults to `window-min-height'.  Both
-MAX-HEIGHT and MIN-HEIGHT are specified in lines and include the
-mode line and header line, if any.
+MAX-HEIGHT and MIN-HEIGHT are specified in lines and include mode
+and header line and a bottom divider, if any.
 
 If WINDOW is part of a horizontal combination and the value of
 the option `fit-window-to-buffer-horizontally' is non-nil, adjust
@@ -7157,11 +7147,11 @@
 specifies a maximum width and defaults to the width of WINDOW's
 frame.  The optional argument MIN-WIDTH specifies a minimum width
 and defaults to `window-min-width'.  Both MAX-WIDTH and MIN-WIDTH
-are specified in columns and include fringes, margins and
-scrollbars, if any.
+are specified in columns and include fringes, margins, a
+scrollbar and a vertical divider, if any.
 
 Fit pixelwise if the option `window-resize-pixelwise' is non-nil.
-If WINDOW is its frame's root window, then if the option
+If WINDOW is its frame's root window and the option
 `fit-frame-to-buffer' is non-nil, call `fit-frame-to-buffer' to
 adjust the frame's size.
 
@@ -7177,7 +7167,9 @@
        ;; Fit WINDOW's frame to buffer.
        (fit-frame-to-buffer
         (window-frame window)
-        max-height min-height max-width min-width))
+        max-height min-height max-width min-width
+        (and (memq fit-frame-to-buffer '(vertically horizontally))
+             fit-frame-to-buffer)))
     (with-selected-window window
       (let* ((pixelwise window-resize-pixelwise)
             (char-height (frame-char-height))

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-03-06 11:18:22 +0000
+++ b/src/ChangeLog     2014-03-06 13:41:58 +0000
@@ -1,3 +1,8 @@
+2014-03-06  Martin Rudalics  <address@hidden>
+
+       * window.c (Fother_window_for_scrolling): Check that
+       Vother_window_scroll_buffer is a buffer.
+
 2014-03-06  Dmitry Antipov  <address@hidden>
 
        * xterm.c (xim_initialize): Always pass a copy of resource name

=== modified file 'src/window.c'
--- a/src/window.c      2014-03-05 13:50:48 +0000
+++ b/src/window.c      2014-03-06 13:41:58 +0000
@@ -5431,6 +5431,7 @@
     window = Vminibuf_scroll_window;
   /* If buffer is specified and live, scroll that buffer.  */
   else if (!NILP (Vother_window_scroll_buffer)
+          && BUFFERP (Vother_window_scroll_buffer)
           && BUFFER_LIVE_P (XBUFFER (Vother_window_scroll_buffer)))
     {
       window = Fget_buffer_window (Vother_window_scroll_buffer, Qnil);


reply via email to

[Prev in Thread] Current Thread [Next in Thread]