"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))
(condition-case nil
(decode-coding-region (point) (point-max) encode)
(coding-system-error nil))
+ (save-excursion
+ ;; Remove CRLF before parsing.
+ (while (re-search-forward "\r$" nil t)
+ (replace-match "" t t)))
(libxml-parse-html-region (point) (point-max))))))
(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)
(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)))
(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
(condition-case nil
(decode-coding-region (point-min) (point-max) 'utf-8)
(coding-system-error nil))
- (libxml-parse-html-region (point-min) (point-max)))))
+ (libxml-parse-html-region (point-min) (point-max))))
+ (base (plist-get eww-data :url)))
(eww-score-readability dom)
(eww-save-history)
(eww-display-html nil nil
- (eww-highest-readability dom)
+ (list 'base (list (cons 'href base))
+ (eww-highest-readability dom))
nil (current-buffer))
(dolist (elem '(:source :url :title :next :previous :up))
(plist-put eww-data elem (plist-get old-data elem)))
(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)
["List cookies" url-cookie-list t]
["Toggle fonts" eww-toggle-fonts t]
["Toggle colors" eww-toggle-colors 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
'(:annotation-function (lambda (buf)
(with-current-buffer buf
(format " %s" (eww-current-url)))))))
- (switch-to-buffer
+ (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))
(defun eww-toggle-fonts ()
"Toggle whether to use monospaced or font-enabled layouts."
(interactive)
- (message "Fonts are now %s"
- (if (setq shr-use-fonts (not shr-use-fonts))
- "on"
- "off"))
- (eww-reload))
+ (setq shr-use-fonts (not shr-use-fonts))
+ (eww-reload)
+ (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."