diff options
| author | Zachary Kanfer | 2015-09-26 11:09:19 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2015-09-26 11:09:19 +0300 |
| commit | 80cc5d13d4ceee0fae75e28ee75f351425ada1a9 (patch) | |
| tree | 1ce8bc3f13c40ca53ac910d1006fd6c3cfca72e2 | |
| parent | 7b532d3e26197e5d4d65d1442c34ce7e27cf9d0b (diff) | |
| download | emacs-80cc5d13d4ceee0fae75e28ee75f351425ada1a9.tar.gz emacs-80cc5d13d4ceee0fae75e28ee75f351425ada1a9.zip | |
New DWIM commands for changing letter-case
* lisp/simple.el (upcase-dwim, downcase-dwim, capitalize-dwim):
New functions. (Bug#21501)
Copyright-paperwork-exempt: yes
| -rw-r--r-- | lisp/simple.el | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index f80faae80d8..8acb6839744 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -8424,6 +8424,38 @@ contains the list of implementations currently supported for this command." | |||
| 8424 | command-name))))))) | 8424 | command-name))))))) |
| 8425 | 8425 | ||
| 8426 | 8426 | ||
| 8427 | ;;; Functions for changing capitalization that Do What I Mean | ||
| 8428 | (defun upcase-dwim (arg) | ||
| 8429 | "Upcase words in the region, if active; if not, upcase word at point. | ||
| 8430 | If the region is active, this function calls `upcase-region'. | ||
| 8431 | Otherwise, it calls `upcase-word', with prefix argument passed to it | ||
| 8432 | to upcase ARG words." | ||
| 8433 | (interactive "*p") | ||
| 8434 | (if (use-region-p) | ||
| 8435 | (upcase-region (region-beginning) (region-end)) | ||
| 8436 | (upcase-word arg))) | ||
| 8437 | |||
| 8438 | (defun downcase-dwim (arg) | ||
| 8439 | "Downcase words in the region, if active; if not, downcase word at point. | ||
| 8440 | If the region is active, this function calls `downcase-region'. | ||
| 8441 | Otherwise, it calls `downcase-word', with prefix argument passed to it | ||
| 8442 | to downcase ARG words." | ||
| 8443 | (interactive "*p") | ||
| 8444 | (if (use-region-p) | ||
| 8445 | (downcase-region (region-beginning) (region-end)) | ||
| 8446 | (downcase-word arg))) | ||
| 8447 | |||
| 8448 | (defun capitalize-dwim (arg) | ||
| 8449 | "Capitalize words in the region, if active; if not, capitalize word at point. | ||
| 8450 | If the region is active, this function calls `capitalize-region'. | ||
| 8451 | Otherwise, it calls `capitalize-word', with prefix argument passed to it | ||
| 8452 | to capitalize ARG words." | ||
| 8453 | (interactive "*p") | ||
| 8454 | (if (use-region-p) | ||
| 8455 | (capitalize-region (region-beginning) (region-end)) | ||
| 8456 | (capitalize-word arg))) | ||
| 8457 | |||
| 8458 | |||
| 8427 | 8459 | ||
| 8428 | (provide 'simple) | 8460 | (provide 'simple) |
| 8429 | 8461 | ||