all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#22257: 25.0.50; bidi-paragraph-direction is sticky in eww (patch)
@ 2015-12-28 16:38 Benjamin Riefenstahl
  2015-12-28 17:13 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Benjamin Riefenstahl @ 2015-12-28 16:38 UTC (permalink / raw)
  To: 22257

[-- Attachment #1: Type: text/plain, Size: 272 bytes --]

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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: bidi-sticky.patch --]
[-- Type: text/x-diff, Size: 654 bytes --]

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)

[-- Attachment #3: Type: text/plain, Size: 584 bytes --]



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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#22257: 25.0.50; bidi-paragraph-direction is sticky in eww (patch)
  2015-12-28 16:38 bug#22257: 25.0.50; bidi-paragraph-direction is sticky in eww (patch) Benjamin Riefenstahl
@ 2015-12-28 17:13 ` Lars Ingebrigtsen
  2015-12-28 18:25   ` Benjamin Riefenstahl
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2015-12-28 17:13 UTC (permalink / raw)
  To: Benjamin Riefenstahl; +Cc: 22257

Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net> writes:

> 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.

I think we do care.  :-)

Does the following fix the problem?  (Included in the Emacs 25 branch in
a jiffy...)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 5755a94..d455577 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -401,6 +401,7 @@ eww-display-html
 	(source (and (null document)
 		     (buffer-substring (point) (point-max)))))
     (with-current-buffer buffer
+      (setq bidi-paragraph-direction 'left-to-right)
       (plist-put eww-data :source source)
       (plist-put eww-data :dom document)
       (let ((inhibit-read-only t)


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#22257: 25.0.50; bidi-paragraph-direction is sticky in eww (patch)
  2015-12-28 17:13 ` Lars Ingebrigtsen
@ 2015-12-28 18:25   ` Benjamin Riefenstahl
  2015-12-28 20:02     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Benjamin Riefenstahl @ 2015-12-28 18:25 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 22257

Lars Ingebrigtsen writes:
> Does the following fix the problem?  (Included in the Emacs 25 branch in
> a jiffy...)

Sure, that does it, too.  I guess the setq for bidi-paragraph-direction
in eww-mode is redundant than.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#22257: 25.0.50; bidi-paragraph-direction is sticky in eww (patch)
  2015-12-28 18:25   ` Benjamin Riefenstahl
@ 2015-12-28 20:02     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2015-12-28 20:02 UTC (permalink / raw)
  To: Benjamin Riefenstahl; +Cc: 22257

Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net> writes:

> Lars Ingebrigtsen writes:
>> Does the following fix the problem?  (Included in the Emacs 25 branch in
>> a jiffy...)
>
> Sure, that does it, too.  I guess the setq for bidi-paragraph-direction
> in eww-mode is redundant than.

Yup.  Removed now.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-12-28 20:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-28 16:38 bug#22257: 25.0.50; bidi-paragraph-direction is sticky in eww (patch) Benjamin Riefenstahl
2015-12-28 17:13 ` Lars Ingebrigtsen
2015-12-28 18:25   ` Benjamin Riefenstahl
2015-12-28 20:02     ` Lars Ingebrigtsen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.