]> code.delx.au - gnu-emacs/blobdiff - lisp/net/eww.el
Merge from origin/emacs-25
[gnu-emacs] / lisp / net / eww.el
index d37b1b3261bb6c2a6f3b7cd654cb7befe29bcad8..6a8400320c215247b3f9b45dd8fa1f06a47b8370 100644 (file)
@@ -618,13 +618,19 @@ Currently this means either text/html or application/xhtml+xml."
     (view-buffer buf)))
 
 (defun eww-toggle-paragraph-direction ()
-  "Toggle the paragraphs direction between left-to-right and right-to-left."
+  "Cycle the paragraph direction between left-to-right, right-to-left and auto."
   (interactive)
   (setq bidi-paragraph-direction
-        (if (eq bidi-paragraph-direction 'left-to-right)
-            'right-to-left
-          'left-to-right))
-  (message "The paragraph direction is now %s" bidi-paragraph-direction))
+        (cond ((eq bidi-paragraph-direction 'left-to-right)
+               nil)
+              ((eq bidi-paragraph-direction 'right-to-left)
+               'left-to-right)
+              (t
+               'right-to-left)))
+  (message "The paragraph direction is now %s"
+           (if (null bidi-paragraph-direction)
+               "automatic"
+             bidi-paragraph-direction)))
 
 (defun eww-readable ()
   "View the main \"readable\" parts of the current web page.
@@ -663,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))