]> git.eshelyaron.com Git - emacs.git/commitdiff
Query the user whether to increase stack depth in shr
authorLars Ingebrigtsen <larsi@gnus.org>
Sun, 15 Apr 2018 17:01:32 +0000 (19:01 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Sun, 15 Apr 2018 17:01:32 +0000 (19:01 +0200)
* 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.

lisp/net/shr.el

index 655f1420b0a948db17cdaf920f7558793f0fe8b3..275b36f90097b1e9a33e676cb46a66e4cfca39bc 100644 (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)