The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [text-editing]

Questions about editing or manipulating text inside of Emacs.

Filter by
Sorted by
Tagged with
2
votes
1answer
95 views

How to know the first and second level heading above the cursor?

I'm editing a 4.7M pure-text document, the task is simple, every book have chapters, and every chapter have each of its lines enumerated at the begin of the line, what I'm doing it putting the name of ...
9
votes
1answer
217 views

make `delete-duplicate-lines` ignore blank lines and certain words

I'm editing a text in org-mode, several lines are repeated since they where part of different files from the same topic. I want to use delete-duplicate-lines to delete the repeated lines, however, ...
10
votes
1answer
1k views

How to right align region and/or line?

We can center text with M-x center-region and M-o M-s. Is there something similar for right-alignment? Example before: Item 0: value | Item 100:...
11
votes
3answers
1k views

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 ...
18
votes
2answers
956 views

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, ...
5
votes
2answers
257 views

Define an emacs function to take arguments in the same way as something like M-x goto-line

I want to write an emacs function for debug purposes in c++ code. Basically I'm fed up typing the following: std::cout << "variable is: " << variable << std::endl; Instead I want ...
16
votes
1answer
411 views

Is there a 'local undo' extension for Emacs?

It happens quite often that I want to undo changes locally or line-wise. For example, when I change multiple lines in a source code and I want to revert only one of them, then I have to step through ...
3
votes
2answers
85 views

How to copy or move code in current scope to end of another file

I find myself refactoring code fairly frequently and my screen space is at a premium. I'd like to be able to move to a particular scope (class, function, or even if-statement/for-loop blocks) and ...
25
votes
6answers
2k views

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?
6
votes
3answers
646 views

How to insert a specific number of newlines in org-mode

Inside org-mode, RETURN is bound to (org-return &optional INDENT). This command apparently ignores C-u numeric prefixes and so if you want to enter 10 newlines, you can't just type C-u 1 0 RET and ...
3
votes
1answer
109 views

Swap columns in a mediawiki table

I have a mediawiki table with three columns and some rows, eg.: {| class="sortable" ! Column header (one) !! Middle column !! Last column |- | value 1 || loong value ... and some more || another ...
32
votes
10answers
7k views

Kill or copy current line with minimal keystrokes

I do C-a C-k C-k to kill the entire line point is on. If I want to copy the line instead of killing it, I can hit C-/ C-/ right after typing the sequence above. Alternatively, I can do C-a C-SPC C-...
8
votes
4answers
2k views

copy contents of current buffer in a temp buffer and operate on that

I need to copy the contents of the current buffer to a temp buffer, set that buffer to a particular major mode to take advantage of its benefits and get the information I need back to the main logic. ...
58
votes
5answers
6k views

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 ...
8
votes
1answer
245 views

Prevent inserting text at the beginning of a buffer that starts with read-only text

I'm extending an existing Emacs package and I want to make a part of the buffer not editable (read only). In fact, I want to make only one line in the middle of the buffer editable and I use the ...
8
votes
2answers
543 views

How to insert text after point?

I'd like to insert (programmatically) some text right after the point (without moving it). I came up with this: (save-excursion (insert "my text")) It seems to work. Is it a good way to do what I ...
5
votes
1answer
191 views

How to make sure currently selected text gets deleted when typing new text?

When editing text, editors' usual behaviour is to replace selected text with the next text. In Emacs, when text is selected and you enter new characters, the new text gets inserted at point, leaving ...
14
votes
1answer
882 views

How to view and edit large delimiter separated value files?

I have been using csv-mode to modify small to medium sized CSV files, but recently I have been working with large files containing more than 40,812 entries. csv-mode struggles to align and navigate ...
31
votes
5answers
3k views

Is there a way to use query-replace from grep/ack/ag output modes?

I'm aware of find-grep-dired, marking the corresponding files and then pressing Q to run dired-do-query-replace-regexp on the marked files. Unfortunately that requires restarting the grep and no ...
15
votes
6answers
3k views

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 ...
35
votes
7answers
5k views

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?
8
votes
4answers
485 views

Fastest way to move code block to specific line

Say you have code on lines 4, 5, 6. Then you want to move this block of code to starting point line 9 while also deleting lines 4, 5, 6. What's the fastest way, i.e. least amount of key strokes, to ...