stumpwm/stumpwm-contrib

module variables not getting set

yusi1 opened this issue · 6 comments

yusi1 commented

I have a module called productivity and it needs some variables to be set that are defined in the source for the module with defvar, but when I go into the StumpWM REPL C-w : in my setup, StumpWM says the variable is undefined, even though I loaded the module in? Also that means I can't set the variable to something because it doesn't exist in the first place, shouldn't the variables defined in the module source get loaded in when I load the module in, in my init file?

For some reason I have to go into the source code for the module and directly change the variables there, but changing them in the init file doesn't work, it is very weird.

Maybe it is something wrong with my system, idk.

@yusi1 Most likely the issue is that you are not referring to the write symbol, try using the qualified symbol name by using :, ej. productivity:*productivity-mode-is-on*

yusi1 commented

So I tried doing:

(setf productivity:*productivity-keys*
      '(("C-w" *root-map*)))

But StumpWM says the symbol is not in the package? Very weird, because it is.

yusi1 commented

But I tried in the REPL:
C-w h v and then I did productivity:*productivity-keys* and it says it is defined, but it still says the old value?

yusi1 commented

So I tried to actually set the variable through the REPL but StumpWM says:
The symbol "*PRODUCTIVITY-KEYS*" is not external in PRODUCTIVITY package.

yusi1 commented

Ok, so I've managed to fix my problem, instead of using a single colon, I used two colons before the variable since it is an unexported variable, now productivity mode picks up the variable from my init file, I read this StackOverflow post that helped me understand what was going on: https://stackoverflow.com/questions/8567155/why-colons-precede-variables-in-common-lisp

yusi1 commented

I opened this pull request to change this in the README for the module so that no one else comes across this problem: #253