Function: raise-sexp
raise-sexp is an interactive and byte-compiled function defined in
lisp.el.gz.
Signature
(raise-sexp &optional N)
Documentation
Raise N sexps one level higher up the tree.
This function removes the sexp enclosing the form which follows point, and then re-inserts N sexps that originally followed point, thus raising those N sexps one level up.
Interactively, N is the numeric prefix argument, and defaults to 1.
For instance, if you have:
(let ((foo 2))
(progn
(setq foo 3)
(zot)
(+ foo 2)))
and point is before (zot), M-x raise-sexp (raise-sexp) will give you
(let ((foo 2))
(zot))
Probably introduced at or before Emacs version 22.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/lisp.el.gz
(defun raise-sexp (&optional n)
"Raise N sexps one level higher up the tree.
This function removes the sexp enclosing the form which follows
point, and then re-inserts N sexps that originally followed point,
thus raising those N sexps one level up.
Interactively, N is the numeric prefix argument, and defaults to 1.
For instance, if you have:
(let ((foo 2))
(progn
(setq foo 3)
(zot)
(+ foo 2)))
and point is before (zot), \\[raise-sexp] will give you
(let ((foo 2))
(zot))"
(interactive "p")
(let ((s (if (and transient-mark-mode mark-active)
(buffer-substring (region-beginning) (region-end))
(buffer-substring
(point)
(save-excursion (forward-sexp n) (point))))))
(backward-up-list 1)
(delete-region (point) (save-excursion (forward-sexp 1) (point)))
(save-excursion (insert s))))