unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Delete (kill) entire line at cursor - how?
@ 2007-03-06  7:22 cmr.Pent
  2007-03-06  8:34 ` Matthew Flaschen
                   ` (2 more replies)
  0 siblings, 3 replies; 23+ messages in thread
From: cmr.Pent @ 2007-03-06  7:22 UTC (permalink / raw)
  To: help-gnu-emacs

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,
but from the tutorial I got impression it lacks a very simple but
extremely useful feature. It says that to delete line at cursor I must
hit C-a C-k C-k, while for examle mcedit (and many Windows progs I'm
used to) have a C-y shortcut for such operation. Furthermore, when I
hit C-y in mcedit, the cursor stays at the same position, but the
technique the official Emacs tutorial suggests means that your cursor
will go to the start of the line - not very handy for me.

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.

Pent

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Delete (kill) entire line at cursor - how?
  2007-03-06  7:22 Delete (kill) entire line at cursor - how? cmr.Pent
@ 2007-03-06  8:34 ` Matthew Flaschen
  2007-03-06  9:30 ` thorne
       [not found] ` <mailman.505.1173170070.7795.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 23+ messages in thread
From: Matthew Flaschen @ 2007-03-06  8:34 UTC (permalink / raw)
  To: cmr.Pent, emacs


[-- Attachment #1.1: Type: text/plain, Size: 1322 bytes --]

cmr.Pent@gmail.com 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 #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 254 bytes --]

[-- Attachment #2: Type: text/plain, Size: 152 bytes --]

_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Delete (kill) entire line at cursor - how?
  2007-03-06  9:30 ` thorne
@ 2007-03-06  9:28   ` cmr.Pent
  2007-03-06 13:01   ` Johan Bockgård
  1 sibling, 0 replies; 23+ messages in thread
From: cmr.Pent @ 2007-03-06  9:28 UTC (permalink / raw)
  To: help-gnu-emacs

Thanks for your fast responses, I'll try it when I get to my home
computer.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Delete (kill) entire line at cursor - how?
  2007-03-06  7:22 Delete (kill) entire line at cursor - how? cmr.Pent
  2007-03-06  8:34 ` Matthew Flaschen
@ 2007-03-06  9:30 ` thorne
  2007-03-06  9:28   ` cmr.Pent
  2007-03-06 13:01   ` Johan Bockgård
       [not found] ` <mailman.505.1173170070.7795.help-gnu-emacs@gnu.org>
  2 siblings, 2 replies; 23+ messages in thread
From: thorne @ 2007-03-06  9:30 UTC (permalink / raw)
  To: help-gnu-emacs

If you kill the entire line, won't your cursor have to go somewhere?

Anyway, maybe this is useful?:

,----[ C-h f kill-whole-line RET ]
| kill-whole-line is an interactive compiled Lisp function in `simple.el'.
| 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.
| 
| [back]
`----

-- 
þ    theron tlåx    þ

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Delete (kill) entire line at cursor - how?
  2007-03-06  9:30 ` thorne
  2007-03-06  9:28   ` cmr.Pent
@ 2007-03-06 13:01   ` Johan Bockgård
  2007-03-06 20:45     ` thorne
  1 sibling, 1 reply; 23+ messages in thread
From: Johan Bockgård @ 2007-03-06 13:01 UTC (permalink / raw)
  To: help-gnu-emacs

thorne <thorne@timbral.net> writes:

> Anyway, maybe this is useful?:
>
> ,----[ C-h f kill-whole-line RET ]

Note that this was introduced in Emacs 22.

   ** New command `kill-whole-line' kills an entire line at once. By
      default, it is bound to C-S-<backspace>.

-- 
Johan Bockgård

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Delete (kill) entire line at cursor - how?
       [not found] ` <mailman.505.1173170070.7795.help-gnu-emacs@gnu.org>
@ 2007-03-06 16:58   ` cmr.Pent
  2007-03-06 21:00     ` Giorgos Keramidas
                       ` (2 more replies)
  0 siblings, 3 replies; 23+ messages in thread
From: cmr.Pent @ 2007-03-06 16:58 UTC (permalink / raw)
  To: help-gnu-emacs

> 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.
Maybe it does exactly what Matt suggested ;-)

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Delete (kill) entire line at cursor - how?
  2007-03-06 13:01   ` Johan Bockgård
@ 2007-03-06 20:45     ` thorne
  0 siblings, 0 replies; 23+ messages in thread
From: thorne @ 2007-03-06 20:45 UTC (permalink / raw)
  To: help-gnu-emacs

bojohan+news@dd.chalmers.se (Johan Bockgård) writes:
>> Anyway, maybe this is useful?:
>>
>> ,----[ C-h f kill-whole-line RET ]
>
> Note that this was introduced in Emacs 22.

Oops.  Quite so.  Sorry.

-- 
þ    theron tlåx    þ

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Delete (kill) entire line at cursor - how?
  2007-03-06 16:58   ` cmr.Pent
@ 2007-03-06 21:00     ` Giorgos Keramidas
  2007-03-06 23:05     ` Matthew Flaschen
  2007-03-07  6:35     ` Dave Benjamin
  2 siblings, 0 replies; 23+ messages in thread
From: Giorgos Keramidas @ 2007-03-06 21:00 UTC (permalink / raw)
  To: help-gnu-emacs

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Delete (kill) entire line at cursor - how?
  2007-03-06 16:58   ` cmr.Pent
  2007-03-06 21:00     ` Giorgos Keramidas
@ 2007-03-06 23:05     ` Matthew Flaschen
  2007-03-07  6:35     ` Dave Benjamin
  2 siblings, 0 replies; 23+ messages in thread
From: Matthew Flaschen @ 2007-03-06 23:05 UTC (permalink / raw)
  To: emacs

cmr.Pent@gmail.com wrote:
>> 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.

Sure. :)

> And I use stable version (21.4 that is), so the `kill-whole-line'
> command is unavailable to me.

Same.  I chose the name kill-entire-line because I did notice a
kill-whole-line variable (which still doesn't allow the kill-entire-line
behavior); it's good because there aren't conflicts on upgrade.

> Maybe it does exactly what Matt suggested ;-)

Quite possibly.  That seems to happen a fair amount...

Matt Flaschen

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Delete (kill) entire line at cursor - how?
  2007-03-06 16:58   ` cmr.Pent
  2007-03-06 21:00     ` Giorgos Keramidas
  2007-03-06 23:05     ` Matthew Flaschen
@ 2007-03-07  6:35     ` Dave Benjamin
  2007-03-07  7:29       ` Matthew Flaschen
       [not found]       ` <mailman.573.1173252572.7795.help-gnu-emacs@gnu.org>
  2 siblings, 2 replies; 23+ messages in thread
From: Dave Benjamin @ 2007-03-07  6:35 UTC (permalink / raw)
  To: help-gnu-emacs

cmr.Pent@gmail.com wrote:
> And I use stable version (21.4 that is), so the `kill-whole-line'
> command is unavailable to me.
> Maybe it does exactly what Matt suggested ;-)

Even if you're stuck with Emacs 21, you can still use the 
kill-whole-line function from Emacs 22. It's in the file "simple.el" - 
you can just paste that function into your .emacs and it'll work fine 
(at least, it did for me).

Dave

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Delete (kill) entire line at cursor - how?
  2007-03-07  6:35     ` Dave Benjamin
@ 2007-03-07  7:29       ` Matthew Flaschen
       [not found]       ` <mailman.573.1173252572.7795.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 23+ messages in thread
From: Matthew Flaschen @ 2007-03-07  7:29 UTC (permalink / raw)
  To: emacs

Dave Benjamin wrote:
> cmr.Pent@gmail.com wrote:
>> And I use stable version (21.4 that is), so the `kill-whole-line'
>> command is unavailable to me.
>> Maybe it does exactly what Matt suggested ;-)
> 
> Even if you're stuck with Emacs 21, you can still use the
> kill-whole-line function from Emacs 22. It's in the file "simple.el" -
> you can just paste that function into your .emacs and it'll work fine
> (at least, it did for me).

I just took a look.  It does what mine does, but better.  ;)
Specifically, it takes care of invisible text, and puts the killed text
in the right part of the kill region.  I think either should suit the OP
fine.

Matt Flaschen

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Delete (kill) entire line at cursor - how?
       [not found]       ` <mailman.573.1173252572.7795.help-gnu-emacs@gnu.org>
@ 2007-03-07 10:13         ` cmr.Pent
  2007-03-07 11:28           ` Matthew Flaschen
  2007-03-14 16:38           ` anoop aryal
  0 siblings, 2 replies; 23+ messages in thread
From: cmr.Pent @ 2007-03-07 10:13 UTC (permalink / raw)
  To: help-gnu-emacs

Heh, the funny thing for me is that such a simple feature is delivered
in a base package only in the 22nd(!!) varsion of the program. Looks
like no one had the need in this feature for like 20 years... Pretty
amazing.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Delete (kill) entire line at cursor - how?
  2007-03-07 10:13         ` cmr.Pent
@ 2007-03-07 11:28           ` Matthew Flaschen
  2007-03-14 16:38           ` anoop aryal
  1 sibling, 0 replies; 23+ messages in thread
From: Matthew Flaschen @ 2007-03-07 11:28 UTC (permalink / raw)
  To: emacs

cmr.Pent@gmail.com wrote:
> Heh, the funny thing for me is that such a simple feature is delivered
> in a base package only in the 22nd(!!) varsion of the program. Looks
> like no one had the need in this feature for like 20 years... Pretty
> amazing.

Actually, it's casually occured to me that it would be useful.  I may
even use it now that I've coded it for you. :)

Anyway, if it's any consolation, emacs has tetris installed by default:

M-x tetris

Matthew Flaschen

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Delete (kill) entire line at cursor - how?
  2007-03-07 10:13         ` cmr.Pent
  2007-03-07 11:28           ` Matthew Flaschen
@ 2007-03-14 16:38           ` anoop aryal
  2007-03-23  1:29             ` Matthew Flaschen
  1 sibling, 1 reply; 23+ messages in thread
From: anoop aryal @ 2007-03-14 16:38 UTC (permalink / raw)
  To: help-gnu-emacs

On Wednesday 07 March 2007 04:13, cmr.Pent@gmail.com wrote:
> Heh, the funny thing for me is that such a simple feature is delivered
> in a base package only in the 22nd(!!) varsion of the program. Looks
> like no one had the need in this feature for like 20 years... Pretty
> amazing.
>

that may have to do with the fact that in regular editors, the primary editing 
is line oriented. in emacs, the editor (or the modes) recognizes the text 
being edited and give you higher level constructs such as word, paragraph, 
sentence (in regular text), sexp (in programming) etc, that you don't "fall 
back" to line editing.

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. in most other 
editors, delete line is about as high level a construct as it gets.

maybe that explains why, to someone coming from another editor, the omission 
seems grave.

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

-- 

anoop aryal
aaryal@foresightint.com

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Delete (kill) entire line at cursor - how?
  2007-03-14 16:38           ` anoop aryal
@ 2007-03-23  1:29             ` Matthew Flaschen
  2007-03-23  2:43               ` David Hansen
       [not found]               ` <mailman.1286.1174618530.7795.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 23+ messages in thread
From: Matthew Flaschen @ 2007-03-23  1:29 UTC (permalink / raw)
  To: emacs

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.

Matt Flaschen

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Delete (kill) entire line at cursor - how?
  2007-03-23  1:29             ` Matthew Flaschen
@ 2007-03-23  2:43               ` David Hansen
  2007-03-23  3:11                 ` Matthew Flaschen
       [not found]               ` <mailman.1286.1174618530.7795.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 23+ messages in thread
From: David Hansen @ 2007-03-23  2:43 UTC (permalink / raw)
  To: help-gnu-emacs

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.

David

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Delete (kill) entire line at cursor - how?
  2007-03-23  2:43               ` David Hansen
@ 2007-03-23  3:11                 ` Matthew Flaschen
  2007-03-26 15:07                   ` anoop aryal
  0 siblings, 1 reply; 23+ messages in thread
From: Matthew Flaschen @ 2007-03-23  3:11 UTC (permalink / raw)
  To: emacs

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

Matt Flaschen

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Delete (kill) entire line at cursor - how?
  2007-03-23  3:11                 ` Matthew Flaschen
@ 2007-03-26 15:07                   ` anoop aryal
  2007-03-27  3:09                     ` Matthew Flaschen
       [not found]                     ` <mailman.1478.1174965095.7795.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 23+ messages in thread
From: anoop aryal @ 2007-03-26 15:07 UTC (permalink / raw)
  To: help-gnu-emacs

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
> help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

-- 

anoop aryal
aaryal@foresightint.com

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Delete (kill) entire line at cursor - how?
       [not found]               ` <mailman.1286.1174618530.7795.help-gnu-emacs@gnu.org>
@ 2007-03-26 21:55                 ` Mathias Dahl
  2007-03-26 22:48                   ` anoop aryal
  0 siblings, 1 reply; 23+ messages in thread
From: Mathias Dahl @ 2007-03-26 21:55 UTC (permalink / raw)
  To: help-gnu-emacs

David Hansen <david.hansen@gmx.net> writes:

> There are `c-beginning-of-statement' and `c-end-of-statement'.  The
> rest is left as an exercise to the reader.

I needed some exercise :)

(defun c-kill-statement ()
  (interactive)
  (kill-region (save-excursion
                 (c-beginning-of-statement 1)
                 (point))
               (save-excursion
                 (c-end-of-statement 1)
                 (point))))

/Mathias

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Delete (kill) entire line at cursor - how?
  2007-03-26 21:55                 ` Mathias Dahl
@ 2007-03-26 22:48                   ` anoop aryal
  0 siblings, 0 replies; 23+ messages in thread
From: anoop aryal @ 2007-03-26 22:48 UTC (permalink / raw)
  To: help-gnu-emacs

On Monday 26 March 2007 16:55, Mathias Dahl wrote:
> David Hansen <david.hansen@gmx.net> writes:
> > There are `c-beginning-of-statement' and `c-end-of-statement'.  The
> > rest is left as an exercise to the reader.
>
> I needed some exercise :)
>
> (defun c-kill-statement ()
>   (interactive)
>   (kill-region (save-excursion
>                  (c-beginning-of-statement 1)
>                  (point))
>                (save-excursion
>                  (c-end-of-statement 1)
>                  (point))))

nice. ;)

>
> /Mathias
> _______________________________________________
> help-gnu-emacs mailing list
> help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

-- 

anoop aryal
aaryal@foresightint.com

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Delete (kill) entire line at cursor - how?
  2007-03-26 15:07                   ` anoop aryal
@ 2007-03-27  3:09                     ` Matthew Flaschen
       [not found]                     ` <mailman.1478.1174965095.7795.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 23+ messages in thread
From: Matthew Flaschen @ 2007-03-27  3:09 UTC (permalink / raw)
  To: emacs

anoop aryal wrote:
> 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)))))

Thanks, but I really have no need for this.  I was just curious whether
emacs had such semantics built-in.

Matt Flaschen

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Delete (kill) entire line at cursor - how?
       [not found]                     ` <mailman.1478.1174965095.7795.help-gnu-emacs@gnu.org>
@ 2007-03-27  9:54                       ` Giorgos Keramidas
  2007-03-27 10:46                         ` Matthew Flaschen
  0 siblings, 1 reply; 23+ messages in thread
From: Giorgos Keramidas @ 2007-03-27  9:54 UTC (permalink / raw)
  To: help-gnu-emacs

Matthew Flaschen <matthew.flaschen@gatech.edu> writes:
> anoop aryal wrote:
>> 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)))))
>
> Thanks, but I really have no need for this.  I was just curious
> whether emacs had such semantics built-in.

The answer to this depends on what you mean by 'semantics'.  Does the
following match, or even approximate what you had in mind?

,---[ C-h f kill-sexp RET ]---------------------------------------------
| kill-sexp is an interactive compiled Lisp function in `lisp.el'.
| It is bound to C-M-k.
| (kill-sexp &optional ARG)
| 
| Kill the sexp (balanced expression) following point.
| With ARG, kill that many sexps after point.
| Negative arg -N means kill N sexps before point.
`-----------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Delete (kill) entire line at cursor - how?
  2007-03-27  9:54                       ` Giorgos Keramidas
@ 2007-03-27 10:46                         ` Matthew Flaschen
  0 siblings, 0 replies; 23+ messages in thread
From: Matthew Flaschen @ 2007-03-27 10:46 UTC (permalink / raw)
  To: emacs

Giorgos Keramidas wrote:
> Matthew Flaschen <matthew.flaschen@gatech.edu> writes:
>> anoop aryal wrote:
>>> 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)))))
>> Thanks, but I really have no need for this.  I was just curious
>> whether emacs had such semantics built-in.
> 
> The answer to this depends on what you mean by 'semantics'.  Does the
> following match, or even approximate what you had in mind?
> 
Again, this is idle curiosity, but no.  That doesn't seem to have any
useful understanding of C/Java syntax.  It just kills the next word.

Matthew Flaschen

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2007-03-27 10:46 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-06  7:22 Delete (kill) entire line at cursor - how? cmr.Pent
2007-03-06  8:34 ` Matthew Flaschen
2007-03-06  9:30 ` thorne
2007-03-06  9:28   ` cmr.Pent
2007-03-06 13:01   ` Johan Bockgård
2007-03-06 20:45     ` thorne
     [not found] ` <mailman.505.1173170070.7795.help-gnu-emacs@gnu.org>
2007-03-06 16:58   ` cmr.Pent
2007-03-06 21:00     ` Giorgos Keramidas
2007-03-06 23:05     ` Matthew Flaschen
2007-03-07  6:35     ` Dave Benjamin
2007-03-07  7:29       ` Matthew Flaschen
     [not found]       ` <mailman.573.1173252572.7795.help-gnu-emacs@gnu.org>
2007-03-07 10:13         ` cmr.Pent
2007-03-07 11:28           ` Matthew Flaschen
2007-03-14 16:38           ` anoop aryal
2007-03-23  1:29             ` Matthew Flaschen
2007-03-23  2:43               ` David Hansen
2007-03-23  3:11                 ` Matthew Flaschen
2007-03-26 15:07                   ` anoop aryal
2007-03-27  3:09                     ` Matthew Flaschen
     [not found]                     ` <mailman.1478.1174965095.7795.help-gnu-emacs@gnu.org>
2007-03-27  9:54                       ` Giorgos Keramidas
2007-03-27 10:46                         ` Matthew Flaschen
     [not found]               ` <mailman.1286.1174618530.7795.help-gnu-emacs@gnu.org>
2007-03-26 21:55                 ` Mathias Dahl
2007-03-26 22:48                   ` anoop aryal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).