summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/lisp.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp/lisp.el')
-rw-r--r--lisp/emacs-lisp/lisp.el12
1 files changed, 7 insertions, 5 deletions
diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el
index 5a89923f8fb..3fda1dd6186 100644
--- a/lisp/emacs-lisp/lisp.el
+++ b/lisp/emacs-lisp/lisp.el
@@ -723,11 +723,13 @@ This command assumes point is not in a string or comment."
(interactive "P")
(insert-pair arg ?\( ?\)))
-(defun delete-pair ()
- "Delete a pair of characters enclosing the sexp that follows point."
- (interactive)
- (save-excursion (forward-sexp 1) (delete-char -1))
- (delete-char 1))
+(defun delete-pair (&optional arg)
+ "Delete a pair of characters enclosing ARG sexps following point.
+A negative ARG deletes a pair of characters around preceding ARG sexps."
+ (interactive "p")
+ (unless arg (setq arg 1))
+ (save-excursion (forward-sexp arg) (delete-char (if (> arg 0) -1 1)))
+ (delete-char (if (> arg 0) 1 -1)))
(defun raise-sexp (&optional arg)
"Raise ARG sexps higher up the tree."