Usually, I do the following to change a variable's value:

1 - I execute the command set-variable

2 - I pick cider-shadow-cljs-command

3 - I tweak the value changing it to be "shadow-cljs"

It works. However, it is painful to do this every time. Thus, I would like to make the changes persist over time.

Hence, I edited my init.el file to have the following snippet:

(add-to-list 'cider-shadow-cljs-command "shadow-cljs")

Unfortunately, if I restart Emacs, an error is retrieved:

Warning (initialization): An error occurred while loading /Users/pedro/.emacs.d/init.el: Wrong type argument: listp, npx shadow-cljs

This is the original value:

(defcustom cider-shadow-cljs-command
  "npx shadow-cljs"
  "The command used to execute shadow-cljs.

By default we favor the project-specific shadow-cljs over the system-wide."
  :type 'string
  :safe #'stringp
  :package-version '(cider . "0.17.0"))

How can I fix this? Should I use a different command than add-to-list?

2 Answers 2


You're using set-variable interactively, not add-to-list, so I think the corresponding elisp code would be either:

(setq cider-shadow-cljs-command "shadow-cljs")


(customize-set-variable 'cider-shadow-cljs-command "shadow-cljs")

The setq only works if you run that after cider is loaded, and the customize-set-variable will work even if you run it before cider is loaded (it is meant for defcustom variables), so I would recommend customize-set-variable in this case.

  • Thanks! Is setq permanent across different sessions of Emacs? After I quit and re-start is it still going to hold the value? Commented Aug 28, 2022 at 17:58
  • You put these forms in your init.el and then they will persist! Commented Aug 28, 2022 at 18:12

add-to-list expects the value of its first argument to be a list. You're passing it symbol cider-shadow-cljs-command as first arg, and the value of that variable is a string, not a list.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.