Last active
May 15, 2016 14:22
-
-
Save aont/5b60a7521b5cad12690f4142a4122202 to your computer and use it in GitHub Desktop.
kill-region only when any region is selected
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (global-set-key | |
| "\C-w" | |
| (lambda () | |
| (interactive) | |
| (if (region-active-p) | |
| (kill-region (region-beginning) (region-end) ) | |
| (message "Please set region") | |
| ) | |
| ) | |
| ) | |
| (global-set-key | |
| "\M-w" | |
| (lambda () | |
| (interactive) | |
| (when (region-active-p) | |
| (kill-new (buffer-substring-no-properties (region-beginning) (region-end))) | |
| (message "kill") | |
| ) | |
| ) | |
| ) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment