From: Juri Linkov Date: Thu, 18 Oct 2018 23:09:15 +0000 (+0300) Subject: * lisp/emacs-lisp/lisp.el (delete-pair): Add optional prefix arg. X-Git-Tag: emacs-27.0.90~4278 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7aaf9d8a7d314224a9a423286ebf289b60640039;p=emacs.git * lisp/emacs-lisp/lisp.el (delete-pair): Add optional prefix arg. (Bug#32896) --- 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."