Nice point! I agree that it's a bloated method, however, this was the best solution I could come up with at that point of time. I am certain that there are better solutions, it's just me who could not find it. I went with this solution anyways since it was still an improvement compared to my previous method in vim which involved setting the text width to a large number like 9999, highlighting the text I wanted to unwrap and then typing 'gqq' for formatting, and then yanking it. And of course, I had to re-wrap the text if I wanted to maintain the original format of the text file.
You are absolutely right and I understand what you mean though. I am open to trying other alternatives and I should try to come up with a better method to workaround this problem.
Never tried Emacs, just went with Vim so far. Did not know that Emacs had already an elegant solution for this problem. Nice! :)