Closed ezeaguerre closed 2 years ago
Description
When I try to use an autofill, it fails with a message like the following:
<WARN> [22:46:16] Warning: Cannot paste: #<NYXT/AUTOFILL-MODE:AUTOFILL {1007F215BB}> fell through ETYPECASE expression. Wanted one of (STRING NULL).
Issue reproduction
This is my configuration file (~/.config/nyxt/nyxt-browser.lisp):
~/.config/nyxt/nyxt-browser.lisp
(setf (uiop:getenv "WEBKIT_DISABLE_COMPOSITING_MODE") "1") (define-configuration browser ((external-editor-program "/usr/bin/emacs")))
C-i
And it fails.
Information
I installed Nyxt with makepkg (from the AUR). This means it was built from source.
Nyxt version: 3-pre-release-1-213-g025689a1b Renderer version: GI-GTK Operating system kernel: Linux 5.19.2-arch1-1 Lisp implementation: SBCL 2.2.5 (Dynamic space size: 3221225472) Features: (:WEBKIT2 :WEBKIT2-2.36 :WEBKIT2-CORS-ALLOWLIST :WEBKIT2-PASTE-PLAINTEXT :WEBKIT2-TRACKING :WEBKIT2-MUTE :WEBKIT2-EMOJI :WEBKIT2-MEDIA :WEBKIT2-SANDBOXING :GTK-3-22 :GTK-3-20 :GTK-3-18 :GTK-3-16 :GTK-3-14 :GTK-3-12 :GTK-3-10 :GTK-3-8 :GTK-3-6 :GTK-3-4 :GTK :GDK-3-22 :GDK-3-20 :GDK-3-18 :GDK-3-16 :GDK-3-14 :GDK-3-12 :GDK-3-10 :GDK-3-8 :GDK-3-6 :GDK-3-4 :CAIRO-1-10 :CAIRO-1-12 :GDK-PIXBUF :GLIB-2-30 :GLIB-2-32 :GLIB-2-34 :GLIB-2-36 :GLIB-2-38 :GLIB-2-40 :GLIB-2-42 :GLIB-2-44 :GLIB-2-46 :GLIB-2-48 :GLIB-2-50 :GLIB-2-52 :GLIB-2-54 :GLIB-2-56 :GLIB-2-58 :GLIB :NYXT-3 :CUSTOM-HASH-TABLE-NATIVE :SLYNK :PLUMP-UTF-32 :PARENSCRIPT :FSET-EXT-STRINGS :GLOBAL-VARS :DECLARE-TYPES :SBCL+SAFE-STANDARD-READTABLE :NAMED-READTABLES :SWANK :LPARALLEL :21BIT-CHARS :CLOSER-MOP :CL-PPCRE-UNICODE :CL-UNICODE :CL-JSON-DOUBLE-FLOAT-IS-SUBSUMED :CL-JSON-SINGLE-FLOAT-IS-SUBSUMED :CL-PPCRE :CHUNGA :FLEXI-STREAMS :BORDEAUX-THREADS :LPARALLEL.WITH-CLTL2 :LPARALLEL.WITH-CAS :LPARALLEL.WITH-STEALING-SCHEDULER :SPLIT-SEQUENCE CFFI-FEATURES:FLAT-NAMESPACE CFFI-FEATURES:X86-64 CFFI-FEATURES:UNIX :CFFI CFFI-SYS::FLAT-NAMESPACE ALEXANDRIA::SEQUENCE-EMPTYP :FAST-IO-SV :FAST-IO :CL-JSON-CLOS :CL-JSON :SBCL-USES-SB-ROTATE-BYTE CHIPZ-SYSTEM:GRAY-STREAMS :THREAD-SUPPORT :ASDF3.3 :ASDF3.2 :ASDF3.1 :ASDF3 :ASDF2 :ASDF :OS-UNIX :NON-BASE-CHARS-EXIST-P :ASDF-UNICODE :X86-64 :GENCGC :64-BIT :ANSI-CL :COMMON-LISP :ELF :IEEE-FLOATING-POINT :LINUX :LITTLE-ENDIAN :PACKAGE-LOCAL-NICKNAMES :SB-CORE-COMPRESSION :SB-LDB :SB-PACKAGE-LOCKS :SB-THREAD :SB-UNICODE :SBCL :UNIX) ASDF version: 3.3.1 ASDF registries: (NYXT-SOURCE-REGISTRY ENVIRONMENT-SOURCE-REGISTRY) Critical dependencies: (/home/eze/dev/archlinux/nyxt-browser-git/src/nyxt-browser/_build/cl-cffi-gtk/gtk/cl-cffi-gtk.asd /home/eze/dev/archlinux/nyxt-browser-git/src/nyxt-browser/_build/cl-gobject-introspection/cl-gobject-introspection.asd /home/eze/dev/archlinux/nyxt-browser-git/src/nyxt-browser/_build/cl-webkit/webkit2/cl-webkit2.asd)
Output when started from a shell
Fix
I found that I can fix the issue with the following at the beginning of my configuration file:
(in-package :nyxt/autofill-mode) (define-class autofill-source (prompter:source) ((prompter:name "Autofills") (prompter:constructor (autofills (find-submode 'autofill-mode))) (prompter:return-actions (list (lambda-command autofill* (autofills) (ffi-buffer-paste (current-buffer) (funcall (first autofills))))))) (:export-class-name-p t) (:metaclass user-class)) (in-package :nyxt-user)
I understand that the following
https://github.com/atlas-engineer/nyxt/blob/025689a1b3e259339fc5d735daa4582bb96c0023/source/mode/autofill.lisp#L67
should funcall the autofill, like this:
funcall
(ffi-buffer-paste (current-buffer) (funcall (first autofills)))
So I redefined the class with that and it seems to work.
Indeed, your fix is a right one! Done in 8bed7e67059e2212113278aaa672552ca253aa91 :)
Description
When I try to use an autofill, it fails with a message like the following:
Issue reproduction
This is my configuration file (
~/.config/nyxt/nyxt-browser.lisp
):C-i
And it fails.
Information
I installed Nyxt with makepkg (from the AUR). This means it was built from source.
Output when started from a shell
Fix
I found that I can fix the issue with the following at the beginning of my configuration file:
I understand that the following
https://github.com/atlas-engineer/nyxt/blob/025689a1b3e259339fc5d735daa4582bb96c0023/source/mode/autofill.lisp#L67
should
funcall
the autofill, like this:So I redefined the class with that and it seems to work.