From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#32536: displayed width of man pages Date: Fri, 31 Aug 2018 02:35:45 +0300 Organization: LINKOV.NET Message-ID: <87in3r1l7y.fsf@mail.linkov.net> References: <878t4t70zb.fsf@himinbjorg.adminart.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1535672303 27174 195.159.176.226 (30 Aug 2018 23:38:23 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 30 Aug 2018 23:38:23 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: 32536@debbugs.gnu.org To: hw Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Aug 31 01:38:19 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fvWW2-0006xb-Cv for geb-bug-gnu-emacs@m.gmane.org; Fri, 31 Aug 2018 01:38:18 +0200 Original-Received: from localhost ([::1]:51233 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvWY8-00065Z-MA for geb-bug-gnu-emacs@m.gmane.org; Thu, 30 Aug 2018 19:40:28 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54987) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvWY0-00065P-Rs for bug-gnu-emacs@gnu.org; Thu, 30 Aug 2018 19:40:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fvWXx-0004a1-LV for bug-gnu-emacs@gnu.org; Thu, 30 Aug 2018 19:40:20 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:34553) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fvWXv-0004Ya-9a for bug-gnu-emacs@gnu.org; Thu, 30 Aug 2018 19:40:15 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fvWXi-0008KN-0S for bug-gnu-emacs@gnu.org; Thu, 30 Aug 2018 19:40:07 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 30 Aug 2018 23:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32536 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 32536-submit@debbugs.gnu.org id=B32536.153567237831977 (code B ref 32536); Thu, 30 Aug 2018 23:40:01 +0000 Original-Received: (at 32536) by debbugs.gnu.org; 30 Aug 2018 23:39:38 +0000 Original-Received: from localhost ([127.0.0.1]:39571 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fvWXK-0008Jh-G1 for submit@debbugs.gnu.org; Thu, 30 Aug 2018 19:39:38 -0400 Original-Received: from pop.dreamhost.com ([64.90.62.162]:53636 helo=pdx1-sub0-mail-a24.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fvWXC-0008JI-Mb for 32536@debbugs.gnu.org; Thu, 30 Aug 2018 19:39:32 -0400 Original-Received: from pdx1-sub0-mail-a24.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a24.g.dreamhost.com (Postfix) with ESMTP id E2FFF7F314; Thu, 30 Aug 2018 16:39:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=x2CSFUpBCGbBDaVErGkJ7WMMpSM=; b= NmDCM3kcNyVFTV93QfTvb6uJfcyVWDsojGWXaHGZBlBXdN3xF760rLuk8ml4dRnV rg6bgAm2pINjbenaBsckCsv72sZehxVkkjycOqNtDQbD6Cw2A/oDQi8KLo8R89Wk E8txfNzvawdZ9Qk9qgdNqc2d6LcvqNDzxp/aMZ+7VJk= Original-Received: from localhost.linkov.net (m91-129-99-146.cust.tele2.ee [91.129.99.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a24.g.dreamhost.com (Postfix) with ESMTPSA id 457DF7F312; Thu, 30 Aug 2018 16:39:27 -0700 (PDT) In-Reply-To: <878t4t70zb.fsf@himinbjorg.adminart.net> (hw@adminart.net's message of "Sun, 26 Aug 2018 14:42:48 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:149901 Archived-At: --=-=-= Content-Type: text/plain > 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: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=man-maximum-width.1.patch 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). --=-=-=--