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: anoop aryal
Subject: Re: Delete (kill) entire line at cursor - how?
Date: Mon, 26 Mar 2007 10:07:05 -0500
User-agent: KMail/1.9.5

On Thursday 22 March 2007 22:11, Matthew Flaschen wrote:
> David Hansen wrote:
> > On Thu, 22 Mar 2007 21:29:42 -0400 Matthew Flaschen wrote:
> >> anoop aryal wrote:
> >>> i use C-M-k to delete sexps, C-c-C-o to delete multiple consequitive
> >>> blank lines etc. and therefore find that kill-entire-line is something
> >>> i'll use only when none of the other constructs are available. not to
> >>> say that i don't use C-k, it's just that given a bunch of other higher
> >>> level constructs and functions to operate on those constructs, C-k has
> >>> limited use.
> >>
> >> Is there such a construct for deleting the current statement in
> >> C/C++/Java?  If not, I could see using kill-entire-line often for that.
> >
> > There are `c-beginning-of-statement' and `c-end-of-statement'.  The
> > rest is left as an exercise to the reader.
>
> So in other words "no, but you can make it".  I knew that; that's the
> answer to every question about emacs. :)

i'm sure it could be done better but here's something you can put in 
your .emacs file:

(defun c-kill-statement ()
  "a handy way to kill a statement even when it spans multiple lines."
  (interactive)
  (save-excursion
    (c-beginning-of-statement-1)
    (let ((start (point)))
      (c-end-of-statement)
      (let ((end (point)))
        (kill-region start end)))))


you can then type M-x c-kill-statement to try it out to make sure that's what 
you really want. if it is what you want, assign a key binding to it and 
you're off to the races.

>
> Matt Flaschen
>
>
> _______________________________________________
> help-gnu-emacs mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

-- 

anoop aryal
address@hidden




reply via email to

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