From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Joost Kremers Newsgroups: gmane.emacs.help Subject: Re: How to delete the parens around a sexp? Date: 22 Sep 2015 08:28:57 GMT Message-ID: References: NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1442910633 493 80.91.229.3 (22 Sep 2015 08:30:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 22 Sep 2015 08:30:33 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Sep 22 10:30:28 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZeIy1-0006qW-C3 for geh-help-gnu-emacs@m.gmane.org; Tue, 22 Sep 2015 10:30:25 +0200 Original-Received: from localhost ([::1]:37631 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZeIy0-00014q-JC for geh-help-gnu-emacs@m.gmane.org; Tue, 22 Sep 2015 04:30:24 -0400 Original-Path: usenet.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 37 Original-X-Trace: individual.net kPROFWW981/lsAfsV3gQOgoxAeM/4YjHh5l3eDdZ+8osTlmNMr Cancel-Lock: sha1:buIeYy43q2YC9MFYe4nSQWBw50E= Mail-Copies-To: nobody X-Editor: Emacs of course! User-Agent: slrn/pre1.0.0-18 (Linux) Original-Xref: usenet.stanford.edu gnu.emacs.help:214990 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:107274 Archived-At: Marcin Borkowski wrote: > I'd like to transform this: > > -!-(some gibberish) > > into this: > > -!-some gibberish > > I assume there's no function in Elisp for that, and it's trivial to > write one, but I just wanted to make sure before I code it. raise-sexp > doesn't work, since it gobbles "gibberish" in the above example unless > given a prefix argument, and if you replace "some gibberish" with an > actual sentence, counting words manually is no fun. > > (Note: before anyone tells me how such a transformation doesn't make > sense: I need it for writing in a natural language.) Using the smartparens package, sp-splice-sexp-killing-backwards does that. Consider the following examples (where | indicates point): (insert (|format "Some string")) ==> (insert |format "Some string") (insert |(format "Some string")) ==> |(format "Some string") paredit (and I assume lispy) have similar commands, but they only work in Lisp modes. smartparens handles any kind of delimiters, also quotes etc. and can work in non-Lisp modes as well. For example, I can do the transformations above in the buffer I'm writing this message in, which has `message-mode` as its major mode. And I use it sometimes to transform footnotes in LaTeX into normal text. -- Joost Kremers joostkremers@fastmail.fm Selbst in die Unterwelt dringt durch Spalten Licht EN:SiS(9)