Next: Use define-configuration with %slot-default and for modes.

master
Pierre Neidhardt 2020-04-21 19:54:48 +02:00
parent b88f327af5
commit 31d6831807
1 changed files with 30 additions and 6 deletions

View File

@ -94,16 +94,20 @@ Videos are downloaded with `+youtube-dl-command+'."
"syndication.twitter.com"
"m.media-amazon.com")))
(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-hostlist*))))
(define-configuration next/blocker-mode:blocker-mode
((next/blocker-mode:hostlists (append (list *my-blocked-hosts*) %slot-default))))
;; (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-hostlist*))))
(define-configuration buffer
((default-modes (append
'(my-mode vi-normal-mode
my-blocker-mode
;; my-blocker-mode
blocker-mode
proxy-mode)
(get-default 'buffer 'default-modes)))
%slot-default))
(load-hook (hooks:make-hook-string->string
:handlers (list #'old-reddit-handler
#'auto-proxy-handler)
@ -144,7 +148,7 @@ Recognized formats:
(read-emacs-engines s))))
(define-configuration browser
((search-engines (append my-search-engines (get-default 'browser 'search-engines)))))
((search-engines (append my-search-engines %slot-default))))
(defmethod deserialize-bookmarks (stream)
"This version of deserialize-bookmarks is compatibly with Ambrevar's EWW
@ -177,3 +181,23 @@ format."
(setf next/vcs:*vcs-projects-roots* '("~/projects"
"~/common-lisp"
"~/.local/share/emacs/site-lisp"))
(defun my-format-status (window)
(declare (ignore window))
(let* ((buffer (current-buffer))
(buffer-count (position buffer
(sort (alexandria:hash-table-values (buffers *browser*))
#'<
:key #'id))))
(format nil "[~{~a~^ ~}] (~a/~a) ~a — ~a"
(mapcar (lambda (m) (str:replace-all "-mode" ""
(str:downcase
(class-name (class-of m)))))
(modes buffer))
buffer-count
(hash-table-count (buffers *browser*))
(url buffer)
(title buffer))))
(define-configuration window
((status-formatter #'my-format-status)))