4. If the line $y=x-3$ is tangent to the curve $y=\mathrm{e}^{x+a}$, then the value of the real number $a$ is ( ).
(A) -4
(B) -2
(C) 2
(D) 4
4. A.

Let the x-coordinate of the tangent point be $x_{0}$. At $x=x_{0}$, the slope of the curve $y=\mathrm{e}^{\mathrm{x}+a}$ is $\mathrm{e}^{x_{0}+a}$, and the slope of the line $y=x-3$ is 1.
Thus, $\mathrm{e}^{x_{0}+a}=1 \Rightarrow x_{0}=-a$.
Therefore, the y-coordinate of the tangent point is
$$
\begin{array}{l}
\mathrm{e}^{x_{0}+a}=1=x_{0}-3 \\
\Rightarrow 1=-a-3 \Rightarrow a=-4 .
\end{array}
$$