[Top][All Lists]

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

Re: Remove sexp without deleting contents

From: Marcin Borkowski
Subject: Re: Remove sexp without deleting contents
Date: Mon, 01 Oct 2018 09:22:59 +0200
User-agent: mu4e 1.1.0; emacs 27.0.50


On 2018-09-30, at 00:31, Tim Johnson <> wrote:

> This poses a rather trivial question, but I'm betting on some
> seredipity from responses.
> Suppose I want to remove an extraneous sexp. The following code
> is simplistic:
> (defun tj-toggle-menu-visible ()
>   "Toggle visibility of menu bar and switches to tmm-style menus"
>   (interactive)
>   (if tj-menu-visible
>       (progn
>           (setq tj-menu-visible nil)
>           (menu-bar-mode -1)
>           (setq tj-is-windows nil))
>     (progn
>       (setq tj-menu-visible t)
>       (menu-bar-mode 1)
>       (setq tj-is-windows window-system))))
> ;; Suppose I want to remove the second `progn form, but not the
> enclosed sequences. In this simple block of code of code it's pretty
> hard to screw up: just delete/kill the line with "(progn" and any
> right parens from the last line. In a more complex example I might
> delete a parens whose absence could introduce unexpected and
> problematic side effects.
> Is there function that might (effectively) simultaneously remove the
> beginning of sexp and the matching closing paren, leaving inner
> contents intact?
> thanks.

Marcin Borkowski

reply via email to

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