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

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

Re: How to delete the parens around a sexp?


From: Emanuel Berg
Subject: Re: How to delete the parens around a sexp?
Date: Wed, 23 Sep 2015 05:06:22 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

John Mastro <john.b.mastro@gmail.com> writes:

> However, if you don't want to depend on
> a third-party package, something along these lines
> might help get you started:
>
> (defun unwrap-next-sexp ()
>   (interactive)
>   (let ((close (progn (forward-sexp 1)
>                       (point)))
>         (open (progn (forward-sexp -1)
>                      (point))))
>     (goto-char close)
>     (delete-char -1)
>     (goto-char open)
>     (delete-char 1)))

That is some cool Elisp, especially the `progn's in
the `let' form.

This works for symbolic expressions so you can't have
point in the middle of what should be unwrapped.
Because the OP said natural languages, but also
mentioned sexp's, I suppose this is part of the
solution :)

-- 
underground experts united
http://user.it.uu.se/~embe8573




reply via email to

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