Hint prompt not showing up

Hi, I’m new to nyxt, and I have a question on setting up nyxt with a custom config. With the following config, when I press j on a web page to invoke follow-hint, the hint prompt would not show up, and I’d get the following error:

WARN - Warning: Error on GTK thread: The value
  NIL
is not of type
  NKEYMAPS/CORE:KEYMAP
when binding NKEYMAPS/CORE:KEYMAP

If I comment out the last define-configuration, the hint prompt would work as expected. Do you know how I could fix it? Thank you.

(defvar *web-buffer-modes*
  '(:emacs-mode :no-script-mode :blocker-mode))

(define-configuration web-buffer
    ((default-modes `(,@*web-buffer-modes* ,@%slot-value%))))

(define-configuration (:modable-buffer :prompt-buffer :editor-buffer)
    "Set up Emacs keybindings everywhere possible."
  ((default-modes `(:emacs-mode ,@%slot-value%))))

(define-configuration :hint-mode
    "Set up QWERTY home row as the hint keys."
  ((hints-alphabet "ASDFGHJKL")))

(define-configuration :document-mode
    "Document mode keybindings."
  ((keyscheme-map
    (keymaps:define-keyscheme-map
        "my-document" (list :import %slot-value%)
      nyxt/keyscheme:emacs
      (list
       "B" 'switch-buffer-previous
       "F" 'switch-buffer-next
       "b" 'scroll-left
       "f" 'scroll-right
       "i" 'jump-to-heading
       "g" 'reload-current-buffer
       "j" 'follow-hint
       "J" 'follow-hint-new-buffer
       "k" 'delete-current-buffer
       "l" 'history-bakcwards
       "n" 'scroll-down
       "o" 'set-url
       "p" 'scroll-up
       "r" 'history-forwards
       "w" 'copy-url
       "<" 'scroll-to-top
       ">" 'scroll-to-bottom
       "C-h x" 'describe-command
       "C-s" :search-buffer
       "C-z" 'switch-buffer
       "M-n" 'next-heading
       "M-p" 'previous-heading
       )))))

;; if I comment out the following then prompt works
(define-configuration :prompt-buffer-mode
    "Prompt buffer mode keybindings."
  ((keyscheme-map
    (keymaps:define-keyscheme-map
        "my-prompt-buffer" (list :import %slot-value%)
      nyxt/keyscheme:emacs
      (list
       "C-s" 'next-suggestion
       "C-r" 'previous-suggestion
       )))))

@ycp Firstly, very interesting configuration. The keybindings you’re defining are in line with what I’d consider good defaults for the Emacs keyscheme.

You have hit a very interesting bug and I’ve reported it - Extend prompt buffer keyscheme map bug · Issue #3125 · atlas-engineer/nyxt · GitHub.

I’m not sure if it would help, but a possible (non tested) workaround could be to use the override-map.

Thanks.

I’m not sure if it would help, but a possible (non tested) workaround could be to use the override-map.

How do I do that? I replaced the define-configuration :prompt-buffer-mode with

(define-configuration :prompt-buffer-mode
    "Prompt buffer mode keybindings."
  ((override-map
    (let ((map (make-keymap "override-map")))
      (define-key map
          "C-s" 'next-suggestion
          "C-r" 'previous-suggestion
          )))))

And now j works with the prompt buffer appearing, but C-s and C-r does nothing.

I think you’ll need to prefix the package in which those commands appear, that is probably why it is not working :slight_smile:

Can you elaborate? Which package?

I mean like nyxt/mode/prompt-buffer:next-suggestion rather than just next-suggestion

I tried that with both the keyscheme-map and the override-map, but it did not make any difference. Could someone increase the priority on github given no workaround works so far?

Hi @ycp, sorry it didn’t work for you. Can you please point me to the GitHub issue that exists? Thanks,

-John

Hi @jmercouris it’s the one mentioned in a previous comment Extend prompt buffer keyscheme map bug · Issue #3125 · atlas-engineer/nyxt · GitHub

Or maybe let’s forget about my config. What is the config out there that most faithfully follows emacs keybinding? Is there any config out there that binds C-s/C-r to next/previous-suggestion in prompt buffer?

I don’t know of such a config, though I could try to make one! I’ll say we should fix the core problem though. Sorry for the problems it is causing!

@ycp you can assign keybindings in the prompt buffer as you wish. The issue arises when you have the same key (say C-r) bound in the prompt buffer document-mode.

@aadcg I don’t quite understand your comment. What do you mean by “same key”? I mean C-r does not appear more than once in the config.

Could you suggest a workaround? I tried override-map but it did not make any difference (see my previous comment about my attempt). I am new to nyxt, but this has been the issue stopping me from continuing to try nyxt.

@ycp, sorry I meant C-s, not C-r!

I need to think. I’ll be back in some days.

@aadcg OK C-s does appear twice in my config, but removing one occurrence (from document-mode, say) does not fix the issue. Also in your minimal reprod config file in the github issue, C-s also only appears once. So I am still not sure what you mean by "same key".

Sure!

I need to refresh my mind on the subject and to dig deeper. I’ve answered relying memory and, most likely, incorrectly.