diff lisp/emacs-lisp/lisp.el @ 56924:bca93997a4d7

(kill-backward-up-list): New function.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 04 Sep 2004 12:56:54 +0000
parents 3dcc647295da
children 8c6dae33cdc3 cce1c0ee76ee
line wrap: on
line diff
--- a/lisp/emacs-lisp/lisp.el	Sat Sep 04 12:50:17 2004 +0000
+++ b/lisp/emacs-lisp/lisp.el	Sat Sep 04 12:56:54 2004 +0000
@@ -149,6 +149,20 @@
 Negative arg -N means kill N sexps after the cursor."
   (interactive "p")
   (kill-sexp (- (or arg 1))))
+
+;; After Zmacs:
+(defun kill-backward-up-list (&optional arg)
+  "Kill the form containing the current sexp, leaving the sexp itself.
+A prefix argument ARG causes the relevant number of surrounding
+forms to be removed."
+  (interactive "*p")
+  (let ((current-sexp (thing-at-point 'sexp)))
+    (if current-sexp
+        (save-excursion
+          (backward-up-list arg)
+          (kill-sexp)
+          (insert current-sexp))
+      (error "Not at a sexp"))))
 
 (defvar beginning-of-defun-function nil
   "If non-nil, function for `beginning-of-defun-raw' to call.