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: lampshade
Subject: Re: Help with keybinding to delete between {}
Date: Wed, 12 Dec 2007 01:20:27 -0800 (PST)
User-agent: G2/1.0

On Dec 6, 11:14 am, Xah Lee <address@hidden> wrote:
> for some reason my code in the previous post is completely non-
> functional. (i swear i used it for few months. Perhaps when i put on
> the website i got smart and edited it "for the better" without
> testing)
>
> Here's the correct version:
>
> (defun delete-enclosed-text ()
>   "Delete texts between any pair of delimiters.
> Note: if you have nested matching pairs, the cursor
> should be inside the inner most one. Else it gets confused.
> This code should to be fixed in the future."
>   (interactive)
>   (save-excursion
>     (let (p1 p2)
>       (skip-chars-backward "^(<["<<") (setq p1 (point))
>       (skip-chars-forward "^)>]">>") (setq p2 (point))
>       (delete-region p1 p2)
>     )
>   )
> )
>
>   Xah
>   address@hidden
> \xAD\xF4http://xahlee.org/

I'm glad to see you in this thread! I actually came across your code
and tried that first.  Unfortunately, that version wasn't working so I
moved on to trying to write one myself.  Your implementation was
pretty well exactly what I was looking for.  Thank you for the updated
version!

Thank you!


reply via email to

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