GNU bug report logs - #32536
displayed width of man pages

Previous Next

Package: emacs;

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


Message #12 received at 32536 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: hw <hw <at> adminart.net>
Cc: 32536 <at> debbugs.gnu.org
Subject: Re: bug#32536: displayed width of man pages
Date: Fri, 31 Aug 2018 02:35:45 +0300
[Message part 1 (text/plain, inline)]
> As a feature request:
>
> How about changing the effect of Man-width, or an additional setting:
> Emacs could usefully format manual pages to fit the window when the
> window is narrower than the default width of manual pages (unless the
> window is ridiculously narrow, in which case it could fall back to the
> default width for manual pages) and format them no wider than the
> default width of manual pages for windows that are wider.

Thanks for the feature request.

As proposed in https://debbugs.gnu.org/cgi/bugreport.cgi?bug=9385
this patch implements a new option "Maximum width" as a hard limit
that prevents the width to grow over this value:

[man-maximum-width.1.patch (text/x-diff, inline)]
diff --git a/lisp/man.el b/lisp/man.el
index 1a6eda13b7..fcf9085d20 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -179,6 +179,7 @@ Man-width
 The value also can be a positive integer for a fixed width."
   :type '(choice (const :tag "Window width" nil)
                  (const :tag "Frame width" t)
+                 (cons :tag "Maximum width" (const :value max) (integer :value 80))
                  (integer :tag "Fixed width" :value 65))
   :group 'man)
 
@@ -1045,16 +1046,20 @@ Man-start-calling
 			 (cond
 			  ((and (integerp Man-width) (> Man-width 0))
 			   Man-width)
-			  (Man-width
+			  ((eq Man-width t)
 			   (if (window-live-p (get-buffer-window (current-buffer) t))
 			       (with-selected-window (get-buffer-window (current-buffer) t)
 				 (frame-width))
 			     (frame-width)))
 			  (t
-			   (if (window-live-p (get-buffer-window (current-buffer) t))
-			       (with-selected-window (get-buffer-window (current-buffer) t)
-				 (window-width))
-			     (window-width)))))))
+			   (let ((width
+				  (if (window-live-p (get-buffer-window (current-buffer) t))
+				      (with-selected-window (get-buffer-window (current-buffer) t)
+					(window-width))
+				    (window-width))))
+			     (if (eq (car-safe Man-width) 'max)
+				 (min width (cdr Man-width))
+			       width)))))))
     ;; Since man-db 2.4.3-1, man writes plain text with no escape
     ;; sequences when stdout is not a tty.	In 2.5.0, the following
     ;; env-var was added to allow control of this (see Debian Bug#340673).

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.