help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Delete (kill) entire line at cursor - how?


From: Giorgos Keramidas
Subject: Re: Delete (kill) entire line at cursor - how?
Date: Tue, 06 Mar 2007 23:00:03 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.95 (berkeley-unix)

cmr.Pent@gmail.com writes:
>> I just made the below hack. Add it to your ~/.emacs file.  Then,
>> restart emacs and, C-x y will do what you ask (I think).  There's
>> probably a better way to do it:
>>
>> Matt Flaschen
>>
>> (defun kill-entire-line ()
>> "Kills the whole line, including terminating newline, and moves the
>> cursor directly down"
>> (interactive)
>> (next-line 1)
>> (save-excursion
>>   (previous-line 1)
>>   (beginning-of-line)
>>   (kill-line 1)))
>>
>> (global-set-key [?\C-x ?y] 'kill-entire-line)
>
> Just checked it, works like a champ! Thanks.
>
> And I use stable version (21.4 that is), so the `kill-whole-line'
> command is unavailable to me.

It was introduced in Emacs 22, that's why :)

> Maybe it does exactly what Matt suggested ;-)

It does.  You can also bind it to any key you want, instead of the
default <C-S-backspace>.  So if you like hitting C-k to use it, instead
of the default, you can bind it to this key in your ~/.emacs file with:

  (global-set-key (kbd "C-k") 'kill-whole-line)

Have fun,
Giorgos



reply via email to

[Prev in Thread] Current Thread [Next in Thread]