diff --git a/emacs/.emacs.d/config/init-eww.el b/emacs/.emacs.d/config/init-eww.el index 1313482..f287731 100644 --- a/emacs/.emacs.d/config/init-eww.el +++ b/emacs/.emacs.d/config/init-eww.el @@ -7,6 +7,7 @@ (interactive (let* ((uris (eww-suggested-uris)) (browser-history (mapcar (lambda (h) (plist-get h :url)) eww-history)) + (bookmarks (mapcar (lambda (b) (plist-get b :url)) eww-bookmarks)) (suggestions (delete-dups (append uris eww-prompt-history browser-history))) (current-uri (plist-get eww-data :url))) (list (completing-read "URL or keywords: " suggestions nil nil current-uri 'eww-prompt-history) @@ -74,10 +75,24 @@ new EWW buffer." (position (replace-regexp-in-string "^.*(\\([0-9]+\\))[\s\t]+~" "\\1" selection)) (point (string-to-number position))) (goto-char point)))) + (defun eww-visit-bookmark (bookmark &optional arg) + "Visit BOOKMARK in EWW." + (interactive (list (let* ((bookmarks (mapcar (lambda (b) + (cons (format "%s | %s" + (plist-get b :title) + (plist-get b :url)) + (plist-get b :url))) + eww-bookmarks)) + (bookmark (completing-read "Bookmark: " bookmarks))) + (cdr (assoc bookmark bookmarks))) + current-prefix-arg)) + (eww bookmark arg)) :general (leader-map "E" #'eww) (normal eww-mode-map "go" #'eww + "gb" #'eww-visit-bookmark + "gB" #'eww-list-bookmarks "gJ"#'eww-jump-to-url-on-page "gV" #'eww-visit-url-on-page))