aboutsummaryrefslogtreecommitdiff
path: root/mf-lisp/mf-eww.el
blob: e01b614830a2d7238458e94ebec7e5c8f2d9280b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
;;; mf-eww.el --- Configuration for eww -*- lexical-binding: t -*-
;;; Code

(setq browse-url-browser-function #'eww
      browse-url-function #'eww
      browse-url-secondary-browser-function #'browse-url-chromium)

(with-eval-after-load 'eww
  (progn
     (append eww-suggest-uris (list #'mf/bookmarks))
     ;; From protesilaos prot-eww.el https://protesilaos/dotemacs
     (defun mf/eww--rename-buffer ()
       "Rename EWW buffer using page title or URL.
To be used by `eww-after-render-hook'."
       (let ((name (if (eq "" (plist-get eww-data :title))
                       (plist-get eww-data :url)
                     (plist-get eww-data :title))))
         (rename-buffer (format "*eww | %s*" name) t)))

     (add-hook 'eww-after-render-hook #'mf/eww--rename-buffer)
     (advice-add 'eww-back-url :after #'mf/eww--rename-buffer)
     (advice-add 'eww-forward-url :after #'mf/eww--rename-buffer)))


;; keybindings
(mf/leader "w" eww)

(provide 'mf-eww)
;;; mf-eww.el ends here