summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-12-03 02:05:30 +0000
committerjao <jao@gnu.org>2021-12-03 02:05:30 +0000
commit597a227573bd8f78d8d59004d9ea424ac553d757 (patch)
tree3d0046fce77bacdc064f3fc90d2c162f2fb1bd74
parentb250844980ae6af7f231f67e9f80507bc2b6b5dc (diff)
downloadelibs-597a227573bd8f78d8d59004d9ea424ac553d757.tar.gz
elibs-597a227573bd8f78d8d59004d9ea424ac553d757.tar.bz2
finesse-ing link-hint for eww buffers
-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\\):")