How do I programatically set a Custom variable in Emacs Lisp?

customize-set-variable is what you want, not custom-set-variables (no need for that here).

And in general it is a good idea to also take a look at the defcustom for the variable (user option), to see what its :set slot does etc. Not necessary, but good to know before you try to set the value programmatically.

This reply to a [email protected] question might also help: http://lists.gnu.org/archive/html/help-gnu-emacs/2013-08/msg00544.html


Update:

You later edited your question to also ask about saving the new value. For that you can use customize-save-variable. It sets and saves the new value.