How to integrate following indefinite integal? The integral is 
$$
\int\frac{x-\sin x}{1-\cos x} \,dx
$$
However, the only guess I have is that the denominator is the derivative of the numerator. Probably the integration by substitution will work here?

$$\begin{align*}
\int\frac{x-\sin x}{1-\cos x}dx
&= \int \frac{(x-\sin x)(1+\cos x)}{(1-\cos x)(1+\cos x)}\ dx \\
&= \int \frac{x + x\cos x - \sin x -\sin x \cos x}{1-\cos^2 x}\ dx\\
&= \int (x\csc ^2 x + x \cot x \csc x - \csc x - \cot x)\ dx\\
&= -\int x\ d(\cot x) - \int x\ d(\csc x) - \int \csc x\ dx - \int \cot x\ dx\\
&= -x \cot x + \int \cot x\ dx - x\csc x + \int \csc x\ dx  - \int \csc x\ dx - \int \cot x\ dx\\
&= -x \cot x - x\csc x + C\\
&= -x(\cot x + \csc x) + C
\end{align*}$$
