Differential homogenous equation We have this:
$$y'=\frac{y}{x}+e^{-\frac{y}{x}}$$
The way to solve this equations (as I have learned) is to make the var. change $y=xu$, so you get a linear equation:
$$\frac{du}{f(1,u)-u}=\frac{dx}{x}$$
Being $f(x,y)=y'$
Now, when you have an equation with a no homogenous term $b(x)$, you can remove it, find a solution for the new equation, make the constant of that solution a function of $x$, substitute that solution in the initial equation and find what that function is. You couldn't do it with the above equation because the $e^{-\frac{y}{x}}$ is not a function of $x$ only. But if you do it, you will get to the solution $$y=x\log|\log|x|+k|,\;\;k\in\mathbb{R}$$
And this equation is a solution of the above, so the method works, why? Is it correct? I did it in an exam and I don't know if I did it right. Obviously the final solution is correct, I didn't bother to recheck the problem because I pluged it into the equation and it worked, but I don't know why this works.
Thanks in advance.

ADDED
Example asked by Babak Sorouh
$y'+2y=3x$ We remove the $3x$ and solve, the solution is $ce^{-2x}$, we make the $c$ a function of $x$ and substitute in the first one: $c'e^{-2x}=3x\Longrightarrow c(x)=3/2xe^{2x}-3/4e^{2x}+k;\;\;k\in\mathbb{R}$ Substitute the $c(x)$ in the solution for the equation without the $3x$, and you got it: $3/2x-3/4+ke^{-2x}$
 A: I don't think this will work for all cases.  What you have described is essentially the method for exact equations, but with the addition of integrating factors.  (If you have Boyce/DiPrima, it's on pg 99.)  There are condition(s) for the method of exact equations to work.
An exact equation is of the form:
$$M(x, y) + N(x, y)y' = 0$$
...where $M_y = N_x$.
So, if you have the DE (using your example):
$$y' + 2y - 3x = 0$$
This implies:
$$M(x,y) = 2y-3x$$
$$N(x,y) = 1$$
So, this is not an exact equation ($0\ne2$).   However, if $\frac{M_y - N_x}{N}$ is a function of $x$ only, there exists a factor to make the equation exact.  (I am leaving out the derivation of this.)  For this DE, $\frac{M_y - N_x}{N} = \frac{2 - 0}{1} = 2$, which satisfies the criteria.
Thus, we find our integrating factor as follows:
$$\frac{d\mu}{dx} = \frac{M_y - N_x}{N}\mu$$
$$\frac{d\mu}{dx} = 2\mu$$
$$\int\frac{d\mu}{\mu} = \int 2dx$$
$$\ln|\mu| = 2x$$
$$\mu = e^{2x}$$
So, multiplying through the original DE:
$$e^{2x}y' + (2y - 3x)e^{2x} = 0$$
Now, $M(x, y) = (2y - 3x)e^{2x}$, and $N(x, y) = e^{2x}$.  This equation is exact, as $M_y = N_x = 2e^{2x}$
Now solve using method for exact equations as usual.  (If needed I can demonstrate.  I don't think it adds much to the answer, though...)
