Integrating $\int \frac{e^{ikx}}{x} dk$ by parts to get delta function derivative, how to handle undefined boundary terms? I'm going through Sergio Dutra's Cavity Electrodynamics: The Strange Theory of Light in a Box. In equation (2.31) he computes:
$$\begin{aligned}\langle x|\hat{p}|x'\rangle&=i\hbar\int\frac{dk}{2\pi}\frac{e^{i(x-x')k}}{x-x'}\\\\ &=-\frac{i\hbar}{2\pi}\int dk\,e^{i(x-x')k}ik \\\\ &=\frac{\hbar}{i}\frac{\partial}{\partial x}\delta(x-x').\end{aligned}\tag{2.31}$$
The author claims that the second line arises via integration by parts, but I can't quite see how.
With integration by parts we have
$$\int_a^b u dv = uv\rvert_a^b-\int_a^b vdu.$$
I assume we take
$$u=\frac{e^{i(x-x')k}}{x-x'},\;dv=1.$$
This gives
$$i\hbar\int\frac{dk}{2\pi}\frac{e^{i(x-x')k}}{x-x'}=\left.\frac{i\hbar}{2\pi}\frac{e^{i(x-x')k}}{x-x'}k\right\rvert_{k=-\infty}^{k=+\infty}-\frac{i\hbar}{2\pi}\int dk\,e^{i(x-x')k}ik.$$
If the boundary term vanishes, then I recover Dutra's derivation. However, I can't see why the term term should vanish. We have an increasing function $k$, multiplied by a complex oscillation, so the limit is not defined. Why should we take this to be zero, rather than some other constant? I understand that something weird must be happening, since the result is a distribution rather than a function.
EDIT: So having looked at some other answers on this site, my understanding that Dutra's derivation here isn't valid. As QMechanic says dividing a distribution by $x$ isn't defined. This stackexchange answer shows that the expression $\delta(x)/x$ can be manipulated to give multiple different answers.
 A: Let's throw rigor aside and look at the pertinent term as a functional acting on a test function, in other words consider
$$\int dx f(x)\left[ \frac{k~e^{ikx}}{x}\right]^{\infty}_{-\infty} = \left[k\int dx\frac{f(x)}{x}e^{ikx}\right]^{\infty}_{-\infty}$$
Assuming that $f(x)/x$ has a fourier transform and that it vanishes at infinity faster than $1/k$, the above integral vanishes.
A: *

*Ref. 1 heuristically justifies the first equality in eq. (2.31) by starting from the correct equation
$$ (x-x^{\prime})\langle x|\hat{p}|x^{\prime}\rangle~=~i\hbar\delta(x-x^{\prime}),\tag{2.30}$$
and dividing both sides with $x-x^{\prime}$.


*However the expression
$$ \frac{1}{x-x^{\prime}}\delta(x-x^{\prime})$$
is mathematical ill-defined in distribution theory, so the manipulations in eq. (2.31) does not make much mathematical sense.


*Nevertheless, the resulting relation LHS=RHS in eq. (2.31) is actually true, e.g. by using the Schrödinger representation for $\hat{p}$, as proven in many posts on this site.
References:

*

*Sergio Dutra, Cavity Electrodynamics: The Strange Theory of Light in a Box, 2005.

