From a3ee0744482ff9a6fb78a9c8e0067f863720ef47 Mon Sep 17 00:00:00 2001 From: jao Date: Thu, 25 Mar 2021 23:19:13 +0000 Subject: w3m-agnostic consult.org (embark targets) --- consult.org | 10 +++++++--- 1 file 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 -- cgit v1.2.3