Compare commits

...

2 Commits

2 changed files with 8 additions and 12 deletions

3
.gitignore vendored
View File

@ -3,7 +3,6 @@
# git status --ignored
# Directories:
/_minted-README
/eln-cache
/elpa
/etc/yasnippet/snippets/latex-mode/auto/
@ -22,6 +21,7 @@ nuggy.py
pyproject.toml
variables.el
worg-backend-dependent-execution-update.org
yegge.html
# File suffixes:
*-autoloads.el
@ -32,7 +32,6 @@ worg-backend-dependent-execution-update.org
*.elc
*.fdb_latexmk
*.fls
*.html
*.lof
*.log
*.lol

View File

@ -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