What is the canonical command to remove newlines within a paragraph? - emacs

Is there some command I am missing? Something like M-q (fill-paragraph)? Otherwise I do M-% C-q C-j Return Space Return.

The command you're looking for is unfill-paragraph; there's also unfill-region.

Related

Emacs lisp, How to make a newline in IELM?

Even the basic things seem to be hidden behind weird shortcut-combinations.
How can I (hopefully without too many c-m-x-c combinations) create a simple new line?
return evaluates the current line
With C-j. That said, if you have paredit enabled, it should do all the newlines you need automatically.
In my case it was M-j.
I'm currently trying out SpaceMacs, not sure if that has anything to do with it.
Even the basic things seem to be hidden behind weird shortcut-combinations.
If you don't want RET to have contextual behaviour, you can M-x customize-option RET ielm-dynamic-return.
How can I ... create a simple new line?
Only a newline? C-qC-j is the normal way to enter a newline in places where RET does something else. (More generally you can use C-q to insert any character that isn't self-inserting for the current buffer.)
If you want newline + indentation (which is what RET does when contextually appropriate), then M-j will do that (noting that if you are in a comment at the time then the new line will also default to a comment).

Is there a way to paste a right regex to the minibuffer after M-x isearch-forward-regexp

The right regex I copied:
\(.\)
What I pasted after M-x isearch-forward-regexp:
\\(\.\\)
Is there a way to solve that?
isearch-yank-pop causes the yanked text to be regexp-quoted if a regexp search is in progress. The assumption is that whatever you are yanking is text to find verbatim, and not part of a regexp.
The solution is to edit the search pattern (M-e), and then yank the text into the minibuffer (C-y).
What #phils said. (Yanking in vanilla Isearch during regexp search applies regexp-quote.)
If you use library Isearch+ then:
Whether that automatic regexp-quote-ing is done or not is controlled by option isearchp-regexp-quote-yank-flag.
You can toggle that option value anytime during isearch using C-` (command isearchp-toggle-regexp-quote-yank).

join all lines in a text file in emacs

I have a large text file. Each sentence is on a separate line and I ant to join them all together in emacs. DOes anyone know how to do this. Somebody has told me I can use M-^ but this only joins one line to the one above one at a time and I have hundreds of lines. Help!
You can replace newlines with an empty string. Move the cursor to the beginning of your file and execute this sequence
M-x replace-string C-q C-j RET RET
You can replace with query replace, pasting the newline.
mark/copy a newline
start at beginning of buffer
Alt-%
paste the newline and do enter. (for me the buffer says Query replace ^J with: )
type space + enter
type ! for accept all or y/n for accept/reject per match

How to replace '_' by space in emacs

I have a text file which I am only able to look that there is an underscore between some words only using emcas editor but not other editors such as vi. I do not know how to use emacs but I wanted to replace these underscores "_" by space in the emacs editor automated fashion. How can I do that ?
I believe that those underscore aren't really underscore, but non breaking space (U+00A0 unicode char), that Emacs show as underscore with a different color. You probably don't need to replace them, but if this is really needed, just use M-x replace-string and kill and yank one of those non-breaking space in the string to be replaced.
Hit the M-x key-combination (that is, hold meta key - alt on windows - and hit x) type replace-string and hit enter. You can then type [underscore] enter [space] enter.
In Emacs notation:
M-x replace-string RET _ RET " "
Should the previous answer not solve it: Remember that as a coding system error. Check with C-x = if it's char 95.
If not, check variables coding-system-for-read, coding-system-for-write, buffer-file-coding-system
Finally, get emacs core developers at help-gnu-emacs#gnu.org

How to replace space character with line break(LF) in emacs?

I want to use "replace-string" command to achieve this function,
but how to type in "LF" character?
it's confuse me so much...
You can use C-q C-j to search/replace a newline