(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."
(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)))
((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))))
(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)
(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)
(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))
(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]."