GNU bug report logs -
#32536
displayed width of man pages
Previous Next
Reported by: hw <hw <at> adminart.net>
Date: Sun, 26 Aug 2018 16:43:02 UTC
Severity: wishlist
Tags: fixed
Merged with 9385
Found in versions 23.3, 24.3
Fixed in version 27.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> From: Juri Linkov <juri <at> linkov.net>
> Date: Thu, 27 Dec 2018 01:36:05 +0200
>
> Thanks Martin this is easy now to implement using new hooks.
Thanks for working on this.
> +(defcustom Man-width-min 40
> + "Minimum number of columns allowed for the width of manual pages.
> +It defines the minimum width for the case when `Man-width' is customized
> +to a dynamically calculated value depending on the frame/window width.
> +If the width calculated for `Man-width' is smaller than the minimum width,
> +it will be automatically enlarged to the width defined by this variable.
> +If the calculated width is smaller than the minimum width, the value
> +of this variable has no effect.
> +When nil, there is no limit on minimum width."
> + :type '(choice (const :tag "No limit" nil)
> + (integer :tag "Min width" :value 40))
> + :version "27.1"
> + :group 'man)
> +
> +(defcustom Man-width-max 80
> + "Maximum number of columns allowed for the width of manual pages.
> +It defines the maximum width for the case when `Man-width' is customized
> +to a dynamically calculated value depending on the frame/window width.
> +If the width calculated for `Man-width' is larger than the maximum width,
> +it will be automatically reduced to the width defined by this variable.
> +If the calculated width is smaller than the maximum width, the value
> +of this variable has no effect.
> +When nil, there is no limit on maximum width."
I suspect some typo(s) in these doc strings, perhaps due to
copy/pasta, because the penultimate sentence of each of them makes no
sense to me, certainly when taken together with the other doc string.
If I'm wrong, and there's no error here, please explain what you
meant.
> +(defun Man-columns ()
> + (let ((width (cond
> + ((and (integerp Man-width) (> Man-width 0))
> + Man-width)
> + (Man-width
> + (let ((window (get-buffer-window nil t)))
> + (frame-width (and window (window-frame window)))))
> + (t
> + (window-width (get-buffer-window nil t))))))
> + (when (and (integerp Man-width-max)
> + (> Man-width-max 0))
> + (setq width (min width Man-width-max)))
> + (when (and (integerp Man-width-min)
> + (> Man-width-min 0))
> + (setq width (max width Man-width-min)))
> + width))
Careful here: both window-width (why not use its official name, btw?)
and frame-width are insensitive to the size of the font used to
display the man page: they both measure in "canonical" column units.
Maybe this is not a significant problem (and I realize the old code
also worked like that), but perhaps the doc strings of the two new
options should mention this fact, lest the user will be surprised.
> + (setenv "COLUMNS" (number-to-string Man-columns)))
Here, for example, the 'man' program will interpret COLUMNS at face
value, and will produce lines of that many characters; but if the size
of thefont used to display the man page is significantly different
from the frame's default font, those lines might be wider or narrower
than the window/frame.
Finally, I think this warrants a NEWS entry and perhaps also an update
for the manual.
This bug report was last modified 5 years and 248 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.