Add eww configuration and custom URL prompt function
This commit adds configuration for the built-in `eww` web browser in Emacs. It introduces a custom prompting function that suggests URLs or keywords based on the browsing history, current URL, and other suggestions, enhancing the user experience. Additionally, a key binding for the `eww` function is added in `eww-mode-map`.
This commit is contained in:
parent
f49adb3b73
commit
f3353bb124
@ -80,4 +80,19 @@
|
||||
(browse-url url-or-symbol)
|
||||
(browse-url (format "https://www.google.com/search?q=%s" url-or-symbol)))))
|
||||
|
||||
(use-package eww
|
||||
:straight (:type built-in)
|
||||
:config
|
||||
(defun eww-before-advice (&rest args)
|
||||
(interactive
|
||||
(let* ((uris (eww-suggested-uris))
|
||||
(browser-history (mapcar (lambda (h) (plist-get h :url)) eww-history))
|
||||
(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)
|
||||
current-prefix-arg))))
|
||||
(advice-add 'eww :before #'eww-before-advice)
|
||||
:general
|
||||
(normal eww-mode-map "go" #'eww))
|
||||
|
||||
(provide 'init-built-ins)
|
||||
|
Loading…
Reference in New Issue
Block a user