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

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

Remove sexp without deleting contents


From: Tim Johnson
Subject: Remove sexp without deleting contents
Date: Sat, 29 Sep 2018 14:31:11 -0800
User-agent: Mutt/1.10.0 (2018-05-17)

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.

-- 
Tim Johnson
http://www.tj49.com



reply via email to

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