emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-25 b13cab6: Add a eww command to toggle paragraph di


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] emacs-25 b13cab6: Add a eww command to toggle paragraph direction
Date: Sun, 28 Feb 2016 04:23:09 +0000

branch: emacs-25
commit b13cab683c6060e002906fc944680aaa5f4ac123
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    Add a eww command to toggle paragraph direction
    
    * lisp/net/eww.el (eww-toggle-paragraph-direction): New
    command and keystroke.
    
    * doc/misc/eww.texi (Advanced): Mention the `D' command.
---
 doc/misc/eww.texi |    8 ++++++++
 etc/NEWS          |    4 ++++
 lisp/net/eww.el   |   13 ++++++++++++-
 3 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/doc/misc/eww.texi b/doc/misc/eww.texi
index 9bc80fb..795556b 100644
--- a/doc/misc/eww.texi
+++ b/doc/misc/eww.texi
@@ -206,6 +206,14 @@ For details about the Cookie handling @xref{Cookies,,,url}.
 @code{eww-header-line-format}.  The format replaces @code{%t} with the
 title of the website and @code{%u} with the URL.
 
address@hidden eww-toggle-paragraph-direction
address@hidden paragraph direction
+  The @kbd{D} command (@code{eww-toggle-paragraph-direction}) toggles
+the paragraphs direction between left-to-right and right-to-left
+text.  This can be useful on web pages that display right-to-left test
+(like Arabic and Hebrew), but where the web pages don't explicitly
+state the directionality.
+
 @c @vindex shr-bullet
 @c @vindex shr-hr-line
 @c @vindex eww-form-checkbox-selected-symbol
diff --git a/etc/NEWS b/etc/NEWS
index cd67dbe..8d86605 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -709,6 +709,10 @@ customize the `shr-use-fonts' variable.
 textual parts of a web page and display only that, leaving menus and
 the like off the page.
 
++++
+*** A new command `D' (`eww-toggle-paragraph-direction') allows you to
+toggle the paragraph direction between left-to-right and right-to-left.
+
 ---
 *** You can now use several eww buffers in parallel by renaming eww
 buffers you want to keep separate.
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 796eacf..886b4b9 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -607,6 +607,15 @@ Currently this means either text/html or 
application/xhtml+xml."
          (html-mode))))
     (view-buffer buf)))
 
+(defun eww-toggle-paragraph-direction ()
+  "Toggle the paragraphs direction between left-to-right and right-to-left."
+  (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))
+
 (defun eww-readable ()
   "View the main \"readable\" parts of the current web page.
 This command uses heuristics to find the parts of the web page that
@@ -690,6 +699,7 @@ the like."
     (define-key map "E" 'eww-set-character-encoding)
     (define-key map "S" 'eww-list-buffers)
     (define-key map "F" 'eww-toggle-fonts)
+    (define-key map "D" 'eww-toggle-paragraph-direction)
 
     (define-key map "b" 'eww-add-bookmark)
     (define-key map "B" 'eww-list-bookmarks)
@@ -714,7 +724,8 @@ the like."
        ["Add bookmark" eww-add-bookmark t]
        ["List bookmarks" eww-list-bookmarks t]
        ["List cookies" url-cookie-list t]
-       ["Character Encoding" eww-set-character-encoding]))
+        ["Character Encoding" eww-set-character-encoding]
+        ["Toggle Paragraph Direction" eww-toggle-paragraph-direction]))
     map))
 
 (defvar eww-tool-bar-map



reply via email to

[Prev in Thread] Current Thread [Next in Thread]