From: Lars Ingebrigtsen Date: Thu, 5 May 2016 17:41:11 +0000 (+0200) Subject: Make `R' in eww work more reliably X-Git-Tag: emacs-26.0.90~1994 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=67fa7f13d499eb5fc1d697da6c636b20728da22f;p=emacs.git Make `R' in eww work more reliably * lisp/net/eww.el (eww-score-readability): Protect against null children. --- diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 34cb02c24ac..6a8400320c2 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -669,11 +669,13 @@ the like." (setq score (- (length (split-string (dom-text node)))))) (t (dolist (elem (dom-children node)) - (if (stringp elem) - (setq score (+ score (length (split-string elem)))) + (cond + ((stringp elem) + (setq score (+ score (length (split-string elem))))) + ((consp elem) (setq score (+ score (or (cdr (assoc :eww-readability-score (cdr elem))) - (eww-score-readability elem)))))))) + (eww-score-readability elem))))))))) ;; Cache the score of the node to avoid recomputing all the time. (dom-set-attribute node :eww-readability-score score) score))