Questions about editing or manipulating text inside of Emacs.
Questions tagged [text-editing]
214 questions
61
votes
5 answers
What options are there for writing better non-programming text in Emacs?
This is a fork from the question What options are there for doing spell-checking in Emacs?
Because I'm currently doing a lot of non-programming tasks in Emacs I'm wondering whether Emacs can support me in writing better texts.
So, let's open with…

elemakil
- 2,517
- 1
- 18
- 26
45
votes
7 answers
How to add a prefix to every line?
I have the code below:
Hello
There
I am some code
And want to add code in front of it, like:
I said Hello
I said There
I said I am some code
So how would I add a prefix to each line?

programking
- 7,064
- 9
- 41
- 62
34
votes
6 answers
Opposite of fill-paragraph
Emacs has the function fill-paragraph. Is there any function which will do the opposite of that?
I have a paragraph which is already filled and instead I want it in a plain single line?

Sibi
- 3,603
- 2
- 22
- 35
24
votes
3 answers
Fixing DOuble CApitals as I type
I have a bit of a slow pinky. As my other fingers get faster and
faster at typing, my pinky just can't keep up. This frequently leads me to type sentences whose first word starts with two uppercase
letters. Here's a short example.
THere's nothing in…

Malabarba
- 22,878
- 6
- 78
- 163
23
votes
6 answers
How to delete the first few n chars of every line?
I recently asked:
How to add a prefix to every line?
So go from the code below:
I said Hello
I said There
I said I am some code
To code like:
Hello
There
I am some code
Now, how do I delete n number of characters from a line?

programking
- 7,064
- 9
- 41
- 62
21
votes
2 answers
Removing smart quotes automatically
Especially when copying text from things like Google docs, I would like Emacs to automatically remove smart double quotes, smart single quotes, and all manner of em-dash and en-dash characters, replacing them with their ascii equivalents.
Is there a…

Lee H
- 2,697
- 1
- 16
- 31
19
votes
4 answers
What is the usefulness of `exchange-point-and-mark`?
The exchange-point-and-mark command is bound to C-x C-x, but I cannot think of any use cases that would make it deserving of such a prominent binding.
How can I use the exchange-point-and-mark to improve my editing technique?

Matthew Piziak
- 5,958
- 3
- 29
- 77
18
votes
2 answers
How to act on rectangles beyond the end-of-line?
Here's what Vim's documentation has to say about it:
Virtual editing means that the cursor can be positioned where there is
no actual character. This can be halfway into a tab or beyond the end
of the line. Useful for…

nanny
- 5,704
- 18
- 38
17
votes
2 answers
Compose key in Emacs: is undefined
I set the Alt Gr key on my keyboard as compose key in my system (Ubuntu 14.04) in order to type letters like éóèàùçü and so on. But when I am on Emacs and try to press the Alt Gr key, I have a message saying that:
is undefines
Ho can…

petrux
- 665
- 1
- 5
- 18
13
votes
3 answers
How to transpose two arguments of a function in Python?
How I can I swap two arguments in a call to a Python function?
If I put point on the space between these two arguments:
self.assertEqual(json.loads(some.data), json_data)
and then M-t (transpose-words), I…

Croad Langshan
- 3,192
- 14
- 42
12
votes
1 answer
How do I delete all blank lines in a buffer?
Emacs 26.1
In buffer
1
2
3
4
I use command "delete-blank-lines". But it NOT delete ALL BLANK LINES. It's delete ONLY ONE BLANK LINE.
Why?
I need to delete ALL BLANK LINES.
The result must be like this:
1
2
3
4

a_subscriber
- 3,854
- 1
- 17
- 47
12
votes
4 answers
Hightlighting all occurances of selected text
Within Visual Studio and Notepad++, when I select a symbol (using the shift key or mouse), other occurrences of it within the buffer are also highlighted in another color.
When editing JavaScript or AutoHotkey or any other dynamic language where you…

Tahir Hassan
- 285
- 2
- 9
11
votes
3 answers
What is the difference between refill-mode and auto-fill-mode?
I tried to read the documentation, but in practice, I could not tell the difference. I feel they are doing the same thing. I can turn both modes on, but I am not sure in what circumstance I need to do so.

Tianyi
- 111
- 3
11
votes
3 answers
How to wrap given text around region
I often have a situation where I need to apply text around a region. For HTML and simple cases there are libraries for this already. But what about the general case? I'd like to be asked what I'm gonna insert beginning and end of the region.

mike3996
- 463
- 4
- 15
11
votes
1 answer
unicode.txt slowness
Moving around point (using the cursor keys) in Xah’s unicode.txt in fundamental-mode is noticeably slower than in an ordinary text file. Are the many non-ASCII characters the issue? Anything else?
About: GNU Emacs 25.2.1 (x86_64-w64-mingw32) of…

feklee
- 1,029
- 5
- 17