Any change to the variable is equivalent here, so just
M-x set-variable or
(setq THE-VAR A-NEW-VALUE) is sufficient.
The function called when you click
Set for Current Session is
custom-variable-set. (Well, actually it is more complicated - it boils down to calling either the value of
(get SYMBOL 'custom-set), where
SYMBOL is the option symbol or function
The advantage of using
Set for Current Session in the Customize UI is that you can use the Customize UI to edit the value - e.g., menus, completion, etc.
With the Customize UI there are thus two steps to changing a variable value:
- Edit the value.
- Set for session.
If you do not set the value (set for session) and you only edit it, then the variable value is not changed at all.
UPDATE, per comments:
In Customize, when editing the custom group, you can call function
custom-group-set on the widget for the group. In terms of existing keyboard key bindings, you can use
TAB to move to the
State button, then
RET to "push" the button.
Then you are shown a plain-text menu, with indications of number keys you can hit to choose one of the menu items. In this case, you hit
0 to choose the
Set for Current Session action. IOW, you can use keyboard keybindings to set the edited changes for a group in Customize.
Other key bindings in Customize:
C-c C-c for
Custom-set/[Set for Current Session]
C-x C-s for
Custom-save/[Save for Future Sessions]