Ensure `<menu-bar> <edit> <clear>' handles rectangular regions

* lisp/delsel.el (delete-active-region): Autoload it and make it interactive.
* lisp/menu-bar.el (menu-bar-edit-menu): Bind "Clear" to
`delete-active-region'.
This commit is contained in:
Jim Porter 2021-05-03 08:24:01 -07:00 committed by Stefan Monnier
parent a2842a1172
commit 048cc03290
3 changed files with 6 additions and 1 deletions

View file

@ -298,6 +298,9 @@ prompt, and how you can tweak the file size threshold.
+++
** A prefix arg now causes 'delete-other-frames' to only iconify frames
+++
** The "Edit => Clear" menu item now obeys a rectangular region
+++
** New command 'execute-extended-command-for-buffer'.
This new command, bound to 'M-S-x', works like

View file

@ -84,9 +84,11 @@ information on adapting behavior of commands in Delete Selection mode."
(defvar delsel--replace-text-or-position nil)
;;;###autoload
(defun delete-active-region (&optional killp)
"Delete the active region.
If KILLP in not-nil, the active region is killed instead of deleted."
(interactive "P")
(cond
(killp
;; Don't allow `kill-region' to change the value of `this-command'.

View file

@ -492,7 +492,7 @@
'(menu-item "Select All" mark-whole-buffer
:help "Mark the whole buffer for a subsequent cut/copy"))
(bindings--define-key menu [clear]
'(menu-item "Clear" delete-region
'(menu-item "Clear" delete-active-region
:enable (and mark-active
(not buffer-read-only))
:help