]> code.delx.au - gnu-emacs/commitdiff
* shr.el (shr-descend): Allow using lambdas in external functions.
authorLars Ingebrigtsen <larsi@gnus.org>
Sun, 27 Dec 2015 06:18:29 +0000 (07:18 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Sun, 27 Dec 2015 06:18:29 +0000 (07:18 +0100)
lisp/net/shr.el

index 3d5f02c359bbf4c56c99d879916c50e1f0e4c419..469ef4ec52fbc978fe9665e4d5733a59cdb9d717 100644 (file)
@@ -429,11 +429,10 @@ size, and full-buffer size."
 
 (defun shr-descend (dom)
   (let ((function
-        (or
-         ;; Allow other packages to override (or provide) rendering
-         ;; of elements.
-         (cdr (assq (dom-tag dom) shr-external-rendering-functions))
-         (intern (concat "shr-tag-" (symbol-name (dom-tag dom))) obarray)))
+         (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)))
        (style (dom-attr dom 'style))
        (shr-stylesheet shr-stylesheet)
        (shr-depth (1+ shr-depth))
@@ -448,9 +447,12 @@ size, and full-buffer size."
          (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")
-       (if (fboundp function)
-           (funcall function dom)
-         (shr-generic dom))
+        (cond (external
+               (funcall external dom))
+              ((fboundp function)
+               (funcall function dom))
+              (t
+               (shr-generic dom)))
        (when (and shr-target-id
                   (equal (dom-attr dom 'id) shr-target-id))
          ;; If the element was empty, we don't have anything to put the