Editing is a generic term for updating a file, document, or page.
Questions tagged [editing]
24 questions
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
36
votes
5 answers
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 longer using git-grep, ack, or ag and switching to use…

dgtized
- 4,169
- 20
- 41
33
votes
10 answers
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-n M-w.
Is there a faster way to kill or copy the…

itsjeyd
- 14,586
- 3
- 58
- 87
24
votes
1 answer
What am I giving up by activating CUA mode?
CUA mode is very close to the workflow I am used to outside Emacs, so I am tempted to activate it.
But I have learned that Emacs may have useful gems hidden in its ways, and CUA mode seems something that was attached later on.
I know the benefits of…

gsl
- 1,742
- 17
- 34
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
20
votes
1 answer
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 want a key-combination that inserts a comment…

Geier
- 692
- 5
- 15
19
votes
3 answers
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 inside of emacs already? I tried running starting…

unclejamil
- 303
- 2
- 7
17
votes
1 answer
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 the tables, and is too slow to be usable as is. In…

holocronweaver
- 1,319
- 10
- 22
17
votes
1 answer
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 the entire undo tree to find the state I want to…

Lenar Hoyt
- 1,163
- 7
- 25
15
votes
9 answers
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
(+ (count-lines (point-min) (point-max)) 1))))
…

Zhro
- 359
- 3
- 11
13
votes
3 answers
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 point):
(+ 1 |(+ 2 3) 4) => (+ (+ 2 3) 1 4)
and Move…

Rodrigo Flores
- 275
- 1
- 7
11
votes
2 answers
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 pixel positions on the screen. I’m simply curious…

Lenar Hoyt
- 1,163
- 7
- 25
8
votes
4 answers
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 achieve this? Would a custom function be better…

c-o-d
- 910
- 9
- 19
4
votes
2 answers
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.

Lenar Hoyt
- 1,163
- 7
- 25
4
votes
1 answer
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 value
|-
| some|| more ||rows
|}
How do I efficiently…

Michał Politowski
- 340
- 4
- 11