Questions tagged [kill-text]
25 questions
7
votes
3 answers
How to select and delete a column of text in emacs?
I have this text
1 A
2 B
3 C
I want to remove the first column to make it
A
B
C
Ok so I need to make a rectangle. Reading about rectangles I see
"To specify a rectangle for a command to work on, set the mark at one corner and point at the opposite…

BigBoy1337
- 221
- 1
- 7
6
votes
2 answers
copy region without leading indentation
I often find myself copying a region of code that is deep inside the indented structure. Since I don't want it to end up in a codeblock with superfluous indentation (given that the context is missing), I find myself remembering that and having to go…

Jorge Israel Peña
- 1,265
- 9
- 17
6
votes
4 answers
How to do paredit-kill backwards?
Most everyone who uses paredit has used paredit-kill (i.e., C-k), which allows one to delete a line forwards whilst keeping delimiters balanced properly. But how does one do this in the reverse direction? When one does C-0 C-k, which is something…

GDP2
- 1,340
- 9
- 25
4
votes
3 answers
How can I move/kill multiple chunks of text to the same place/marker, one after another?
The task: I have a large-ish file, from which I need to pick certain chunks of text and move them into a certain place so they go one after another, in the order in which I pick them. More specifically, it's an Org-mode file, and the chunks are…

aaa
- 426
- 3
- 9
4
votes
3 answers
Delete from point to beginning of the line
Have read the GNU manuals on erasing, killing, and deleting.
In bash C-u deletes from the cursor to the beginning. I have searched and in much disbelief can't find out what the equivalent is in emacs? Very often in a buffer and in the minibuffer I…
user27072
4
votes
1 answer
Allow C-w to kill a region only if it is selected
Sometimes (rarely I would say) I press C-w by mistake and if the mark defines a non empty region, it gets deleted.
The few times this happened I just pressed undo, but I am afraid that sooner or later I will delete something without noticing.
Is it…

Nisba
- 895
- 8
- 19
3
votes
2 answers
Kill URL at point
I would like a way to kill the URL under the point. I have tried mark-thing, next-visible-thing etc. from the thing-cmds package, but they either do not know how to move over URLs in nxml-mode or fail with an error.
goto-address-mode works for…

Robin Green
- 949
- 7
- 16
2
votes
1 answer
How to limit mark/kill size of huge (org-mode) files?
I have org-mode files about 50K lines long, which I can edit and save file; but once in a while accidentally marked a large region by typing C-x C-x or C-x h, and copied too much data into clipboard, so Emacs hangs until killed by oom.
Is there a…

gb2312
- 21
- 2
2
votes
1 answer
Strange behavior when killling text in term/multi-term
multi-term is my current goto when I want a command line in Emacs. However, I have noticed a strange behavior, and I am not sure whether it is a bug, or if it can be configured.
If I type a command at the prompt - or any text for that matter, and…

elethan
- 4,755
- 3
- 29
- 56
2
votes
1 answer
Kill the next sexp and its surrounding whitespace
kill-whole-line is quite useful as it completely deletes both content and whitespace unlike kill-line which only deletes contents in line. But in lisp-mode, it is necessary to keep parens in tact and kill-whole-line fails there.
Update:
If point is…

Chillar Anand
- 4,042
- 1
- 23
- 52
1
vote
1 answer
How to transpose a pair of words?
Suppose I have the following text:
:lacerte-attach-statement-type "suffix" :data-automation-id "OSICtrlE15-140"
And I would like to have:
:data-automation-id "OSICtrlE15-140" :lacerte-attach-statement-type "suffix"
Of course, I can kill…

Pedro Delfino
- 1,369
- 3
- 13
1
vote
1 answer
Yanking does not use top entry in the kill ring
I want to delete regions without adding them to the kill ring following this thread:
(defun backward-kill-word-no-kill-ring ()
"Delete the previous word and remove it from the kill ring."
(interactive)
(backward-kill-word 1)
(setq kill-ring…

miguelmorin
- 1,751
- 11
- 33
1
vote
1 answer
kill rectangle not working on Mac (missing file/library)
I just upgraded to emacs 26.2 using homebrew on my MAC (update: I had actually done a global "brew update" and assumed it had also updated emacs) and now kill-rectangle with
C-x r k no longer works, and instead gives me an error:
Cannot open load…

ClimateUnboxed
- 121
- 5
1
vote
1 answer
Command that does different things based on whether something is selected
I am trying to make emacs function somewhat like sublime text, where C-x cuts text that is selected and cuts the whole line when nothing is selected. I got the full-line cut to work using
(global-set-key (kbd "C-x") 'kill-whole-line)
but I'm not…

Emerson Peters
- 113
- 3
1
vote
1 answer
Delete a line by relative line number
I'm looking for solutions/suggestions on how to delete a line not under cursor but by relative line number. For example, how to delete the line which is 5 lines after the cursor without going to it in a first place.
Emacs/Spacemacs/Evil solutions…

wizmer
- 877
- 1
- 7
- 9