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: Matthew Flaschen
Subject: Re: Delete (kill) entire line at cursor - how?
Date: Tue, 06 Mar 2007 03:34:15 -0500
User-agent: Thunderbird 1.5.0.9 (X11/20070104)

address@hidden wrote:
> I've been a Windows user for years, but recently I began to feel that
> my usual work (mostly R scripts and scientific articles) could be done
> much more efficiently in text-oriented environment, which Linux is. So
> I've installed Linux and tried some editors like Kate, but they didn't
> suit my needs 100% (for example, I don't know how to switch between
> text file and console using keyboard, keeping console open; plus Kate
> loads like ages). Now I'm studying Emacs.
> 
> Well, Emacs has this kewl psychotherapist and Conway's life built in,

Thanks.  I didn't know it had life. :)

> I believe the Emacs is powerful enough to emulate such a feature, so
> please, Emacs gurus, point me out how to create a _simple_ shortcut
> (like C-y) which would kill line at cursor not moving the cursor
> itself.

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)

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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