2

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 left behind in one shot?

itsjeyd
  • 14,586
  • 3
  • 58
  • 87
Madhavan
  • 1,957
  • 12
  • 28
  • Related: [Kill or copy current line with minimal keystrokes](http://emacs.stackexchange.com/q/2347/504) – itsjeyd May 26 '15 at 11:37

3 Answers3

6

From documentation:

kill-whole-line is an interactive compiled Lisp function.

It is bound to <C-S-backspace>.

(kill-whole-line &optional ARG)

Kill current line. With prefix ARG, kill that many lines starting from the current line. If ARG is negative, kill backward. Also kill the preceding newline. (This is meant to make C-x z work well with negative arguments.) If ARG is zero, kill current line but exclude the trailing newline.

Nsukami _
  • 6,341
  • 2
  • 22
  • 35
2

Consider adding (setq kill-whole-line t) to your configuration in case you'd want it to be default behavior.

aadcg
  • 1,203
  • 6
  • 13
1

Use 1 as argument, for example C-1 C-k or bind to a function that calls (kill-whole-line 1).

Sandra
  • 194
  • 1
  • 7