Subject: bug#32536: displayed width of man pages

From: hw <[email-masked]>
Date: Tue, 04 Sep 2018 07:46:09 +0200

Juri Linkov <[email-masked]> writes:

>>> Regarding the request for dynamic reformatting, I'm not sure if
>>> man pages should be reformatted on resizing windows (I remember
>>> seeing a window resize hook, but can't find it now).
>>
>> It's called 'window-size-change-functions'.
>
> Thanks, I tried window-size-change-functions, and it works pretty well
> with the patch attached.  But there are a few problems:
>
> 1. In Man-mode we have to add hook window-size-change-functions only
> [...]
>
> 2. What if the same Man-mode buffer is displayed in two adjacent windows
>    side-by-side?  I guess we need to find all windows with the same buffer,
>    compare their widths, and call Man-update-manpage only in the window
>    with minimal width.  Also it seems window-size-change-functions is
>    not called twice for every window with Man-mode buffer, this is good.

How about a couple rules to make this simple:

A manual page should not be updated when

+ the size, or a change of the size, of a window displaying it does not
  require a change of the length of the lines

+ the desired length of the lines can not be determined.

Creating another window to display the same or a different buffer does
not require a change of the length of the lines.

Using multiple windows of different widths to display the same buffer
means that the desired length of the lines can not be determined.

When considering the width of each window displaying the same buffer, or
any buffer, leads to the same length of the lines, a length has been
determined.  This may be the desired length of the lines for Man-mode
buffers or not.

Above rules mean that you can ignore 1..

Just note this in the documentation so it becomes understandable why the
buffers in Man-mode are dynamically updated the way they are.  When
someone has a good idea how to figure out the desired length of lines
under all circumstances, they can always make a suggestion.

BTW, what is the default for the minimum length of the lines?  Is the
default for the maximum length the same?