Questions tagged [text-editing]

Questions about editing or manipulating text inside of Emacs.

Filter by
Sorted by
Tagged with
5
votes
1answer
66 views

Is there a built-in or package solution for managing references in text files?

I'm currently writing up a design document and I want to include a number of references to external documents/URLs. I can manually add reference brackets and links so that: See the external file blah....
13
votes
3answers
1k views

Move form up and down on paredit mode

I've been using cursive's Structural Editing (a paredit-like mode for Intellij and Cursive) and I found a nice command there called move form-up (and down). Move form up does this (the | is the ...
3
votes
2answers
180 views

Equivalent of Sublimes text expansion

I am trying to move from Sublime to Emacs. (Because free and all that.) One thing that I miss is the convenient text expansion available by default in Sublime where it picks up similar strings in the ...
2
votes
1answer
292 views

Executing emacs shortcuts when keyboard is set to Greek

Writing Greek in emacs is proving to be quite inconvenient. If my keyboard is set to Greek, normal shortcuts do not work and I have to switch to latin just to navigate around the buffer. As an ...
2
votes
1answer
213 views

How does “transpose-sentences” work?

How does M-x transpose-sentences work? I tested it by executing the command with point at various places (as indicated) in the following: this is sentence 1. this is sentence 2. this is sentence 3. ^ ...
1
vote
1answer
188 views

Kill a line deletes the line but leaves a blank newline character

On deleting a line in Emacs using C-k, Emacs removes the line contents but it leaves a blank newline character. To remove this, I again press C-k. How can I delete the complete line with no traces ...
8
votes
1answer
253 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 ...
4
votes
2answers
220 views

how change behavior of kill-sentence based on position in sentence?

I'd like to modify the behavior of kill-sentence (which I have bound to M-k) according to context, in the following way: If the point is at the beginning of a sentence, then kill the sentence in the ...
19
votes
2answers
1k 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, ...
3
votes
1answer
191 views

Moving line with move-text-up doesn't move point

Disclaimer: I'm using Emacs Prelude, but I don't think this is a problem of that specific distribution. Some time ago I discovered that pressing M-S-up or C-S-up with no selection just swaps the line ...
2
votes
1answer
262 views

Can you mark-word backwards?

There is a very convenient function M-@ Mark-word. However, I usually find my self typing things, than marking things backwards to copy it some place else. Is there something equivalent for mark-...
2
votes
1answer
76 views

How to wrap yanked text

In org-mode if I am typing the lines will wrap to the next line at around 70 characters. However if I yank text from the OS clipboard into the org-mode buffer, then the text will not wrap but be on ...
10
votes
3answers
1k views

Repeat last text insert

In Vim you can press . to repeat the latest change, including inserting text. While in Emacs C-x z only repeats the last command. I am aware that macros can be used here, but more than often I ...
1
vote
1answer
108 views

Regexp not working

I messed up my latex code; I need to replace \cite[42]{source}. with .\cite[42]{source} and \cite{source}. with .\cite{source}. I tried \\cite\(.*\)\}\. -> .\\cite\1\} but I got an error: Invalid ...
13
votes
2answers
2k views

Compose key in Emacs: <Multi_key> 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 ...
2
votes
3answers
809 views

Replacing columns in a delimited region of a file

Suppose I have a section in a file which is in csv form, e.g. a1, bbb1, cc1, ddd1, ee1 aa2, b2, ccc2, dd2, e2 aaa3, bb3, c3, d3, ee3 aa4, b4, cc4, ddd4, eee4 Then, ...
4
votes
3answers
119 views

How can I normalize sentence-endings?

Say I have the following text: A. U. Thor writes: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam est elit, pulvinar sit amet erat nec, finibus sagittis ex. Mauris dictum elementum ...
5
votes
4answers
453 views

Add a constant decimal value to a column of numbers

Suppose I have a file containing the following: ATOM 10 H5 LIG 1 -0.684 2.034 0.000 1.00 0.00 ATOM 11 C1 LIG 1 0.974 0.686 0.000 1.00 0.00 ATOM 12 H1 ...
4
votes
4answers
218 views

Append region to the end of the lines of another region of same length

Here are two cases i am interested in: Case 1: lines of identical length Given some lines const int name1 const int name2 const int name3 const int name4 and some other lines = 1 = 2 = 3 = 4 I ...
9
votes
1answer
218 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, ...
3
votes
4answers
882 views

Reshape a list into rows

I am looking for an easy way to turn a list such as this: one, two, three, four, five, ... into something more like this: one, two, three, four, five, six, seven, eight, nine,...
6
votes
3answers
688 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 ...
36
votes
7answers
6k 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?
7
votes
2answers
350 views

GROUP BY + COUNT over lines in a region

What is the simplest way of getting the number of distinct repeated in a region? For example, from THIS IS LINE A THIS IS LINE A THIS IS LINE A THIS IS LINE B THIS IS LINE B THIS IS LINE C I would ...
1
vote
0answers
35 views

How to remove line breaks but retain paragraphs [duplicate]

I have fill-column set to 75 by default and use fill-paragraph to insert line breaks in the paragraphs of text that I write. On certain occasions though, I need to remove the line breaks but want to ...
4
votes
2answers
131 views

Hi-lighting common grammar mistakes in all prose across modes with English text

I already make extensive use of flyspell-mode to keep my errant spelling in check. However I'm currently trying to break the bad habit of using "it's" for possessive statements. I've had a brief look ...
6
votes
1answer
420 views

how to move region to other window?

How can I automatically move selected to the other window? Trying to streamline my split-window workflow. Here's what I have so far. Doesn't work yet. (defun move-region-to-other-window (start end)...
16
votes
2answers
1k views

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 ...
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 ...
5
votes
2answers
271 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 ...
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 ...
16
votes
1answer
431 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 ...
14
votes
1answer
911 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 ...
3
votes
2answers
90 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 ...
15
votes
6answers
4k 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 ...
8
votes
4answers
517 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 ...
3
votes
1answer
115 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 ...
7
votes
2answers
593 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 ...

1 2 3 4