emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 7aaf9d8: * lisp/emacs-lisp/lisp.el (delete-pair): A


From: Juri Linkov
Subject: [Emacs-diffs] master 7aaf9d8: * lisp/emacs-lisp/lisp.el (delete-pair): Add optional prefix arg.
Date: Thu, 18 Oct 2018 19:09:22 -0400 (EDT)

branch: master
commit 7aaf9d8a7d314224a9a423286ebf289b60640039
Author: Juri Linkov <address@hidden>
Commit: Juri Linkov <address@hidden>

    * lisp/emacs-lisp/lisp.el (delete-pair): Add optional prefix arg.
    
    (Bug#32896)
---
 lisp/emacs-lisp/lisp.el | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el
index 5a89923..3fda1dd 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."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]