diff options
author | John Wiegley <johnw@newartisans.com> | 2015-12-29 21:39:08 -0800 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2015-12-29 21:39:08 -0800 |
commit | ec0a80cc283badc7f7fd5ef78512dde6d34b1355 (patch) | |
tree | 7190e0fb3d4aa06018d8cf997f06b806fb09a9c8 /lisp/net/eww.el | |
parent | d259328fb87db8cc67d52771efcfa653e52c5b71 (diff) | |
parent | e823c34072bf045800d91e12c7ddb61fa23c6e30 (diff) | |
download | emacs-25-merge.tar.gz |
Merge emacs-25 into master (using imerge)emacs-25-merge
Diffstat (limited to 'lisp/net/eww.el')
-rw-r--r-- | lisp/net/eww.el | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 7ec58f15028..107df24e865 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -93,7 +93,7 @@ desktop. Otherwise, such entries will be retained." (defcustom eww-restore-desktop nil "How to restore EWW buffers on `desktop-restore'. -If t or 'auto, the buffers will be reloaded automatically. +If t or `auto', the buffers will be reloaded automatically. If nil, buffers will require manual reload, and will contain the text specified in `eww-restore-reload-prompt' instead of the actual Web page contents." @@ -322,7 +322,8 @@ Currently this means either text/html or application/xhtml+xml." (or (cdr (assq 'charset (cdr content-type))) (eww-detect-charset (eww-html-p (car content-type))) "utf-8")))) - (data-buffer (current-buffer))) + (data-buffer (current-buffer)) + last-coding-system-used) ;; Save the https peer status. (with-current-buffer buffer (plist-put eww-data :peer (plist-get status :peer))) @@ -340,11 +341,13 @@ Currently this means either text/html or application/xhtml+xml." ((string-match-p "\\`image/" (car content-type)) (eww-display-image buffer)) (t - (eww-display-raw buffer encode))) + (eww-display-raw buffer (or encode charset 'utf-8)))) (with-current-buffer buffer (plist-put eww-data :url url) (eww-update-header-line-format) (setq eww-history-position 0) + (and last-coding-system-used + (set-buffer-file-coding-system last-coding-system-used)) (run-hooks 'eww-after-render-hook))) (kill-buffer data-buffer)))) @@ -390,17 +393,15 @@ Currently this means either text/html or application/xhtml+xml." (list 'base (list (cons 'href url)) (progn - (when (or (and encode - (not (eq charset encode))) - (not (eq charset 'utf-8))) - (condition-case nil - (decode-coding-region (point) (point-max) - (or encode charset)) - (coding-system-error nil))) + (setq encode (or encode charset 'utf-8)) + (condition-case nil + (decode-coding-region (point) (point-max) encode) + (coding-system-error nil)) (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) (plist-put eww-data :source source) (plist-put eww-data :dom document) (let ((inhibit-read-only t) @@ -529,11 +530,9 @@ Currently this means either text/html or application/xhtml+xml." (let ((inhibit-read-only t)) (erase-buffer) (insert data) - (unless (eq encode 'utf-8) - (encode-coding-region (point-min) (1+ (length data)) 'utf-8) - (condition-case nil - (decode-coding-region (point-min) (1+ (length data)) encode) - (coding-system-error nil)))) + (condition-case nil + (decode-coding-region (point-min) (1+ (length data)) encode) + (coding-system-error nil))) (goto-char (point-min))))) (defun eww-display-image (buffer) @@ -743,8 +742,7 @@ the like." (setq-local desktop-save-buffer #'eww-desktop-misc-data) ;; multi-page isearch support (setq-local multi-isearch-next-buffer-function #'eww-isearch-next-buffer) - (setq truncate-lines t - bidi-paragraph-direction 'left-to-right) + (setq truncate-lines t) (buffer-disable-undo) (setq buffer-read-only t)) @@ -1936,7 +1934,7 @@ Generally, the list should not include the (usually overly large) (defun eww-restore-desktop (file-name buffer-name misc-data) "Restore an eww buffer from its desktop file record. -If `eww-restore-desktop' is t or 'auto, this function will also +If `eww-restore-desktop' is t or `auto', this function will also initiate the retrieval of the respective URI in the background. Otherwise, the restored buffer will contain a prompt to do so by using \\[eww-reload]." |