From a37891f4fc8becde60bfb90168c684fed9429219 Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Wed, 24 Jul 2024 14:21:08 -0400 Subject: [PATCH] Configure webjump --- emacs/.emacs.d/config/init-built-ins.el | 10 --------- emacs/.emacs.d/config/init-eww.el | 28 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/emacs/.emacs.d/config/init-built-ins.el b/emacs/.emacs.d/config/init-built-ins.el index 089bfa6..9585f6b 100644 --- a/emacs/.emacs.d/config/init-built-ins.el +++ b/emacs/.emacs.d/config/init-built-ins.el @@ -70,14 +70,4 @@ :general ([remap dabbrev-expand] #'hippie-expand)) -(use-package browse-url - :straight (:type built-in) - :config - (defun browse-url-or-search (url-or-symbol) - "If URL-OR-SYMBOL is a URL, browse it. Otherwise, search for it." - (interactive (list (thing-at-point 'symbol))) - (if (ffap-url-p url-or-symbol) - (browse-url url-or-symbol) - (browse-url (format "https://www.google.com/search?q=%s" url-or-symbol))))) - (provide 'init-built-ins) diff --git a/emacs/.emacs.d/config/init-eww.el b/emacs/.emacs.d/config/init-eww.el index f287731..e72aac8 100644 --- a/emacs/.emacs.d/config/init-eww.el +++ b/emacs/.emacs.d/config/init-eww.el @@ -103,4 +103,32 @@ new EWW buffer." (add-to-list 'shr-external-rendering-functions '(pre . shr-tag-pre-highlight))) +(use-package browse-url + :straight (:type built-in) + :config + (defun browse-url-or-search (url-or-symbol) + "If URL-OR-SYMBOL is a URL, browse it. Otherwise, search for it." + (interactive (list (thing-at-point 'symbol))) + (if (ffap-url-p url-or-symbol) + (browse-url url-or-symbol) + (browse-url (format "https://www.google.com/search?q=%s" url-or-symbol)))) + :custom + (browse-url-browser-function 'eww-browse-url) + (browse-url-handlers '(("\\`https?://docs.aws.amazon.com" . browse-url-default-browser) + ("\\`https?://github.com" . browse-url-default-browser)))) + +(use-package webjump + :straight (:type built-in) + :init + (defalias 'web-search #'webjump) + :general + (leader-map "S" #'web-search) + :custom + (webjump-sites '(("Emacs Wiki" . [simple-query "www.emacswiki.org" "www.emacswiki.org/cgi-bin/wiki/" ""]) + ("DuckDuckGo" . [simple-query "duckduckgo.com" "duckduckgo.com/?q=" ""]) + ("Wikipedia" . [simple-query "wikipedia.org" "https://www.wikipedia.org/search-redirect.php?language=en&go=Go&search=%s" ""]) + ("Google" . [simple-query "google.com" "https://www.google.com/search?ie=utf-8&oe=utf-8&q=" ""]) + ("StackOverflow" . [simple-query "stackoverflow.com" "https://stackoverflow.com/search?q=" ""]) + ("AWS Docs" . [simple-query "docs.aws.amazon.com" "https://docs.aws.amazon.com/search/doc-search.html?searchPath=documentation&searchQuery=" ""])))) + (provide 'init-eww)