From: Lars Ingebrigtsen Date: Sun, 15 Apr 2018 17:01:32 +0000 (+0200) Subject: Query the user whether to increase stack depth in shr X-Git-Tag: emacs-27.0.90~5186 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=60ec0c7960985bf6e849e2ea4c3888127f8e9bef;p=emacs.git Query the user whether to increase stack depth in shr * lisp/net/shr.el (shr-insert-document): Bind `max-specpdl-size' here... (bug#30675). (shr-descend): So that we can increase it temporarily here if the user wants to. --- diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 655f1420b0a..275b36f9009 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -274,6 +274,7 @@ DOM should be a parse tree as generated by (not (shr--have-one-fringe-p))) (* (frame-char-width) 2) 0))))) + (max-specpdl-size max-specpdl-size) bidi-display-reordering) ;; If the window was hscrolled for some reason, shr-fill-lines ;; below will misbehave, because it silently assumes that it @@ -523,8 +524,11 @@ size, and full-buffer size." (shr-depth (1+ shr-depth)) (start (point))) ;; shr uses many frames per nested node. - (if (> shr-depth (/ max-specpdl-size 15)) - (setq shr-warning "Too deeply nested to render properly; consider increasing `max-specpdl-size'") + (if (and (> shr-depth (/ max-specpdl-size 15)) + (not (and (y-or-n-p "Too deeply nested to render properly; increase `max-specpdl-size'?") + (setq max-specpdl-size (* max-specpdl-size 2))))) + (setq shr-warning + "Not rendering the complete page because of too-deep nesting") (when style (if (string-match "color\\|display\\|border-collapse" style) (setq shr-stylesheet (nconc (shr-parse-style style)