helpful

a fork of Wilfred's helpful
git clone https://git.trogloxene.org/helpful.git
Log | Files | Refs | README

commit b696b9fa6ed3f3df8cc3918347bd3eaa05a645f5
parent 584ecc887bb92133119f93a6716cdf7af0b51dca
Author: Ian Wahbe <ian@wahbe.com>
Date:   Fri, 12 Feb 2021 11:42:18 -0800

Fix helpful--pretty-print on circular structures

Diffstat:
MCHANGELOG.md | 2++
Mhelpful.el | 10+++++++---
2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md @@ -3,6 +3,8 @@ Fixed a hang when looking at functions that had advice but hadn't yet been loaded by the autoloader (#179, #191). +Fixed issue with displaying circular data structures. + # v0.18 Show the original value for custom variables whose value has changed. diff --git a/helpful.el b/helpful.el @@ -181,11 +181,15 @@ can make Helpful very slow.") (defun helpful--pretty-print (value) "Pretty-print VALUE. -If VALUE is self-referential, or just very big, the user may -press \\[keyboard-quit] to gracefully stop the printing." +If VALUE is very big, the user may press \\[keyboard-quit] to +gracefully stop the printing. If VALUE is self-referential, the +error will be caught and displayed." ;; Inspired by `ielm-eval-input'. - (condition-case nil + (condition-case err (s-trim-right (pp-to-string value)) + (error + (propertize (format "(Display error: %s)" (cadr err)) + 'face 'font-lock-comment-face)) (quit (propertize "(User quit during pretty-printing.)" 'face 'font-lock-comment-face))))