diff options
author | Paul Nelson <ultrono@gmail.com> | 2024-09-15 22:29:46 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2024-09-21 13:20:59 +0300 |
commit | a48672c6bbf8cf0adae33b13634f3945c24c61dd (patch) | |
tree | 6c41bfc9dc511108cf112e943612ec621d2b8d7d /lisp/emacs-lisp | |
parent | 39d2cc36b2ffeb9a0d0053fa3b800334e98ef49e (diff) | |
download | emacs-a48672c6bbf8cf0adae33b13634f3945c24c61dd.tar.gz emacs-a48672c6bbf8cf0adae33b13634f3945c24c61dd.tar.bz2 emacs-a48672c6bbf8cf0adae33b13634f3945c24c61dd.zip |
Add option for delete-pair to mark end of region
* lisp/emacs-lisp/lisp.el (delete-pair-push-mark): New user option.
(delete-pair): Use it. (Bug#73284)
* etc/NEWS: Announce the new user option.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/lisp.el | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index e65eec508d9..f6eebcda35a 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el @@ -850,10 +850,16 @@ It's used by the command `delete-pair'. The value 0 disables blinking." :group 'lisp :version "28.1") +(defcustom delete-pair-push-mark nil + "Non-nil means `delete-pair' pushes mark at end of delimited region." + :type 'boolean) + (defun delete-pair (&optional arg) "Delete a pair of characters enclosing ARG sexps that follow point. A negative ARG deletes a pair around the preceding ARG sexps instead. -The option `delete-pair-blink-delay' can disable blinking." +The option `delete-pair-blink-delay' can disable blinking. With +`delete-pair-push-mark' enabled, pushes a mark at the end of the +enclosed region." (interactive "P") (if arg (setq arg (prefix-numeric-value arg)) @@ -887,7 +893,9 @@ The option `delete-pair-blink-delay' can disable blinking." (when (and (numberp delete-pair-blink-delay) (> delete-pair-blink-delay 0)) (sit-for delete-pair-blink-delay)) - (delete-char -1))) + (delete-char -1) + (when delete-pair-push-mark + (push-mark)))) (delete-char 1)))) (defun raise-sexp (&optional n) |