summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--eww.org24
1 files changed, 13 insertions, 11 deletions
diff --git a/eww.org b/eww.org
index e724b8c..998fba4 100644
--- a/eww.org
+++ b/eww.org
@@ -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\\):")