]> code.delx.au - gnu-emacs/commitdiff
Merge from origin/emacs-25
authorJohn Wiegley <johnw@newartisans.com>
Fri, 4 Mar 2016 07:53:27 +0000 (23:53 -0800)
committerJohn Wiegley <johnw@newartisans.com>
Fri, 4 Mar 2016 07:53:27 +0000 (23:53 -0800)
cb1e3da Also allow setting the paragraph direction to nil
bbe8a89 Made the new OS X visible bell more visible.

1  2 
lisp/net/eww.el

diff --combined lisp/net/eww.el
index d37b1b3261bb6c2a6f3b7cd654cb7befe29bcad8,620a8a5f9acfb3a6041af7e47b83356e4ea275cd..34cb02c24ac16851796f62f3834f6c07c03d0e66
@@@ -31,7 -31,6 +31,7 @@@
  (require 'url-queue)
  (require 'url-util)                   ; for url-get-url-at-point
  (require 'mm-url)
 +(require 'puny)
  (eval-when-compile (require 'subr-x)) ;; for string-trim
  
  (defgroup eww nil
@@@ -223,7 -222,7 +223,7 @@@ See also `eww-form-checkbox-selected-sy
    "When this regex is found in the URL, it's not a keyword but an address.")
  
  (defvar eww-link-keymap
 -  (let ((map (copy-keymap shr-map)))
 +  (let ((map (copy-keymap shr-image-map)))
      (define-key map "\r" 'eww-follow-link)
      map))
  
@@@ -280,13 -279,6 +280,13 @@@ word(s) will be searched for via `eww-s
         (current-buffer)
       (get-buffer-create "*eww*")))
    (eww-setup-buffer)
 +  ;; Check whether the domain only uses "Highly Restricted" Unicode
 +  ;; IDNA characters.  If not, transform to punycode to indicate that
 +  ;; there may be funny business going on.
 +  (let ((parsed (url-generic-parse-url url)))
 +    (unless (puny-highly-restrictive-domain-p (url-host parsed))
 +      (setf (url-host parsed) (puny-encode-domain (url-host parsed)))
 +      (setq url (url-recreate-url parsed))))
    (plist-put eww-data :url url)
    (plist-put eww-data :title "")
    (eww-update-header-line-format)
@@@ -418,7 -410,7 +418,7 @@@ Currently this means either text/html o
        (source (and (null document)
                     (buffer-substring (point) (point-max)))))
      (with-current-buffer buffer
 -      (setq bidi-paragraph-direction 'left-to-right)
 +      (setq bidi-paragraph-direction nil)
        (plist-put eww-data :source source)
        (plist-put eww-data :dom document)
        (let ((inhibit-read-only t)
            (shr-target-id (url-target (url-generic-parse-url url)))
            (shr-external-rendering-functions
               (append
 +              shr-external-rendering-functions
                '((title . eww-tag-title)
                  (form . eww-tag-form)
                  (input . eww-tag-input)
 +                (button . eww-form-submit)
                  (textarea . eww-tag-textarea)
                  (select . eww-tag-select)
                  (link . eww-tag-link)
    (let ((inhibit-read-only t))
      (remove-overlays)
      (erase-buffer))
 -  (setq bidi-paragraph-direction 'left-to-right)
 +  (setq bidi-paragraph-direction nil)
    (unless (eq major-mode 'eww-mode)
      (eww-mode)))
  
      (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.
@@@ -707,11 -703,9 +713,11 @@@ the like.
      (define-key map "R" 'eww-readable)
      (define-key map "H" 'eww-list-histories)
      (define-key map "E" 'eww-set-character-encoding)
 +    (define-key map "s" 'eww-switch-to-buffer)
      (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 [(meta C)] 'eww-toggle-colors)
  
      (define-key map "b" 'eww-add-bookmark)
      (define-key map "B" 'eww-list-bookmarks)
        ["View page source" eww-view-source]
        ["Copy page URL" eww-copy-page-url t]
        ["List histories" eww-list-histories t]
 +      ["Switch to buffer" eww-switch-to-buffer t]
        ["List buffers" eww-list-buffers t]
        ["Add bookmark" eww-add-bookmark t]
        ["List bookmarks" eww-list-bookmarks t]
        ["List cookies" url-cookie-list t]
 +      ["Toggle fonts" eww-toggle-fonts t]
 +      ["Toggle colors" eww-toggle-colors t]
          ["Character Encoding" eww-set-character-encoding]
          ["Toggle Paragraph Direction" eww-toggle-paragraph-direction]))
      map))
@@@ -1525,24 -1516,6 +1531,24 @@@ If CHARSET is nil then use UTF-8.
        (eww-reload nil 'utf-8)
      (eww-reload nil charset)))
  
 +(defun eww-switch-to-buffer ()
 +  "Prompt for an EWW buffer to display in the selected window."
 +  (interactive)
 +  (let ((completion-extra-properties
 +         '(:annotation-function (lambda (buf)
 +                                  (with-current-buffer buf
 +                                    (format " %s" (eww-current-url)))))))
 +    (pop-to-buffer-same-window
 +     (read-buffer "Switch to EWW buffer: "
 +                  (cl-loop for buf in (nreverse (buffer-list))
 +                           if (with-current-buffer buf (derived-mode-p 'eww-mode))
 +                           return buf)
 +                  t
 +                  (lambda (bufn)
 +                    (with-current-buffer
 +                        (if (consp bufn) (cdr bufn) (get-buffer bufn))
 +                      (derived-mode-p 'eww-mode)))))))
 +
  (defun eww-toggle-fonts ()
    "Toggle whether to use monospaced or font-enabled layouts."
    (interactive)
    (message "Proportional fonts are now %s"
             (if shr-use-fonts "on" "off")))
  
 +(defun eww-toggle-colors ()
 +  "Toggle whether to use HTML-specified colors or not."
 +  (interactive)
 +  (message "Colors are now %s"
 +         (if (setq shr-use-colors (not shr-use-colors))
 +             "on"
 +           "off"))
 +  (eww-reload))
 +
  ;;; Bookmarks code
  
  (defvar eww-bookmarks nil)