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.
This commit is contained in:
Lars Ingebrigtsen 2018-04-15 19:01:32 +02:00
parent e348910c7f
commit 60ec0c7960

View file

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