From: Jim Porter Date: Mon, 3 May 2021 15:24:01 +0000 (-0700) Subject: Ensure ` ' handles rectangular regions X-Git-Tag: emacs-28.0.90~2557 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=048cc03290abc786f439ee9838c15a81541af2aa;p=emacs.git Ensure ` ' 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'. --- diff --git a/etc/NEWS b/etc/NEWS index d5519de421e..9f4ded3aaba 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -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 diff --git a/lisp/delsel.el b/lisp/delsel.el index 982320340d8..96a9dcc0c79 100644 --- a/lisp/delsel.el +++ b/lisp/delsel.el @@ -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'. diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index d8cdeb101ad..ef7235cffa0 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -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