Subject: 25.0.50; bidi-paragraph-direction is sticky in eww (patch)

From: Benjamin Riefenstahl <[email-masked]>
Date: Mon, 28 Dec 2015 17:38:58 +0100

When I have visited a page in eww that contains Hebrew text and than
switch to a non-Hebrew page, bidi-paragraph-direction is still set RTL.
A simple fix is attached.  The bug will still happen if the LTR page
does not have an <html> element at all, but we may not care.

diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index c28e0b8..47f7f9c 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -1103,12 +1103,9 @@ shr-previous-newline-padding-width
 ;;; Tag-specific rendering rules.
 
 (defun shr-tag-html (dom)
-  (let ((dir (dom-attr dom 'dir)))
-    (cond
-     ((equal dir "ltr")
-      (setq bidi-paragraph-direction 'left-to-right))
-     ((equal dir "rtl")
-      (setq bidi-paragraph-direction 'right-to-left))))
+  (if (equal dir(dom-attr dom 'dir) "rtl")
+      (setq bidi-paragraph-direction 'right-to-left)
+    (setq bidi-paragraph-direction 'left-to-right))
   (shr-generic dom))
 
 (defun shr-tag-body (dom)

In GNU Emacs 25.0.50.8 (i686-pc-linux-gnu, GTK+ Version 2.24.25)
 of 2015-12-28 built on justinian
Repository revision: f9d87dd8791d4e77929f21e4f73d92ef966722cc
Windowing system distributor 'The X.Org Foundation', version 11.0.11604000
System Description:	Debian GNU/Linux 8.2 (jessie)

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND GPM DBUS GCONF GSETTINGS NOTIFY
LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK2 X11

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix