bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#32536: displayed width of man pages


From: Juri Linkov
Subject: bug#32536: displayed width of man pages
Date: Thu, 27 Dec 2018 22:54:44 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)

>> +(defcustom Man-width-min 40
>> [...]
>> +If the calculated width is smaller than the minimum width, the value
>> +of this variable has no effect.
>> [...]
>> +(defcustom Man-width-max 80
>> [...]
>> +If the calculated width is smaller than the maximum width, the value
>> +of this variable has no effect.
>
> 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.

Yes, one of them is wrong.  The doc string of Man-width-min should be
changed to:

  If the calculated width is larger than the minimum width, the value
  of this variable has no effect.

>> +(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?)

Sorry, I don't understand what is the official name?

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

It seems this calculation works only for monospace fonts.

> Finally, I think this warrants a NEWS entry and perhaps also an update
> for the manual.

Will do after the final patch.





reply via email to

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