diff options
| author | Lars Ingebrigtsen | 2016-05-05 19:41:11 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2016-05-05 19:41:21 +0200 |
| commit | 67fa7f13d499eb5fc1d697da6c636b20728da22f (patch) | |
| tree | 85c1e7aefc1cee2abd1be3a95887e73a8a65653b | |
| parent | 25f455815bfaa868dc470d445413df9a7a546c46 (diff) | |
| download | emacs-67fa7f13d499eb5fc1d697da6c636b20728da22f.tar.gz emacs-67fa7f13d499eb5fc1d697da6c636b20728da22f.zip | |
Make `R' in eww work more reliably
* lisp/net/eww.el (eww-score-readability): Protect against
null children.
| -rw-r--r-- | lisp/net/eww.el | 8 |
1 files changed, 5 insertions, 3 deletions
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." | |||
| 669 | (setq score (- (length (split-string (dom-text node)))))) | 669 | (setq score (- (length (split-string (dom-text node)))))) |
| 670 | (t | 670 | (t |
| 671 | (dolist (elem (dom-children node)) | 671 | (dolist (elem (dom-children node)) |
| 672 | (if (stringp elem) | 672 | (cond |
| 673 | (setq score (+ score (length (split-string elem)))) | 673 | ((stringp elem) |
| 674 | (setq score (+ score (length (split-string elem))))) | ||
| 675 | ((consp elem) | ||
| 674 | (setq score (+ score | 676 | (setq score (+ score |
| 675 | (or (cdr (assoc :eww-readability-score (cdr elem))) | 677 | (or (cdr (assoc :eww-readability-score (cdr elem))) |
| 676 | (eww-score-readability elem)))))))) | 678 | (eww-score-readability elem))))))))) |
| 677 | ;; Cache the score of the node to avoid recomputing all the time. | 679 | ;; Cache the score of the node to avoid recomputing all the time. |
| 678 | (dom-set-attribute node :eww-readability-score score) | 680 | (dom-set-attribute node :eww-readability-score score) |
| 679 | score)) | 681 | score)) |