Questions tagged [deletion]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
6
votes
1answer
133 views

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))))
2
votes
1answer
97 views

Why Emacs (dired+) asks me twice to delete file?

windows 10, Emacs 26.1, dired+ Suppose I want to delete (move to trash) file in dired mode. D Emacs asks me: I press y and now it's asking me again to kill file. Why Emacs asks me twice? I want ...
3
votes
3answers
129 views

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 ...
1
vote
0answers
56 views

How to delete a long region by setting a mark and then searching for the location of the end of the region?

I have a long document. I placed two unique identifiers, in the form of short strings of printable English letter, in two positions in the document. The identifiers are far apart. My task is to delete ...
1
vote
0answers
43 views

vlf-mode, delete up to end of file

I am viewing a large file (512 MB) with vlf-mode. How can I delete from a point of the file to the end? The standard approach of selecting the text from a point to the end and then deleting it does ...
0
votes
1answer
44 views

How to trim text on each line, starting with the first space

Windows 10, Emacs 25.1 Suppose I has text: Advertisment d184f52a-14d7-dddddddddd ZAnelik 1c970d12-6c67-44e1-cccccccccccc Avers b0f0dd6b-a43f-4e40-b0ebbbbbbbbb BAVERS_MIGOM_OLD ...
1
vote
1answer
61 views

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

Evil - don't yank with only whitespace to register

How can I configure Emacs in the Evil mode to delete an empty line (d d) without copying it but still copy it when deleting a non-empty line? Thanks!
1
vote
1answer
101 views

how remove all but the first n chars

How can I remove all but the first n characters of a every line in the file buffer? What I tried Mark region C-x r k #but this is cumbersome when the length of lines are very varied, and there are ...
0
votes
0answers
65 views

What is causing `delete-trailing-whitespace`?

In some buffers (e.g. diff buffers) the trailing whitespace is essential to the format and must be preserved. What is causing Emacs to invoke delete-trailing-whitespace whenever I save the buffer? ...
5
votes
3answers
361 views

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 ...
1
vote
2answers
574 views

Rebind backspace to C-d for deleting char backwards

I want to delete char backwards using C-d, not the backspace key. I could do it like that: (global-set-key (kbd "\C-d") 'delete-backward-char) However, I have noticed that in fact backspace points ...
1
vote
1answer
893 views

Delete 4-spaces as a single tab

I asked another question yesterday but this bothers me a little. I use 4 spaces as indentation for programming (ShellScript, C and Python, mostly). When I want to delete the 4 spaces, I had to do one ...
2
votes
1answer
102 views

Kill like vim or Sublime Text

I'm "new" with Emacs. I'm making my own set up but I can't do one thing with killing words. You know what M-DEL does by default, but I want to make like Sublime Text or VIM. I'll do an example (this ...
26
votes
2answers
5k views

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
12
votes
3answers
1k views

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 ...
2
votes
1answer
255 views

How to stop C-backspace or M-backspace from copying text?

Deleting a chunk of text from the cursor causes the deleted contents to be copied into the kill ring, overwriting whatever I had stored there. How do I stop this from happening?
5
votes
4answers
548 views

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.
1
vote
2answers
66 views

Make delete button to delete file at point in dired?

In normal file managers like nautilus, if i select an item and press delete button, it will delete that item. How can i achieve the same in dired? When point is at file, pressing delete button should ...
7
votes
3answers
1k views

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

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 (...
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 ...
1
vote
1answer
103 views

Delete marked region with py-electric-backspace py-electric-delete

In my python-mode the backspace and delete keys gets remapped to py-electric-backspace, etc. This breaks the behaviour set by the variable delete-active-region. Is there a way to unify the behaviour ...
7
votes
1answer
353 views

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 ...
11
votes
1answer
538 views

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-...