all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Vasilij Schneidermann <v.schneidermann@gmail.com>, 28402@debbugs.gnu.org
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	[thread overview]
Message-ID: <877ew9vqwv.fsf@mouse.gnus.org> (raw)
In-Reply-To: <838tgy9d18.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 29 Sep 2017 10:31:15 +0300")

Eli Zaretskii <eliz@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





  parent reply	other threads:[~2017-10-05 10:18 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-09 19:39 bug#28402: 25.2; shr.el uses shr-tag-img despite set shr-external-rendering-functions Vasilij Schneidermann
2017-09-11 16:04 ` Eli Zaretskii
2017-09-13 17:22   ` Vasilij Schneidermann
2017-09-13 18:37     ` Eli Zaretskii
2017-09-24 13:10       ` Vasilij Schneidermann
2017-09-29  7:31         ` Eli Zaretskii
2017-10-05 10:02           ` Eli Zaretskii
2017-10-05 10:18           ` Lars Ingebrigtsen [this message]
2017-10-05 11:01             ` Eli Zaretskii
2017-10-05 11:18               ` Lars Ingebrigtsen
2017-10-05 13:14                 ` Eli Zaretskii
2017-10-05 13:22                   ` Lars Ingebrigtsen
2017-10-05 13:44                     ` Eli Zaretskii
2017-10-05 13:52                       ` Lars Ingebrigtsen
2017-10-05 20:08                         ` Vasilij Schneidermann
2017-10-05 20:10                           ` Lars Ingebrigtsen
2017-10-06 12:43                           ` Eli Zaretskii
2017-09-13 17:27 ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877ew9vqwv.fsf@mouse.gnus.org \
    --to=larsi@gnus.org \
    --cc=28402@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=v.schneidermann@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.