Sokhotski–Plemelj theorem for the real line The Sokhotski–Plemelj theorem for the real line is stated at https://en.wikipedia.org/wiki/Sokhotski–Plemelj_theorem:
Sokhotski–Plemelj theorem.  Let $f$ be a complex-valued function that is defined and continuous on the real line, and let $a$, $b$, and $x_0$ be real constants with ${\displaystyle a<x_0<b}$. Then
$${\displaystyle \lim _{\varepsilon \to 0^{+}}\int _{a}^{b}{\frac {f(x)}{x-x_0\pm i\varepsilon }}\,dx=\mp i\pi f(x_0)+{\mathcal {P}}\int _{a}^{b}{\frac {f(x)}{x-x_0}}\,dx.}$$
I also gather from Confusion concerning the Sokhotski–Plemelj theorem: two different values for the same real integral that there is a more general version  of the theorem that is valid over the whole real line, so that, under some mild hypotheses on $f(x)$, one has
$${\displaystyle \lim _{\varepsilon \to 0^{+}}\int _{-\infty}^{\infty}{\frac {f(x)}{x-x_0\pm i\varepsilon }}\,dx=\mp i\pi f(x_0)+{\mathcal {P}}\int _{-\infty}^{\infty}{\frac {f(x)}{x-x_0}}\,dx.}$$
My question is: what (mild) hypotheses on $f(x)$ are sufficient for the more general version stated above to hold?  I'm also looking for a proof or appropriate reference.
 A: The first version also holds for $a,b\in\overline{\mathbb{R}}=\mathbb R\cup\{+\infty\}\cup\{-\infty\}$. The important part of the Sokhotski–Plemelj theorem is integrating around $x_0$ and not about the limits of the integral. It is not enough to say that $f$ must be continuous. The function also cannot have singularities neighborhood around $[a,b]$. Keep this in mind at the end result.
Proof: Define the contour $C=[a,x_0-\delta]\cup C_{x_0,\delta}\cup [x_0+\delta,b]$, where $C_{x_0,\delta}$ is a semicircular path of radius $\delta$ centered at $x_0$ with $\delta>0$. Then for $\delta\to0^+$
$$\int_C\frac{f(x)}{x-x_0}\,\mathrm{d}x=\mathcal P\int_a^b \frac{f(x)}{x-x_0}\,\mathrm{d}x+\int_{C_{x_0,\delta}}\frac{f(x)}{x-x_0}\,\mathrm{d}x.$$
Note that the contour $C_{x_0,\delta}$ can be parameterized as $x=x_0+\delta e^{i\varphi}$ for $0\leqslant\varphi\leqslant\pi$ or $-\pi\leqslant\varphi\leqslant0$. Taking $\delta\to0^+$,
$$\lim_{\delta\to0^+}\int_{\pm\pi}^0\frac{f(x_0+\delta e^{i\varphi})}{\delta e^{i\varphi}}i\delta e^{i\varphi}\,\mathrm{d}\varphi=f(x_0)\lim_{\delta\to0^+}\int_{\pm\pi}^0\frac{i\delta e^{i\varphi}}{\delta e^{i\varphi}}\,\mathrm{d}\varphi=\mp i\pi f(x_0).$$
We were able to pull the limit inside $f$, since it is by definition continuous on the real line. Assuming that $f$ has no singularities neighborhood around the interval $[a,b]$, we can deform the contour $C$ into a straight line, which runs from $a +i\varepsilon$ to $b+i\varepsilon$, so
$$\int_C\frac{f(x)}{x-x_0}\,\mathrm{d}x=\lim_{\varepsilon\to0^+}\int_{a\pm i\varepsilon}^{b\pm i\varepsilon}\frac{f(x)}{x-x_0}\,\mathrm{d}x=\lim_{\varepsilon\to0^+}\int_{a}^{b}\frac{f(x\pm i\varepsilon)}{x-x_0\pm i\varepsilon}\,\mathrm{d}x.$$
We may pull the limit inside $f$ again since the function is continuous on the real line. The end result is
$${\displaystyle \lim _{\varepsilon \to 0^{+}}\int _{a}^{b}{\frac {f(x)}{x-x_0\pm i\varepsilon }}\,\mathrm{d}x=\mp i\pi f(x_0)+{\mathcal {P}}\int _{a}^{b}{\frac {f(x)}{x-x_0}}\,\mathrm{d}x},$$
where $a<x_0<b$ and $a,b \in\overline{\mathbb{R}}$.
A: To make clear that the function $f$ need not be holomorphic: whether the integrals are over finite or infinite intervals, taking $x_0=0$ for simplicity of notation,
$$
\lim_\epsilon\int {f(x)\over x+i\epsilon}dx
\;=\;
\lim_\epsilon\int {f(x)-f(0)e^{-x^2}\over x+i\epsilon}dx + f(0)\lim_\epsilon\int {e^{-x^2}\over x+i\epsilon}dx
$$
$$
\;=\;
\int {f(x)-f(0)e^{-x^2}\over x}dx + f(0)\lim_\epsilon\int {e^{-x^2}\over x+i\epsilon}dx
$$
whenever ${f(x)-f(0)e^{-x^2}\over x}$ is locally integrable at $0$. The integral involving the Gaussian can be evaluated explicitly as a function of $\epsilon$. :)
