How to find integral of the form $e^xf(x)$?

I always face trouble with these type of integrals.

I need to find $$\int{e^x \frac{x(\cos x -\sin x)-\sin x}{x^2}}dx$$

My problem would be solved if can express $f(x)$ like $g(x)+g'(x)$ but identifying $g(x)$ by trial and error method is sometimes tedious.Is there any easier approach?


As already said in comments, I do not think that there is a solution in terms of elementary functions.

However, the problem can be approached using $$\cos(x)=\frac{1}{2} \left(e^{i x}+e^{-i x}\right)\qquad \sin(x)=-\frac{1}{2} i \left(e^{i x}-e^{-i x}\right)$$ So, the numerator of the integrand becomes$$\left(\frac{1}{2}-\frac{i}{2}\right) e^{(1-i) x} x+\left(\frac{1}{2}+\frac{i}{2}\right) e^{(1+i) x} x-\frac{1}{2} i e^{(1-i) x}+\frac{1}{2} i e^{(1+i) x}$$ and we are then left with integrals looking like$$I=\int \frac{e^{\alpha x}} x \, dx\qquad J=\int \frac{e^{\alpha x}}{x^2} \, dx$$ Changing variable $\alpha x=y$ then makes $$I=\int \frac{e^y}{y}\,dy=\text{Ei}(y)$$ $$J= \alpha\int\frac{ e^y}{y^2}\,dy=\alpha \left(\text{Ei}(y)-\frac{e^y}{y}\right)$$ where appears the exponential integral function (for the computation of $J$, one integration by parts is needed).

Using these last results and back to $x$ $$\int{e^x \frac{x(\cos x -\sin x)-\sin x}{x^2}}\, dx=i \Big(\text{Ei}((1+i) x)- \text{Ei}((1-i) x)\Big)+\frac{e^x \sin (x)}{x}$$

Edit

Looking at $$\int e^x\frac{ x (\cos (x)\pm \sin (x))\pm \sin (x)}{x^2}\,dx$$ the only combination which leads to elementary functions is the combination $(+,-)$ and then $$\int e^x\frac{ x (\cos (x)+ \sin (x))- \sin (x)}{x^2}\,dx=\frac{ \sin (x)}{x}e^x$$ So, one more typo in a textbook.