From 4dee486f1f1d39ebc523e03f61705656d8e9c326 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Thu, 6 Jan 2022 15:47:42 -0600 Subject: Add +kill-word-backward-or-region --- lisp/+emacs.el | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lisp') diff --git a/lisp/+emacs.el b/lisp/+emacs.el index 7453913..ecdfeaa 100644 --- a/lisp/+emacs.el +++ b/lisp/+emacs.el @@ -220,6 +220,15 @@ kill without asking." (save-buffers-kill-emacs)) (delete-frame nil :force))) +(defun +kill-word-backward-or-region (&optional arg backward-kill-word-fn) + "Kill active region or ARG words backward. +BACKWARD-KILL-WORD-FN is the function to call to kill a word +backward. It defaults to `backward-kill-word'." + (interactive "P") + (call-interactively (if (region-active-p) + #'kill-region + (or backward-kill-word-fn #'backward-kill-word)))) + ;; ... and advice ;; Indent the region after a yank. -- cgit 1.4.1-21-gabe81