unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Emanuel Berg <embe8573@student.uu.se>
To: help-gnu-emacs@gnu.org
Subject: Re: How to delete the parens around a sexp?
Date: Wed, 23 Sep 2015 05:06:22 +0200	[thread overview]
Message-ID: <87a8sddec1.fsf@debian.uxu> (raw)
In-Reply-To: CAOj2CQTXAyF_Kp+=q-XAHtjvRrbt2zspCTiZBQFCQZkoiVwoLg@mail.gmail.com

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	other threads:[~2015-09-23  3:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-22  7:40 How to delete the parens around a sexp? Marcin Borkowski
2015-09-22 10:11 ` Nicolas Richard
2015-09-22 11:30   ` Edward Knyshov
2015-09-22 11:45 ` Rasmus
2015-09-22 11:54 ` Andreas Röhler
2015-09-23  0:49 ` Emanuel Berg
2015-09-23  0:58   ` Emanuel Berg
2015-09-23  2:15 ` John Mastro
2015-09-23  3:06   ` Emanuel Berg [this message]
2015-10-19  6:04   ` Marcin Borkowski
2015-10-21 11:23     ` Oleh Krehel
2015-10-18 22:12 ` Thien-Thi Nguyen
2015-10-19  5:59   ` Marcin Borkowski
     [not found] ` <mailman.588.1445207663.7904.help-gnu-emacs@gnu.org>
2015-10-19  0:49   ` Pascal J. Bourguignon
2015-10-19  5:59     ` Marcin Borkowski
     [not found] <mailman.1573.1442907653.19560.help-gnu-emacs@gnu.org>
2015-09-22  8:28 ` Joost Kremers
2015-09-22  8:38 ` Marco Wahl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a8sddec1.fsf@debian.uxu \
    --to=embe8573@student.uu.se \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).