Next: Use CLOS-style config.
parent
c077c74184
commit
62f5f7c69a
|
@ -82,6 +82,7 @@ Videos are downloaded with `+youtube-dl-command+'."
|
||||||
(defun auto-proxy-handler (url)
|
(defun auto-proxy-handler (url)
|
||||||
(let* ((uri (quri:uri url))
|
(let* ((uri (quri:uri url))
|
||||||
(domain (and uri (quri:uri-domain uri))))
|
(domain (and uri (quri:uri-domain uri))))
|
||||||
|
;; TODO: Turn on/off proxy, not mode.
|
||||||
(when domain
|
(when domain
|
||||||
(next/proxy-mode:proxy-mode
|
(next/proxy-mode:proxy-mode
|
||||||
:activate
|
:activate
|
||||||
|
@ -97,77 +98,59 @@ Videos are downloaded with `+youtube-dl-command+'."
|
||||||
"m.media-amazon.com")))
|
"m.media-amazon.com")))
|
||||||
|
|
||||||
(defun no-cookies-handler (buffer)
|
(defun no-cookies-handler (buffer)
|
||||||
|
;; TODO: Disable cookies for known hosts.
|
||||||
(setf (cookies-path buffer) #P""))
|
(setf (cookies-path buffer) #P""))
|
||||||
|
|
||||||
(defun my-buffer-defaults (buffer)
|
(define-mode my-blocker-mode (next/blocker-mode:blocker-mode)
|
||||||
|
"Blocker mode with custom hosts from `*my-blocked-hosts*'."
|
||||||
|
((next/blocker-mode::hostlists :initform (list *my-blocked-hosts* next/blocker-mode:*default-host-list*))))
|
||||||
|
|
||||||
(setf (zoom-ratio-default buffer) 1.0)
|
(defclass my-buffer (buffer)
|
||||||
(unzoom-page :buffer buffer) ; Needed for non-web-mode buffers.
|
((default-modes :initform (append
|
||||||
|
'(my-mode vi-normal-mode
|
||||||
|
my-blocker-mode
|
||||||
|
proxy-mode)
|
||||||
|
(get-default 'buffer 'default-modes)))
|
||||||
|
(load-hook :initform (list #'old-reddit-handler
|
||||||
|
#'auto-proxy-handler))))
|
||||||
|
|
||||||
(dolist (mode '(vi-normal-mode proxy-mode my-mode))
|
(setf *buffer-class* 'my-buffer)
|
||||||
(pushnew mode (default-modes buffer)))
|
|
||||||
;; TODO: Pros and cons of the following approach to mode init?
|
|
||||||
;; The problem with DEFAULT-MODES is that it does not allow for configuring
|
|
||||||
;; the modes.
|
|
||||||
(next/blocker-mode:blocker-mode
|
|
||||||
:hostlists (list *my-blocked-hosts* next/blocker-mode:*default-host-list*)
|
|
||||||
:buffer buffer)
|
|
||||||
(dolist (handler (list #'old-reddit-handler #'auto-proxy-handler))
|
|
||||||
(hooks:add-to-hook (hooks:object-hook buffer 'load-hook)
|
|
||||||
handler)))
|
|
||||||
|
|
||||||
(defun my-window-defaults (window)
|
(defclass my-remote-interface (remote-interface)
|
||||||
(setf (minibuffer-open-height window) 200))
|
|
||||||
|
|
||||||
(defun my-minibuffer-defaults (minibuffer)
|
|
||||||
(setf
|
|
||||||
(minibuffer-line-height minibuffer) "1.0em"
|
|
||||||
(minibuffer-font-size minibuffer) "1.0em"))
|
|
||||||
|
|
||||||
(defun my-interface-defaults ()
|
|
||||||
;; TODO: Fetch from Emacs' engine.el automatically?
|
;; TODO: Fetch from Emacs' engine.el automatically?
|
||||||
(setf (search-engines *interface*)
|
((search-engines :initform
|
||||||
(append
|
(append
|
||||||
'(("aa" . "https://aur.archlinux.org/packages.php?O=0&K=~a&do_Search=Go")
|
'(("aa" . "https://aur.archlinux.org/packages.php?O=0&K=~a&do_Search=Go")
|
||||||
("ap" . "https://www.archlinux.org/packages/?sort=&q=~a&maintainer=&flagged=")
|
("ap" . "https://www.archlinux.org/packages/?sort=&q=~a&maintainer=&flagged=")
|
||||||
("aw" . "https://wiki.archlinux.org/index.php?search=~a")
|
("aw" . "https://wiki.archlinux.org/index.php?search=~a")
|
||||||
("ctan" . "http://www.ctan.org/search?phrase=~a")
|
("ctan" . "http://www.ctan.org/search?phrase=~a")
|
||||||
("dd" . "http://devdocs.io/#q=~a")
|
("dd" . "http://devdocs.io/#q=~a")
|
||||||
("dg" . "https://duckduckgo.com/?q=~a")
|
("dg" . "https://duckduckgo.com/?q=~a")
|
||||||
("eb" . "https://debbugs.gnu.org/cgi/pkgreport.cgi?package=emacs;include=subject%3A~a;repeatmerged=on;archive=both")
|
("eb" . "https://debbugs.gnu.org/cgi/pkgreport.cgi?package=emacs;include=subject%3A~a;repeatmerged=on;archive=both")
|
||||||
("ed" . "https://lists.gnu.org/archive/cgi-bin/namazu.cgi?idxname=emacs-devel&submit=Search&query=~a")
|
("ed" . "https://lists.gnu.org/archive/cgi-bin/namazu.cgi?idxname=emacs-devel&submit=Search&query=~a")
|
||||||
("ee" . "https://lists.gnu.org/archive/cgi-bin/namazu.cgi?idxname=emms-help&submit=Search!&query=~a")
|
("ee" . "https://lists.gnu.org/archive/cgi-bin/namazu.cgi?idxname=emms-help&submit=Search!&query=~a")
|
||||||
("ge" . "https://wiki.gentoo.org/index.php?title=Special%3ASearch&search=~a&go=Go")
|
("ge" . "https://wiki.gentoo.org/index.php?title=Special%3ASearch&search=~a&go=Go")
|
||||||
("gh" . "https://github.com/search?ref=simplesearch&q=~a")
|
("gh" . "https://github.com/search?ref=simplesearch&q=~a")
|
||||||
("gr" . "https://www.goodreads.com/search?q=~a")
|
("gr" . "https://www.goodreads.com/search?q=~a")
|
||||||
("gm" . "https://maps.google.com/maps?q=~a")
|
("gm" . "https://maps.google.com/maps?q=~a")
|
||||||
("gud" . "https://lists.gnu.org/archive/cgi-bin/namazu.cgi?idxname=guix-devel&submit=Search&query=~a")
|
("gud" . "https://lists.gnu.org/archive/cgi-bin/namazu.cgi?idxname=guix-devel&submit=Search&query=~a")
|
||||||
("guh" . "https://lists.gnu.org/archive/cgi-bin/namazu.cgi?idxname=help-guix&submit=Search!&query=~a")
|
("guh" . "https://lists.gnu.org/archive/cgi-bin/namazu.cgi?idxname=help-guix&submit=Search!&query=~a")
|
||||||
("gup" . "https://guix-hpc.bordeaux.inria.fr/package/~a")
|
("gup" . "https://guix-hpc.bordeaux.inria.fr/package/~a")
|
||||||
("i" . "http://www.imdb.com/find?q=~a&s=all")
|
("i" . "http://www.imdb.com/find?q=~a&s=all")
|
||||||
("mba" . "http://musicbrainz.org/search?query=~a&type=artist&method=indexed")
|
("mba" . "http://musicbrainz.org/search?query=~a&type=artist&method=indexed")
|
||||||
("mbr" . "http://musicbrainz.org/search?query=~a&type=release&method=indexed")
|
("mbr" . "http://musicbrainz.org/search?query=~a&type=release&method=indexed")
|
||||||
("osm" . "https://www.openstreetmap.org/search?query=~a")
|
("osm" . "https://www.openstreetmap.org/search?query=~a")
|
||||||
("q" . "http://quickdocs.org/search?q=~a")
|
("q" . "http://quickdocs.org/search?q=~a")
|
||||||
("s" . "http://stackoverflow.com/search?q=~a")
|
("s" . "http://stackoverflow.com/search?q=~a")
|
||||||
("wp" . "http://www.wikipedia.org/search-redirect.php?language=en&go=Go&search=~a")
|
("wp" . "http://www.wikipedia.org/search-redirect.php?language=en&go=Go&search=~a")
|
||||||
("wb" . "http://en.wikibooks.org/wiki/Special:Search?search=~a")
|
("wb" . "http://en.wikibooks.org/wiki/Special:Search?search=~a")
|
||||||
("wk" . "http://en.wiktionary.org/wiki/Special:Search?search=~a")
|
("wk" . "http://en.wiktionary.org/wiki/Special:Search?search=~a")
|
||||||
("wa" . "http://www.winehq.org/search/?q=~a")
|
("wa" . "http://www.winehq.org/search/?q=~a")
|
||||||
("yt" . "https://www.youtube.com/results?search_query=~a"))
|
("yt" . "https://www.youtube.com/results?search_query=~a"))
|
||||||
(search-engines *interface*)))
|
(get-default 'remote-interface 'search-engines)))
|
||||||
(setf (download-directory *interface*) "~/temp")
|
(download-directory :initform "~/temp")))
|
||||||
;; (setf (history-path *interface*) "/home/ambrevar/temp/next/history.lisp")
|
|
||||||
;; (hooks:add-to-hook (hooks:object-hook *interface* 'buffer-before-make-hook)
|
|
||||||
;; #'no-cookies-handler)
|
|
||||||
(hooks:add-to-hook (hooks:object-hook *interface* 'buffer-make-hook)
|
|
||||||
#'my-buffer-defaults)
|
|
||||||
(hooks:add-to-hook (hooks:object-hook *interface* 'minibuffer-make-hook)
|
|
||||||
#'my-minibuffer-defaults)
|
|
||||||
(hooks:add-to-hook (hooks:object-hook *interface* 'window-make-hook)
|
|
||||||
#'my-window-defaults))
|
|
||||||
|
|
||||||
(hooks:add-to-hook '*after-init-hook* #'my-interface-defaults)
|
(setf *remote-interface-class* 'my-remote-interface)
|
||||||
|
|
||||||
(defmethod deserialize-bookmarks (stream)
|
(defmethod deserialize-bookmarks (stream)
|
||||||
"This version of deserialize-bookmarks is compatibly with Ambrevar's EWW
|
"This version of deserialize-bookmarks is compatibly with Ambrevar's EWW
|
||||||
|
|
Loading…
Reference in New Issue