Questions tagged [deletion]
45 questions
45
votes
2 answers
Git rm from magit
This is a very basic but I have been unable to find the answer on the web.
Is it possible to git rm, i.e. to remove a tracked file, from magit?
Thanks

wizmer
- 877
- 1
- 7
- 9
13
votes
4 answers
Backspace without adding to kill ring
Using Crtl+Backspace or Ctrl+Del adds the deleted text to the kill ring.
How can I prevent this from happening? I do not need to have every single piece of text sent to the kill ring when it gets deleted.
Side question:
What's the purpose of this…

Daniel Hitzel
- 507
- 4
- 13
12
votes
1 answer
Delete portion of Isearch string that does not match, or last char if complete match
I have the following
(defun isearch-del-fail-or-char ()
"Delete failed isearch text, or if there is none, a single character."
(interactive)
(if (isearch-fail-pos)
(delete-region (isearch-fail-pos) (point))
…

asmeurer
- 1,552
- 12
- 30
11
votes
3 answers
Removing the last element of a list
Is there a simpler way to remove the last element of a list than this?
(setq list (reverse (cdr (reverse list))))

Toothrot
- 3,204
- 1
- 12
- 30
10
votes
4 answers
Delete files to Trash on OS X
Is there a best, most future-proof method of setting emacs on OS X to delete files to the trash?
I tried the instructions here:
(setq delete-by-moving-to-trash t)
(defun system-move-file-to-trash (file)
"Use \"trash\" to move FILE to the system…

Harvey
- 978
- 6
- 15
9
votes
3 answers
Automatic deletion of backup files
When editing files, some foo.bar~ backups appear (files ending with a tilde ~). How can I control their creations, and is it possible to ask for a recursive bulk deletion of all files from a specific directory and all it's sub directories?

smonff
- 1,575
- 1
- 15
- 20
8
votes
3 answers
How to delete all whitespace up to the first non-whitespace character?
I'm looking for an emacs function that will delete all whitespace from the cursor position (including newlines) until the first non-whitespace character.
For example, if my cursor is positioned at the end of the first line:
main(arg1,
…

Jeff Bauer
- 861
- 1
- 10
- 22
7
votes
1 answer
backward-kill-word ignores whitespaces, is there another friendlier version?
Emac's backward-kill-word tends to delete more than I want.
E.g when I press delete multiple times on this:
(key-chord "qf" 'helm-org-in-buffer-headings) ;heading search. |
I get:
1. (key-chord "qf" 'helm-org-in-buffer-headings) ;heading|
2.…

Leo Ufimtsev
- 4,488
- 3
- 22
- 45
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
5
votes
4 answers
How can I delete specified lines?
I want to delete lines with number 03,08,13,18,...., 3+5n.
How can I do that? Thank you very much.

yuxuan
- 781
- 4
- 15
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
3
votes
2 answers
Deleting words while preserving clipboard
Is there a way to keep the clipboard contents when deleting entire words with M-DEL?
For instance, I'd like to delete a word (M-DEL) and then paste (C-y) what I had previously copied (with ctrl+c) from a different application. Is this possible?

Ricky Robinson
- 267
- 2
- 10
3
votes
3 answers
Delete duplicate lines, with partial match
Sample text:
This is first line.a
This is over_second line.
This is over_fourth line.
This is third line.
This is over_fourth delete it.
This is over_fourth and one more.
This is over_second with another text.
Need to delete lines where partial…

msinfo
- 177
- 1
- 6
2
votes
0 answers
Delete Text by Fading It
I once saw a feature in Vim where, when I delete the text to the left of the cursor, the text is indeed deleted. However, a faint impression of the text remains in its original place, as shown in the figure below.
The original text was
alias ll='ls…

shynur
- 4,065
- 1
- 3
- 23
2
votes
2 answers
Automated trim of 28 million text records
I have a plain text data file, consisting of 28 million tab-delimited records, each containing nine fields. The left ends of the first three records look like this:
I would like to truncate each of those records after the first four fields. That…

Ray Woodcock
- 144
- 4