Improve the compatibility of desktop-save-mode' and
eww'
This commit is contained in:
parent
966aa9e91e
commit
9117f3b779
17
README.org
17
README.org
@ -5739,22 +5739,19 @@ Listing [[lst:configure-browse-url]] configures =browse-url=.
|
||||
:CUSTOM_ID: sec:emacs-web-wowser
|
||||
:END:
|
||||
|
||||
#+caption[Rename =eww= buffers and display =pdf= links properly]:
|
||||
#+caption: Rename =eww= buffers and display =pdf= links properly.
|
||||
#+name: lst:rename-eww-buffer-display-pdf-links
|
||||
#+caption[Display =pdf= links properly in =eww=]:
|
||||
#+caption: Display =pdf= links properly in =eww=.
|
||||
#+name: lst:display-pdf-links-in-eww
|
||||
#+begin_src emacs-lisp -n :results silent
|
||||
(with-eval-after-load 'eww
|
||||
;; GAV: Renaming `eww' buffers conflicts with `desktop-save-mode'.
|
||||
;; GAV: Setting `eww-restore-desktop' to something else fails too.
|
||||
(setopt eww-restore-desktop nil)
|
||||
|
||||
(defun eww-display-pdf-as-binary (fn &rest args)
|
||||
(let ((buffer-file-coding-system 'binary))
|
||||
(apply fn args)))
|
||||
|
||||
(defun eww-rename-buffer ()
|
||||
"Rename the buffer using title or url."
|
||||
(let* ((title (plist-get eww-data :title))
|
||||
(name (or (and (eq "" title) (plist-get eww-data :url)) title)))
|
||||
(rename-buffer (format "*%s # eww*" name) t)))
|
||||
|
||||
(add-hook 'eww-after-render-hook #'eww-rename-buffer)
|
||||
(advice-add 'eww-display-pdf :around #'eww-display-pdf-as-binary))
|
||||
#+end_src
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user