diff options
author | Case Duckworth | 2021-05-04 17:27:36 -0500 |
---|---|---|
committer | Case Duckworth | 2021-05-04 17:27:36 -0500 |
commit | 9e0e42554e0c2619fcb4ce8a8b48da4288c44298 (patch) | |
tree | d7a8a57a68038bc2d428fa0f13e644d93f861f11 /lisp | |
parent | Remap C-h to DEL (diff) | |
download | emacs-9e0e42554e0c2619fcb4ce8a8b48da4288c44298.tar.gz emacs-9e0e42554e0c2619fcb4ce8a8b48da4288c44298.zip |
Remap C-w to backward-kill-word if the region isn't active
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/acdw.el | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lisp/acdw.el b/lisp/acdw.el index f297691..a798069 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el | |||
@@ -29,6 +29,8 @@ | |||
29 | 29 | ||
30 | 30 | ||
31 | ;;; Utility functions | 31 | ;;; Utility functions |
32 | ;; I don't prefix these because ... reasons. Honestly I probably should prefix | ||
33 | ;; them. | ||
32 | 34 | ||
33 | (defun dos2unix (buffer) | 35 | (defun dos2unix (buffer) |
34 | "Replace \r\n with \n in BUFFER." | 36 | "Replace \r\n with \n in BUFFER." |
@@ -58,6 +60,13 @@ each hook in HOOKS." | |||
58 | ,@(dolist (hook hook-list hook-defun-add-hook-list) | 60 | ,@(dolist (hook hook-list hook-defun-add-hook-list) |
59 | (push `(add-hook ',hook #',func-name) hook-defun-add-hook-list))))) | 61 | (push `(add-hook ',hook #',func-name) hook-defun-add-hook-list))))) |
60 | 62 | ||
63 | (defun kill-region-or-backward-word (arg) | ||
64 | "Kill region if active, or backward word if not." | ||
65 | (interactive "p") | ||
66 | (if (region-active-p) | ||
67 | (kill-region (region-beginning) (region-end)) | ||
68 | (backward-kill-word arg))) | ||
69 | |||
61 | (defmacro when-unfocused (name &rest forms) | 70 | (defmacro when-unfocused (name &rest forms) |
62 | "Define a function NAME, executing FORMS, that fires when Emacs | 71 | "Define a function NAME, executing FORMS, that fires when Emacs |
63 | is unfocused." | 72 | is unfocused." |