Issues trying to persist modes

so I had this issue when I tried nyxt before the summer and now that I’m trying it out again, same issue. I cant seem to get my modes to show as enable on nyxt when I write them on the config.lisp file like:

(define-configuration web-buffer
  ((default-modes (append '(force-https-mode) %slot-default%))))

Same with all the other modes I try, :frowning: what am I doing wrong?
thanks

That looks absolutely correct to me!

Which version are you running?

What makes you think that the mode is not enabled?

Hello, thanks for the reply, I use latest from git using the arch AUR package. is because it does not show on the modes bar at the button right, also I still get JavaScript for the no JavaScript one etc. etc.

Could you please double check which modes are enabled by running the command toggle-modes?

Are you keeping your configuration file at ~/.config/nyxt/config.lisp?

@rek2, does nyxt/emacs-mode:emacs-mode work? Note that you have to provide the right package for the mode symbol for it to be found.

CC @ambrevar, @aadcg we should finally switch to nsymbols even in find-submode, I think…

Oh right, as @aartaka notes, the issue with your snippet is that you need nyxt/force-https-mode:force-https-mode instead of force-https-mode.

Of course, I am writing this to the config in ~/.config/nyxt/config.lisp :wink:
oh yeah, I was wondering why in the documentation examples it did not have the whole thing, also I was looking into @aartaka example on his dot files and I was using at first:

;;; Add block
(defvar *web-buffer-modes*
  '(nyxt/blocker-mode:blocker-mode
    nyxt/force-https-mode:force-https-mode
    nyxt/reduce-tracking-mode:reduce-tracking-mode))

(define-configuration buffer web-buffer
  ((default-modes (append *web-buffer-modes* %slot-default%))))

And this did not work neither O_o going to revert after I am done with work and try again with this.
here in the screeenshot is where I check if they got enabled or not.

I use vim keys not emacs, and the vim keys do work after the fix last week.

I was wondering why in the documentation examples it did not have the whole thing

Could you specify where you found it exactly so that we fix it?

Shouldn’t you be using %slot-value% instead of %slot-default%, generally?

hello sorry was out for a work trip doing an sec audit. Im back now, hmm, dont remember but since I have no clue of lisp I am sure I copy it from somewhere in the blog or in one of the devs github dot files for their configuration

IDK you guys tell me, I am a C/GO and now Rust person no idea of LISP such why all the issues specially for config files, and if there is no official examples for most common settings even harder but I have been copying from @aartaka dot files in github so not sure why I have such issues.

@all I notice that the auto-rules that are saved on .local/share/nyxt/auto-rules.lisp does work, can I use regex? like add instead of the domain a “*” so my blocker and non-javascript etc. works by default on all sites and only disable on the sites I trust?

;; Every rule starts on a new line and consists of one or more of the following elements:
;; - Condition for rule activation. It is either (match-domain ...),
;;   (match-host ...), (match-regex ...) or a string.
;; - :included (optional) -- List of the modes to enable on condition.
;; - :excluded (optional) -- List of the modes to disable on condition.
;; - :exact-p  (optional) -- Whether to enable only :included modes and disable
;;    everything else (if :exact-p is t), or just add :included and exclude :excluded
;;    modes from the current modes list (if :exact-p is nil or not present).
;;

ok I got this to work entering the modes I want everywhere by default with match-regex “.*” now no-script etc shows up on the list of enable modes

Quite a late fix it is, but well. Note that in your config you’re trying to configure two classes in define-configuration: web-buffer and buffer. If you want to do this, then the syntax you want is rather:

(define-configuration (buffer web-buffer)
  #| slot configuration... |#) 

In other words, define-configuration only considers two cases for configuration:

  • a single class name/symbol, or
  • a list of class names/symbols, wrapped into parentheses.
1 Like

And be aware that the latest state of master branch allows to use a mere force-https-mode instead of nyxt/force-https-mode:force-https-mode!

1 Like

Thank you! @aartaka what is the difference between buffer and web-buffer? I think I had only one, but then I added the second one just trying things I see in other people’s configs.

Ohh, so how will this work then on the init.lisp I am looking at your dot files for most of my examples and there it seems to be calling nyxt/force-https-mode:force-https-mode nyxt-config/init.lisp at master · aartaka/nyxt-config · GitHub

Well, buffer is the barebones one that most other buffers are based on, be it

  • editor-buffer for text editing,
  • prompt-buffer,
  • and a myriad of context-buffer, input-buffer and other feature-based buffer types.

But most of the time you’d need web-buffer, because that’s what you usually use browsing the Internet. Most of the settings usually scattered around buffer, input-buffer, context-buffer, document-buffer etc. are accessible in web-buffer, so this one should be the ultimate configuration point if you aim for convenience over conceptual correctness :slight_smile:

That strict symbol naming will work too, the change is backwards-compatible! \

My config is filled with all these prefixed symbols for the sake of correctness and portability over all Nyxt versions, starting from 2.2.4 and until the latest master. When we release 3.0 I’ll delete all the 2.* compatibility code and enjoy the fruits of civilization, including force-https-mode instead of nyxt/force-https-mode:force-https-mode :stuck_out_tongue:

1 Like