summaryrefslogtreecommitdiff
path: root/eww-conf.el
blob: 5e21db1b2bae254e3d23be4f85728043a70677d5 (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
30
31
32
33
34
35
36
37
38
39
;;; eww-conf.el --- My configurations for Emacs Web Wowser -*- lexical-binding: t; -*-

;;; Author: Durand
;;; Created: 2021-01-20

;;; Commentary:

;; Simply configurations for the great Emacs Web Wowser

;;; Code:

(require 'eww)

(setq eww-bookmarks-directory load-file-directory)

(setq eww-search-prefix "https://searx.lukesmith.xyz/search?q=")

;; This feels much quicker
(cond ((version<= "28" emacs-version))
      ((setq eww-retrieve-command '("wget" "--quiet" "--output-document=-"))))

(define-key eww-mode-map (vector 'C-tab)
  #'durand-eww-goto-search-result)

;;;###autoload
(defun durand-eww-goto-search-result ()
  "Go to the search results on a search page.
Otherwise, just go to the beginning of the page."
  (interactive)
  (save-match-data
    (cond
     ((string-match-p "searx\\." (plist-get eww-data :url))
      (re-search-forward "search results"))
     ((goto-char (point-min)))))
  (recenter 0))

(provide 'eww-conf)

;;; eww-conf.el ends here