helpful

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

commit afb2ccc0d71f233918b1ccd027af5023637654f4
parent c70db01c19dfc88a7781eb841bcace148617814f
Author: Wilfred Hughes <me@wilfred.me.uk>
Date:   Sun, 14 Feb 2021 19:26:57 -0800

Merge pull request #257 from iwahbe/fix-circular-structure-pprint

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))))