summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2018-10-19 02:09:15 +0300
committerJuri Linkov <juri@linkov.net>2018-10-19 02:09:15 +0300
commit7aaf9d8a7d314224a9a423286ebf289b60640039 (patch)
tree0a78e176c95f6338c33973809ba96fd5be268e34 /lisp/emacs-lisp
parente37825fe2a39d07320b508f66568ece67d752d48 (diff)
downloademacs-7aaf9d8a7d314224a9a423286ebf289b60640039.tar.gz
emacs-7aaf9d8a7d314224a9a423286ebf289b60640039.tar.bz2
emacs-7aaf9d8a7d314224a9a423286ebf289b60640039.zip
* lisp/emacs-lisp/lisp.el (delete-pair): Add optional prefix arg.
(Bug#32896)
Diffstat (limited to 'lisp/emacs-lisp')
-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."