Here is my problem:
I often copy text from a PDF (let's say one that is nicely formatted or scanned cleanly) and like to post it in an active org-mode file I have for academic research. However, pasting it with
C-y typically inherits a lot of the new lines that PDF text tends to carry, requiring me to fix the text manually.
I've checked around for a solution to this problem, but the closest I found was a previous question on overflow, but it only works partially. It requires that I select the newly pasted text with
C-x C-x, call
C-q C-j RET RET.
This typically removes most of the new lines effectively, but will often eliminate the space between two words that were on the end of the previous line and the first on the next (example would be 'betweentwo' in this sentence).
Any common fix to this? If possible, I would like a general solution that allows me to paste text from any source as simply plain text. I'm using Linux and emacs 24.5 for clarification. I don't think any of my own configurations are in conflict, but if my init file is wanted, I can post that on request.
EDIT: Pictures to show the problem.
Here's sample text of a pdf I want to copy. It's either a direct PDF export or a very clean scan, so I have no problem copying text accurately to my clipboard (No incorrect words, symbols, etc).
Here's what it looks like pasted
C-y in emacs (org-mode on). Notice how it doesn't just let the lines wrap naturally. This is actually a cleaner yank than most, but the problem is still present.
Here's what it looks like after I use the make-shift method I linked in the original post. As of now, I'm re-highlight the region with
C-x C-x and then use
ispell-region to methodically correct the words combined together.
Solution: YoungFrog's answer below clarified my problem. TL;DR,
M-q, fill-column, does well to reformat the text I yank from PDFs into paragraphs of length determined by emacs'
fill-column (70 by default).
In addition, I was using
visual-line-mode, which can make
fill-column look like it's not working right since the minor-mode is intended to visually wrap text with "soft new lines", as YoungFrog also pointed out.
A useful package that combines
visual-line-mode with the formatting benefits of
visual-fill-column, available on MELPA.