  The commutation principle proved by Ram\'irez, Seeger, and Sossa (SIAM J
Optim 23:687-694, 2013) in the setting of Euclidean Jordan algebras says that
for a Fr\'echet differentiable function $\Theta$ and a spectral function $F$,
any local minimizer or maximizer $a$ of $\Theta+F$ over a spectral set
$\mathcal{E}$ operator commutes with the gradient of $\Theta$ at $a$. In this
paper, we improve this commutation principle by allowing $\Theta$ to be
nonsmooth with mild regularity assumptions over it. For example, for the case
of local minimizer, we show that $a$ operator commutes with some element of the
limiting (Mordukhovich) subdifferential of $\Theta$ at $a$ provided that
$\Theta$ is subdifferentially regular at $a$ satisfying a qualification
condition. For the case of local maximizer, we prove that $a$ operator commutes
with each element of the (Fenchel) subdifferential of $\Theta$ at $a$ whenever
this subdifferential is nonempty. As an application, we characterize the local
optimizers of shifted strictly convex spectral functions and norms over
automorphism invariant sets.
