Install sly. Using use-package:
(use-package sly :commands (sly sly-connect))
Or with package install:
sudo pacman -S nyxt
Close all nyxt instances.
sudo pacman -S sbcl
Install [quicklisp] and check the signature validity against the public key in GnuPG servers.
curl -O https://beta.quicklisp.org/quicklisp.lisp curl -O https://beta.quicklisp.org/quicklisp.lisp.asc gpg2 --receive-keys 307965AB028B5FF7 gpg2 --verify quicklisp.lisp.asc quicklisp.lisp
Load the lisp file with sbcl:
sbcl --load quicklisp.lisp
Inside the sbcl terminal run to start the installation procedure (copy paste the following code):
It will create the directory with all the package. The `ql:quickload ` function will download, install, and load the desired package.
Write this at the end of ~/.config/nyxt/init.lisp
(load "~/quicklisp/setup.lisp") (ql:quickload :slynk) (define-command-global start-slynk (&optional (slynk-port *swank-port*)) "Start a Slynk server that can be connected to, for instance, in Emacs via SLY. Warning: This allows Nyxt to be controlled remotely, that is, to execute arbitrary code with the privileges of the user running Nyxt. Make sure you understand the security risks associated with this before running this command." (slynk:create-server :port slynk-port :dont-close t :interface "0.0.0.0") (echo "Slynk server started at port ~a" slynk-port))
Consider changing `:interface 0.0.0.0 ` to `:interface 127.0.0.1 ` to avoid opening ports on all interfaces.
Press `M-x start-slynk ` to start the server.
Run `M-x sly-connect `, provide the host and port at the Emacs side (or run the following with C-c C-c):
(sly-connect "0.0.0.0" "4006")
Functions can be redefined with `defun `.
Nyxt commands are under the package `nyxt:: `. For instance, the following command will open the manual.
Usually, nyxt::* is not required. The following command will open a new URL in the current buffer:
(define-command my-html-data () "Just open an example buffer" (with-current-html-buffer (buffer "*My help*" 'nyxt/help-mode:help-mode) (spinneret:with-html-string (:style (style buffer)) (:style (cl-css:css '(("#documentation .button" :min-width "100px")))) (:h1 "Welcome to Nyxt :-)") (:p (:a :href "https://nyxt.atlas.engineer" "https://nyxt.atlas.engineer")) (:p (:a :class "button" :href (lisp-url `(help)) "Help")) (:p "This is a common example text."))))
This function is accessible via de URL lisp://(my-html-data)
A slot works as class variables shared among instances (classes and instances are OOP simile). It can be setted with `#'define-configuration ` functions. As the name suggests, they are used as configurations variables because all instances are affected as soon as their values are modified.
The following example set a slot `prompter::filter-postprocessor ` with a lambda function as value (the function is the value). The slot is defined in the `user-new-url-or-search-source ` class (the name is not case sensitive).
(define-configuration USER-NEW-URL-OR-SEARCH-SOURCE ((prompter::filter-postprocessor (lambda (nyxt::suggestions nyxt::source nyxt::input) (declare (ignore nyxt::suggestions nyxt::source)) (nyxt::input->queries nyxt::input :check-dns-p t :engine-completion-p nil)))))
Classes are the same as OOP, but instances can change its behaviour by changing the method and slot definitions.
That is the reason why slots are used as configuration too.
The following create an instance of a class `user-new-url-or-search-source `.
(make-instance 'user-new-url-or-search-source :actions an-action-list-here)