From: Drew Adams <drew.adams@oracle.com>
To: 14754@debbugs.gnu.org
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) [thread overview]
Message-ID: <22ab55c9-7ec8-4622-8bcd-f67e5a228377@default> (raw)
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=/c/Devel/emacs/binary --enable-checking=yes,glyphs
CFLAGS=-O0 -g3 LDFLAGS=-Lc:/Devel/emacs/lib
CPPFLAGS=-Ic:/Devel/emacs/include'
next reply other threads:[~2013-06-30 7:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-30 7:10 Drew Adams [this message]
2013-07-01 17:07 ` bug#14754: 24.3.50; `C-h v' needs to fill wide `pp' lines (493 chars wide?!) Drew Adams
2014-02-08 6:38 ` Lars Ingebrigtsen
2014-02-10 3:56 ` Drew Adams
-- strict thread matches above, loose matches on Subject: below --
2022-06-09 16:36 Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=22ab55c9-7ec8-4622-8bcd-f67e5a228377@default \
--to=drew.adams@oracle.com \
--cc=14754@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).