diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-02-17 18:36:42 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-02-20 18:01:56 -0700 |
commit | ce0ae7e9982479d3798cf3d84c8e90b25c0dbe8b (patch) | |
tree | 78d0c77e52371f0c039b4b64bc80ddf8b7a3add1 /.emacs.d/init-spw.el | |
parent | 84c763dca4e443308eb25206c729b747703cf2d5 (diff) | |
download | dotfiles-ce0ae7e9982479d3798cf3d84c8e90b25c0dbe8b.tar.gz |
eww bookmarks
Diffstat (limited to '.emacs.d/init-spw.el')
-rw-r--r-- | .emacs.d/init-spw.el | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/.emacs.d/init-spw.el b/.emacs.d/init-spw.el index 7c252ed8..6f91ccbd 100644 --- a/.emacs.d/init-spw.el +++ b/.emacs.d/init-spw.el @@ -2131,6 +2131,30 @@ mutt's review view, after exiting EDITOR." (add-hook 'eww-mode-hook (lambda () (setq-local sentence-end-double-space nil))) +;; eww bookmarks don't have short names associated to them, just page titles, +;; so for places we visit a lot the normal bookmarks system seems more +;; appropriate. adapted from bookmark-w3m.el. + +(defun spw/bookmark-eww-bookmark-make-record () + "Make an Emacs bookmark entry for an Eww buffer." + `(,(plist-get eww-data :title) + ,@(bookmark-make-record-default 'no-file) + (url . ,(eww-current-url)) + (handler . spw/bookmark-eww-bookmark-jump) + (defaults . (,(plist-get eww-data :title))))) + +(defun spw/bookmark-eww-bookmark-jump (bookmark) + (eww (bookmark-prop-get bookmark 'url)) + (bookmark-default-handler + `("" + (buffer . ,(current-buffer)) + . ,(bookmark-get-bookmark-record bookmark)))) + +(add-hook 'eww-mode-hook + (lambda () + (setq-local bookmark-make-record-function + #'spw/bookmark-eww-bookmark-make-record))) + ;;;; Assorted packages |