A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

Questions tagged [text-editing]

Questions about editing or manipulating text inside of Emacs.

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

How can I use Emacs in a SSH sever that I logged in through emacs terminal?

I really like the emacs terminal but each time I use it to log into my server. I don't know how to use emacs to edit files on the server. Or it is not possible to do it? I can only edit files on ...
1
vote
0answers
34 views

“Mark all Misspellings” never stops

On my Emacs (Aquamacs on OSX, latest version) the command Edit -> Spelling -> Mark All Misspellings goes through the whole file (from 0% to 100%) and then starts again at 0%, and continues ad ...
5
votes
1answer
934 views

Drag selected text with the mouse

In many editors it is standard to move selected text by dragging and dropping it with the mouse. In emacs dragging selection with the mouse starts a new selection by default. This is extremely ...
1
vote
3answers
872 views

How to delete all instances of a character in a bunch of files?

I was given a directory of files in which I was asked to make some systematic changes. Because it was a one-off task, and because there were only a few hundred files I thought I'd use an Emacs ...
1
vote
2answers
94 views

Deleting whole variable name on M-backspace

Is there a way to configure emacs, so that when I hit M-backspace it would actually remove the whole variable? If I have a variable like my_dummy_variable I need to hit M-backspace three times in ...
1
vote
1answer
181 views

Transform selected text like a Python macro

I've only just started with Emacs (about 6 weeks now) so I'm not really familiar with its coding language. I was wondering if it was possible to write, for Emacs, the equivalent of a Python macro I ...
5
votes
2answers
792 views

Incrementing characters in Emacs, next to numbers?

You can place a pointer on a number, like 1, and increment it to 2. There are many alternatives on this. See also the Emacs Wiki: https://www.emacswiki.org/emacs/IncrementNumber 7 alternatives to ...
0
votes
5answers
388 views

How to swap two tab-separated values on a line, and generalize the process?

My file has one book listed per line, title first followed by a tab character, followed by the author's name. TITLE<TAB>AUTHOR TITLE<TAB>AUTHOR ... I want to swap the two fields, such ...
2
votes
1answer
753 views

Can I write elisp code to act on the text in a buffer [closed]

I am fairly new to emacs and I want to learn emacs Lisp. In particular, is it possible to write elisp functions in, say, the scratch buffer to do some complex text-processing on my program file ...
1
vote
2answers
128 views

Macro-like feature in emacs?

If I need to remove everything in a parenthesis {...}, I do Put the cursor on { Click C-space (set mark) Click C-M-right (go to the }) Click C-w (remove selection) How can I automatize these steps? ...
1
vote
1answer
54 views

Intelligently edit draft with emacs

I have a co-worker to edit LaTeX document. The co-worker uses LaTeX \color and \sout command to make the changs visible in pdf file. For example, Hello world becomes Hell{\color{red}\sout{o}a} ...
1
vote
1answer
114 views

Iterate over string in YAS Snippet?

I'm new to emacs/LISP and would like guidance how to achieve the following output I'd like to type "color glass hat sport" in a single string ($1) that will be converted to the following: Color = "C"...
0
votes
0answers
25 views

Adjust scrolling after font increase/decrease

After text-scale-decrease or text-scale-increase scrolling (e.g. with space, scroll-down) does not seem to take the text scaling into account. Is there a way to adjust the scroll commands to reflect ...
0
votes
4answers
2k views

How to replace multiple newlines for single one in whole file?

I have file which has multiple newlines. I want to receive single newline in their place. I know how to do it in vim(found in google query): :%s/\n\n\n*/\r\r/ How can I do the same in Emacs? ...
3
votes
0answers
118 views

Edit any input field in emacs buffer

Is it possible to make emacs as an input middle man for any text field in the system? It should work like this: 1 user focus the text input field of any gui program 2 a system hotkey brings up a ...
2
votes
1answer
103 views

Insert Text Leftwards in Overwrite Mode

How can I insert text so that the cursor stays in the same position while text I type is shifted to the left, overwriting existing text? For example: row_title: some words old_title: letters ...
2
votes
1answer
76 views

Upcase whole buffer but ignore quoted strings

I want to type everything in lowercase, but have a command to turn the whole buffer into uppercase except for quoted strings. What is the command to tell emacs to ignore quoted strings?
3
votes
3answers
932 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
429 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
112 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
250 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
472 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
3k 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 ...
13
votes
9answers
2k 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 ...
23
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
72 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
713 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
177 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
109 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
185 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
212 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
290 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
178 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
216 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
326 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
411 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
259 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
73 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
795 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
450 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
215 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 ...