summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-03-25 23:19:13 +0000
committerjao <jao@gnu.org>2021-03-25 23:19:13 +0000
commita3ee0744482ff9a6fb78a9c8e0067f863720ef47 (patch)
tree36d85c826f04cbd7cf44748d99604cb983f546dd
parent41f3b9490baf125c05433a30b22961f3ad9bc993 (diff)
downloadelibs-a3ee0744482ff9a6fb78a9c8e0067f863720ef47.tar.gz
elibs-a3ee0744482ff9a6fb78a9c8e0067f863720ef47.tar.bz2
w3m-agnostic consult.org (embark targets)
-rw-r--r--consult.org10
1 files changed, 7 insertions, 3 deletions
diff --git a/consult.org b/consult.org
index 8254ea4..4304d62 100644
--- a/consult.org
+++ b/consult.org
@@ -271,13 +271,16 @@
(add-to-list 'embark-target-finders #'jao-embark-targets--org-link)
(add-to-list 'embark-keymap-alist '(org-link . jao-embark-targets-org-link-map))
#+end_src
-*** w3m targets
+*** url targets
#+begin_src emacs-lisp
(declare-function w3m-anchor "w3m")
(defun jao-embark-targets--w3m-anchor ()
(when (not (region-active-p))
- (when-let ((url (or (w3m-anchor) w3m-current-url)))
+ (when-let ((url (or (and (derived-mode-p 'w3m-mode)
+ (or (w3m-anchor) w3m-current-url))
+ (and (derived-mode-p 'eww-mode)
+ (jao-eww-buffer-url)))))
(when (string-match-p "^https?.*" url)
(cons 'url url)))))
@@ -285,12 +288,13 @@
(defun jao-embark-url (url)
"Browse URL, externally if we're already in emacs-w3m"
- (if (derived-mode-p 'w3m-mode)
+ (if (derived-mode-p 'w3m-mode 'eww-mode)
(jao-browse-with-external-browser url)
(browse-url url)))
(define-key embark-url-map (kbd "RET") #'jao-embark-url)
(define-key embark-url-map (kbd "f") #'browse-url-firefox)
+ (define-key embark-url-map (kbd "m") 'jao-browse-with-external-browser)
#+end_src
*** video url targets
#+begin_src emacs-lisp