diff options
-rw-r--r-- | eww.org | 24 |
1 files changed, 13 insertions, 11 deletions
@@ -5,17 +5,19 @@ #+begin_src emacs-lisp (defun jao-eww-browse-url (url &rest r) "Browse URL using eww." - (jao-afio--goto-www) - (select-window (frame-first-window)) - (let* ((url (url-encode-url url)) - (bf (seq-find `(lambda (b) - (with-current-buffer b - (string= ,url - (url-encode-url (eww-current-url))))) - (jao-eww-session--list-buffers)))) - (cond (bf (switch-to-buffer bf)) - ((string-match-p url "^file://") (eww-open-file url)) - (t (eww url 4))))) + (if (derived-mode-p 'eww-mode) + (eww url) + (jao-afio--goto-www) + (select-window (frame-first-window)) + (let* ((url (url-encode-url url)) + (bf (seq-find `(lambda (b) + (with-current-buffer b + (string= ,url + (url-encode-url (eww-current-url))))) + (jao-eww-session--list-buffers)))) + (cond (bf (switch-to-buffer bf)) + ((string-match-p url "^file://") (eww-open-file url)) + (t (eww url 4)))))) (setq jao-browse-url-function #'jao-eww-browse-url) (setq eww-use-browse-url "^\\(gemini\\|gopher\\):") |