How to customize the list of blocked hosts?

Hi guys,

I am trying to customize the list of the blocked hosts. blocker-mode docstring shows an example (I love examples inside documentation, by the way :innocent: ).

It states that:

To customize the list of blocked hosts, set the `hostlists' slot.
See the `hostlist' class documentation.


\(defvar *my-blocked-hosts*
   :hosts '(\"\"

\(define-mode my-blocker-mode (nyxt/blocker-mode:blocker-mode)
  \"Blocker mode with custom hosts from `*my-blocked-hosts*'.\"
  ((nyxt/blocker-mode:hostlists (list *my-blocked-hosts* nyxt/blocker-mode:*default-hostlist*))))

\(define-configuration buffer
  ((default-modes (append '(my-blocker-mode) %slot-default%))))"

Ok. I am doing the following on SLIME. First, just certify what is the precise host I would like to block:

NYXT> (quri:uri-host (url (current-buffer)))

Then, following the tutorial:

NYXT> (defvar *my-blocked-hosts*
   :hosts '(\"\")))

NYXT> (define-mode my-blocker-mode (nyxt/blocker-mode:blocker-mode)
 ((nyxt/blocker-mode:hostlists (list *my-blocked-hosts* nyxt/blocker-mode:*default-hostlist*))))
<WARN> [23:14:11] The define-mode definition for MY-BLOCKER-MODE doesn't have a documentation string.
WARNING: Command MY-BLOCKER-MODE doesn't have a documentation string

NYXT> (define-configuration buffer
  ((default-modes (append '(my-blocker-mode) '()))))

OK. After all this:

1 - I am able to see my-blocked-mode as one of the options in the prompt-buffer;

2 - After choosing it, it is enabled in the status bar;

3 - Unfortunately, I can normally access . I was expecting that my-blocker-mode would block the web page from loading. I can refresh the page multiple times having the mode enabled with the behavior persisting.

Not sure if this is a bug. I guess I just did something wrong. Thus, I will not provide a full recipe yet with all that information.

I am doing this on commit id 45bda8c0 (7 hours ago).

Did I miss something?


@jmercouris helped me out during a live meeting. The problem was that I did not create a new buffer!

Currently, this configuration tweak does not work for the current buffer.


There was another problem which is the \ in:


Emacs automatically introduced them. But they need to be removed.

@pedro-delfino what’s this about a live meeting? :open_mouth:

I have a weekly meeting with John. We work together :slight_smile: