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

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

Re: Help with keybinding to delete between {}


From: Ilya Zakharevich
Subject: Re: Help with keybinding to delete between {}
Date: Wed, 5 Dec 2007 23:50:20 +0000 (UTC)
User-agent: trn [how to get a version via %-escapes???] with a custom header

[A complimentary Cc of this posting was sent to
lampshade 
<mwolffedu@gmail.com>], who wrote in article 
<598472b5-c766-483a-93e5-15b31bfd880f@b40g2000prf.googlegroups.com>:
> Hello,
> 
> 
> I would really like a keybinding that would allow me to delete any
> text between sexp's like {} (), etc no matter where I am between them
> and whether or not that text has spaces.
> 
> For example
> {asdfdsfa asdfasdf asd}
> I would like to delete between leaving only the {} with my cursor
> inside ready to type.  So far I've been trying
> (defun delete_between ()
>       (interactive)
>       (backward-sexp)

        (up-list -1)

>       (kill-sexp))
> (global-set-key [(control meta k)] 'delete_between)
> 
> but that doesn't quite work.  Anyone have any improvements or help
> they could give me?

In my setup, backspace kills back, delete forward; control-whatever
acts in words; meta-left/right acts in sexps, meta-up/down does
(up-list 1/-1).  shift- adds some pepper (changes search-* to
replace-*, changes kill-word to kill-up-to-begin/end-of-line, changes
movement to move-and-modify-CUA-selection).

But I do not have kill-by-sexp commands.  Instead, I do a shifted-move
(to select), and kill-CUA-selected.  So to do what you want, I would
M-up, S-M-right, S-backspace.  More keystrokes, but much more flexible
- I rarely want to delete something as simple as sexp, usually I
combine several move-and-modify-CUA-selection commands...

Probably this does not help your problem much...
Ilya


reply via email to

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