From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#14754: 24.3.50; `C-h v' needs to fill wide `pp' lines (493 chars wide?!) Date: Sun, 30 Jun 2013 00:10:19 -0700 (PDT) Message-ID: <22ab55c9-7ec8-4622-8bcd-f67e5a228377@default> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1372576272 31302 80.91.229.3 (30 Jun 2013 07:11:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 30 Jun 2013 07:11:12 +0000 (UTC) To: 14754@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jun 30 09:11:12 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UtBmx-00049I-Pj for geb-bug-gnu-emacs@m.gmane.org; Sun, 30 Jun 2013 09:11:12 +0200 Original-Received: from localhost ([::1]:46360 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtBmx-0007PD-AU for geb-bug-gnu-emacs@m.gmane.org; Sun, 30 Jun 2013 03:11:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44625) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtBmr-0007Ou-FN for bug-gnu-emacs@gnu.org; Sun, 30 Jun 2013 03:11:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UtBmp-0003TV-8R for bug-gnu-emacs@gnu.org; Sun, 30 Jun 2013 03:11:05 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:54554) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtBmp-0003TO-3z for bug-gnu-emacs@gnu.org; Sun, 30 Jun 2013 03:11:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1UtBmo-0005rL-Dh for bug-gnu-emacs@gnu.org; Sun, 30 Jun 2013 03:11:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 30 Jun 2013 07:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 14754 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.137257624022489 (code B ref -1); Sun, 30 Jun 2013 07:11:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 30 Jun 2013 07:10:40 +0000 Original-Received: from localhost ([127.0.0.1]:48870 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UtBmP-0005qd-LC for submit@debbugs.gnu.org; Sun, 30 Jun 2013 03:10:39 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:42655) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UtBmJ-0005qI-UV for submit@debbugs.gnu.org; Sun, 30 Jun 2013 03:10:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UtBmD-0003KL-FF for submit@debbugs.gnu.org; Sun, 30 Jun 2013 03:10:26 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:45067) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtBmD-0003KH-CE for submit@debbugs.gnu.org; Sun, 30 Jun 2013 03:10:25 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44361) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtBmB-00071p-VW for bug-gnu-emacs@gnu.org; Sun, 30 Jun 2013 03:10:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UtBmB-0003Jj-0L for bug-gnu-emacs@gnu.org; Sun, 30 Jun 2013 03:10:23 -0400 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:48848) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtBmA-0003Jc-QN for bug-gnu-emacs@gnu.org; Sun, 30 Jun 2013 03:10:22 -0400 Original-Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r5U7ALTj002321 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 30 Jun 2013 07:10:22 GMT Original-Received: from userz7021.oracle.com (userz7021.oracle.com [156.151.31.85]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r5U7AK2v029384 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 30 Jun 2013 07:10:20 GMT Original-Received: from abhmt117.oracle.com (abhmt117.oracle.com [141.146.116.69]) by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r5U7AK6Y029351 for ; Sun, 30 Jun 2013 07:10:20 GMT X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.7 (607090) [OL 12.0.6668.5000 (x86)] X-Source-IP: ucsinet21.oracle.com [156.151.31.93] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:75738 Archived-At: The lines in the *Help* buffer should respect `fill-column' as much as possible, other things being equal. emacs -Q C-h v imagemagick-enabled-types You see the value printed on a single line that is 493 chars wide! That's ridiculous, and it does not play well with code that fits the *Help* frame or window to its buffer text etc. The problem is this part of `describe-variable': (let ((from (point)) (line-beg (line-beginning-position)) (print-rep (let ((print-quoted t)) (prin1-to-string val)))) (if (< (+ (length print-rep) (point) (- line-beg)) 68) (insert print-rep) (terpri) (pp val) (if (< (point) (+ 68 (line-beginning-position 0))) (delete-region from (1+ from)) (delete-region (1- from) from))) (let* ((sv (get variable 'standard-value)) (origval (and (consp sv) (condition-case nil (eval (car sv)) (error :help-eval-error))))) (when (and (consp sv) (not (equal origval val)) (not (equal origval :help-eval-error))) (princ "\nOriginal value was \n") (setq from (point)) (pp origval) (if (< (point) (+ from 20)) (delete-region (1- from) from))))) Better would be something like the following. It fills the pretty-printed value, and it adds a newline before it if the value to be printed is not a number, a symbol, a character, or a string with no newlines. That's a simple heuristic, but it's not too bad. (let ((from (point)) (line-beg (line-beginning-position)) (print-rep (let ((print-quoted t)) (prin1-to-string val)))) (if (< (+ (length print-rep) (point) (- line-beg)) 68) (insert print-rep) (terpri) (unless (or (numberp val) (symbolp val) (characterp val) (and (stringp val) (string-match-p "[n]" val))) (terpri)) (let ((beg (point))) (pp val) (fill-region beg (point))) (if (< (point) (+ 68 (line-beginning-position 0))) (delete-region from (1+ from)) (delete-region (1- from) from))) (let* ((sv (get variable 'standard-value)) (origval (and (consp sv) (condition-case nil (eval (car sv)) (error :help-eval-error))))) (when (and (consp sv) (not (equal origval val)) (not (equal origval :help-eval-error))) (princ "\nOriginal value was \n") (setq from (point)) (unless (or (numberp origval) (symbolp origval) (characterp origval) (and (stringp origval) (string-match-p "[n]" origval))) (terpri)) (let ((beg (point))) (pp origval) (fill-region beg (point))) (if (< (point) (+ from 20)) (delete-region (1- from) from))))) In GNU Emacs 24.3.50.1 (i686-pc-mingw32) of 2013-06-27 on ODIEONE Bzr revision: 113205 dgutov@yandex.ru-20130627095155-f1lv1c7xf99g1sss Windowing system distributor `Microsoft Corp.', version 6.1.7601 Configured using: `configure --prefix=3D/c/Devel/emacs/binary --enable-checking=3Dyes,glyphs CFLAGS=3D-O0 -g3 LDFLAGS=3D-Lc:/Devel/emacs/lib CPPFLAGS=3D-Ic:/Devel/emacs/include'