Questions tagged [text-editing]

Questions about editing or manipulating text inside of Emacs.

Filter by
Sorted by
Tagged with
3
votes
3answers
872 views

Make evil-mode more lisp friendly?

I'm asking for several tips to make editing lisp like languages in evil mode better. In particular there is one feature that I would really like but couldn't manage to get it to work. For example ...
3
votes
1answer
403 views

Auto-indent without creating indentation in empty lines

Is there a way to use auto-indentation in Emacs without creating indentation on empty lines? For an example from C, if I have if (true) { printf("word"); } and then insert a newline after the ...
1
vote
1answer
111 views

Does “Edit with Emacs” saves a local file of current edit buffer?

I'm using Edit with Emacs to edit Stack Overflow and Stack Exchange sites. Currently I'm doing it with this message ;-) When I click on the button under the text area of Chrome browser, I get a new ...
1
vote
1answer
234 views

How to “auto” repeat evil-yank?

I'm not from a vim background so I remap a lot of the evil commands and keys to fit my needs. I know you can use evil-repeat but I like the following better to quickly kill a few lines: (defun evil-...
1
vote
1answer
438 views

How to delete word in next line with evil-mode?

I use evil-mode (from spacemacs) and I get a strange behaviour which I'm not sure if it is right or a bug. If I delete words (with dw, i think it calls evil-delete), it works until I arrive at the ...
3
votes
2answers
2k views

How can I kill a line after a certain character?

Each line in my file has a character ; followed by information that I want to delete. What is the best way to do it? Example: I like phat beatsies; but Mark does not like them I also like dogsies; ...
17
votes
1answer
2k views

How to automatically create neat C comment blocks while typing?

Some code editors such as eclipse automatically form neat blocks when you start typing a multi-line comment: Is there some package or another way to do this in emacs too? Edit: To clarify: I do not ...
12
votes
9answers
1k views

How to edit elisp without getting lost in the parentheses

I'm modifying some elisp code from linum.el: (custom-set-variables '(linum-format 'dynamic)) (defadvice linum-update-window (around linum-dynamic activate) (let* ((w (length (number-to-string ...
8
votes
4answers
4k views

Replace text inside various delimiters (eg: brackets, quotes)

I often do some testing implementation with hardcoded values which I later want to change. Like ref = open('specific-file-name') Which I would like to change into ref = open(fname) I'm used to vim ...
22
votes
3answers
1k views

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 ...
0
votes
1answer
69 views

How to search and replace a number starting with 0?

I know how to do a normal search and replace ,but say for instance that I want to replace all numbers in a buffer that starts with a 0 and the second number is a generic number, how do I match that ...
5
votes
1answer
668 views

How do I get a TOC sidebar of my current buffer?

I would like to write in markdown mode for example and then have a sidebar that shows me a table of contents of the buffer I am currently in.
9
votes
3answers
1k views

How do I outline/hide/show text when writing prose?

I want to use Emacs to write prose (specifically, fiction). I have used Scrivener and Ulysses in the past but I am not happy with them. I want to try Emacs, but don't know how to replicate the ...
3
votes
2answers
169 views

how to do action on *next* word?

Is there a function (or some kind of prefix command) that will allow me to do an action to the next word I type, not the word under point or the region? Currently: upcase-word puts the word under ...
1
vote
0answers
102 views

Unbalanced quotes auto-inserted in AUCTeX mode

This seems like it should be a very basic question, but I cannot find an answer anywhere. When writing in AUCTeX mode the auto-inserted paired quotation marks are now unbalanced. That is, when I ...
16
votes
4answers
1k views

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 ...
5
votes
1answer
64 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 ...
1
vote
1answer
177 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 ...
2
votes
1answer
201 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. ^ ...
2
votes
1answer
280 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 ...
3
votes
2answers
173 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 ...
4
votes
2answers
203 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 ...
4
votes
2answers
322 views

Automatically replace C++ operators

In some projects I'm working with, there are coding rules that don't allow C++ operators such as == (for fear of being confused with = I suppose, but oh well...). Instead, special macros such as _EQ_ ...
11
votes
3answers
1k views

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-...
10
votes
3answers
384 views

Editing multiple source blocks in one buffer

I've got multiple source blocks which are all tangled to the same file. When I invoke C-c ' inside one block, only this specific block is shown in a new buffer. Is there a possibility to show all ...
13
votes
1answer
2k views

How to edit crontab directly within emacs when I already have emacs open?

I know I can set the EDITOR variable and edit my crontab with emacs but that requires starting the process from a shell with $ crontab -e My question is how can I directly modify my crontab if I'm ...
2
votes
1answer
246 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
72 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 ...
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 ...
2
votes
3answers
747 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, ...
5
votes
4answers
431 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
203 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 ...
3
votes
4answers
815 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,...
2
votes
2answers
560 views

How can I make backward-kill-word stop at special character such as paratheses and line breaks?

Is it possible to change the behavior of backward-kill-word (bound to M-DEL by default) to stop at special characters? Quite often it deletes parentheses and line breaks against my will.
0
votes
1answer
354 views

Remove linebreak arrow and move last word to next line

When I write text in the emacs editor and the text reaches the right border of the program, emacs continues on the next line and puts an arrow on both sides of its borders. I want to know if its ...
4
votes
3answers
118 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 ...
7
votes
2answers
318 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
31 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 ...
3
votes
1answer
186 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 ...
8
votes
1answer
146 views

Editing a string with lots of escape characters

Let's say I'm editing my config file and there is a very long string like this: (setq my-string "very\nlong\nstring [...] \"hello world\"") How do edit the string without the escape characters (and ...
10
votes
3answers
935 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 ...
4
votes
2answers
125 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 ...
11
votes
2answers
1k views

How can I draw pixel- or vector-based UI elements in Emacs?

With that I mean UI elements (for example text fields and animated buttons) that are not restricted to the monospaced character grid of terminal emulators, but can be arbitrary shapes at arbitrary ...
6
votes
1answer
391 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 ...
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
1answer
94 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, ...