From 585b95ea00c319fc5f19238362dc4c757506ba76 Mon Sep 17 00:00:00 2001
From: Case Duckworth
Date: Wed, 1 Sep 2021 17:58:08 -0500
Subject: Replace ace-link with link-hint

---
 init.el | 55 ++++++++++++++++++++++++++++---------------------------
 1 file changed, 28 insertions(+), 27 deletions(-)

diff --git a/init.el b/init.el
index 59506be..06a2450 100644
--- a/init.el
+++ b/init.el
@@ -1060,33 +1060,6 @@ like a dumbass."
   (autoload 'dired-async-mode "dired-async.el" nil t)
   (dired-async-mode +1))
 
-(setup (:straight ace-link)
-  (ace-link-setup-default)
-
-  ;; I use C-o here, even though it's usually `open-line', because it still
-  ;; matches the 'o' logic given by abo-abo (it's got the Open mnemonic and
-  ;; it's close to 'l'), and because I've given `open-line' to M-l --- I don't
-  ;; need `downcase-word' much, and when I do, I can use `downcase-dwim', bound
-  ;; to C-c l.
-  (let ((key (kbd "C-o")))
-    (with-eval-after-load 'erc
-      (autoload 'org-element-lineage "org-element")
-      (define-key erc-mode-map key #'ace-link))
-    (with-eval-after-load 'org
-      (define-key org-mode-map key #'ace-link-org))
-    (with-eval-after-load 'gnus
-      (define-key gnus-summary-mode-map key #'ace-link-gnus)
-      (define-key gnus-article-mode-map key #'ace-link-gnus))
-    (with-eval-after-load 'ert
-      (define-key ert-results-mode-map "o" #'ace-link-help))
-    (with-eval-after-load 'mastodon
-      (define-key mastodon-mode-map "o" #'ace-link-addr))
-    (with-eval-after-load 'circe
-      (define-key circe-channel-mode-map (kbd "C-o") #'ace-link-addr))
-    ;; And still everything else
-    (setq ace-link-fallback-function #'ace-link-addr)
-    (global-set-key key #'ace-link)))
-
 (setup (:straight alert)
   (:option alert-default-style (acdw/system
                                 (:home 'libnotify)
@@ -1539,6 +1512,34 @@ successive invocations."
 (setup (:straight-if ledger-mode
                      (executable-find "ledger")))
 
+(setup (:straight link-hint)
+  ;; Browse web URLs with a browser with a prefix argument.
+  (dolist (type '(gnus-w3m-image-url
+                  gnus-w3m-url
+                  markdown-link
+                  mu4e-attachment
+                  mu4e-url
+                  notmuch-hello
+                  nov-link
+                  org-link
+                  shr-url
+                  text-url
+                  w3m-link
+                  w3m-message-link))
+    (link-hint-define-type type
+      :open-secondary browse-url-secondary-browser-function))
+
+  (defun acdw/link-hint-open-link (arg)
+    "Open a link using `link-hint-open-link', but like `browse-url-at-point'.
+That is, a prefix argument (\\[universal-argument]) will open the
+browser defined in `browse-url-secondary-browser-function'."
+    (interactive "P")
+    (avy-with link-hint-open-link
+      (link-hint--one (if arg :open-secondary :open))))
+
+  (:global "C-c C-o" acdw/link-hint-open-link
+           "C-c o" acdw/link-hint-open-link))
+
 (setup (:straight lua-mode)
   (add-to-list 'auto-mode-alist  '("\\.lua\\'" . lua-mode)))
 
-- 
cgit 1.4.1-21-gabe81