diff options
| author | Lars Ingebrigtsen | 2018-04-15 19:01:32 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2018-04-15 19:01:32 +0200 |
| commit | 60ec0c7960985bf6e849e2ea4c3888127f8e9bef (patch) | |
| tree | 4c0544b604d714f75bbac72d4313205703122a7e | |
| parent | e348910c7fe1d256a1d360bb2380221b1409d496 (diff) | |
| download | emacs-60ec0c7960985bf6e849e2ea4c3888127f8e9bef.tar.gz emacs-60ec0c7960985bf6e849e2ea4c3888127f8e9bef.zip | |
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.
| -rw-r--r-- | lisp/net/shr.el | 8 |
1 files changed, 6 insertions, 2 deletions
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 | |||
| 274 | (not (shr--have-one-fringe-p))) | 274 | (not (shr--have-one-fringe-p))) |
| 275 | (* (frame-char-width) 2) | 275 | (* (frame-char-width) 2) |
| 276 | 0))))) | 276 | 0))))) |
| 277 | (max-specpdl-size max-specpdl-size) | ||
| 277 | bidi-display-reordering) | 278 | bidi-display-reordering) |
| 278 | ;; If the window was hscrolled for some reason, shr-fill-lines | 279 | ;; If the window was hscrolled for some reason, shr-fill-lines |
| 279 | ;; below will misbehave, because it silently assumes that it | 280 | ;; below will misbehave, because it silently assumes that it |
| @@ -523,8 +524,11 @@ size, and full-buffer size." | |||
| 523 | (shr-depth (1+ shr-depth)) | 524 | (shr-depth (1+ shr-depth)) |
| 524 | (start (point))) | 525 | (start (point))) |
| 525 | ;; shr uses many frames per nested node. | 526 | ;; shr uses many frames per nested node. |
| 526 | (if (> shr-depth (/ max-specpdl-size 15)) | 527 | (if (and (> shr-depth (/ max-specpdl-size 15)) |
| 527 | (setq shr-warning "Too deeply nested to render properly; consider increasing `max-specpdl-size'") | 528 | (not (and (y-or-n-p "Too deeply nested to render properly; increase `max-specpdl-size'?") |
| 529 | (setq max-specpdl-size (* max-specpdl-size 2))))) | ||
| 530 | (setq shr-warning | ||
| 531 | "Not rendering the complete page because of too-deep nesting") | ||
| 528 | (when style | 532 | (when style |
| 529 | (if (string-match "color\\|display\\|border-collapse" style) | 533 | (if (string-match "color\\|display\\|border-collapse" style) |
| 530 | (setq shr-stylesheet (nconc (shr-parse-style style) | 534 | (setq shr-stylesheet (nconc (shr-parse-style style) |