GNU bug report logs - #28402
25.2; shr.el uses shr-tag-img despite set shr-external-rendering-functions

Previous Next

Package: emacs;

Reported by: Vasilij Schneidermann <v.schneidermann <at> gmail.com>

Date: Sat, 9 Sep 2017 19:40:01 UTC

Severity: normal

Found in version 25.2

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 28402 <at> debbugs.gnu.org, Vasilij Schneidermann <v.schneidermann <at> gmail.com>
Subject: bug#28402: 25.2; shr.el uses shr-tag-img despite set shr-external-rendering-functions
Date: Thu, 05 Oct 2017 12:18:40 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

> If no objections are voiced in a few days, I will push to the emacs-26
> branch.

Sorry; I didn't have a look at this before you applied.

It mostly looks fine, but this bit isn't:

 (defun shr-descend (dom)
-  (let ((function
-         (intern (concat "shr-tag-" (symbol-name (dom-tag dom))) obarray))
-        ;; Allow other packages to override (or provide) rendering
-        ;; of elements.
-        (external (cdr (assq (dom-tag dom) shr-external-rendering-functions)))
+  (let ((tag-name (dom-tag dom))
 	(style (dom-attr dom 'style))
 	(shr-stylesheet shr-stylesheet)
 	(shr-depth (1+ shr-depth))
@@ -490,12 +498,7 @@ shr-descend
 	  (setq style nil)))
       ;; If we have a display:none, then just ignore this part of the DOM.
       (unless (equal (cdr (assq 'display shr-stylesheet)) "none")
-        (cond (external
-               (funcall external dom))
-              ((fboundp function)
-               (funcall function dom))
-              (t
-               (shr-generic dom)))
+	(shr-indirect-call tag-name dom)

shr rendering of deep HTML structures uses a lot of stack, and we see
this in practice sometimes, where shr refuses to render HTML because
it's too deeply nested (and runs into the Emacs max-depth stack thing).

This indirect call will make the stack 30% deeper, I think?  As well as
slower, since it's an extra funcall for each and every HTML node.

So this part should be reverted.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 7 years and 234 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.