I save the variable in .dir-locals.el
like this:
(add-dir-local-variable 'nil 'CurrentProjectStat CurrentProjectStat)
(save-buffer)
(kill-buffer)
When I upload a file with a given project, this variable is loaded only for this buffer, but I need it to be loaded globally. I use this variable in the form of widgets, this is a different buffer, and this variable is no longer there.
I do not know in which direction to look, overriding the variable does not help.
Tell me please how to make such a variable global?
For the sake of answering the question as stated:
You can use the pseudo-variable eval
to evaluate arbitrary code, and therefore set a non-local variable (assuming the variable is not already buffer-local), like so:
((nil . ((eval . (setq GLOBALVAR VALUE)))))
I strongly doubt that this is actually what you want to do, however.