aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZachary Kanfer2015-09-26 11:09:19 +0300
committerEli Zaretskii2015-09-26 11:09:19 +0300
commit80cc5d13d4ceee0fae75e28ee75f351425ada1a9 (patch)
tree1ce8bc3f13c40ca53ac910d1006fd6c3cfca72e2
parent7b532d3e26197e5d4d65d1442c34ce7e27cf9d0b (diff)
downloademacs-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.el32
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.
8430If the region is active, this function calls `upcase-region'.
8431Otherwise, it calls `upcase-word', with prefix argument passed to it
8432to 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.
8440If the region is active, this function calls `downcase-region'.
8441Otherwise, it calls `downcase-word', with prefix argument passed to it
8442to 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.
8450If the region is active, this function calls `capitalize-region'.
8451Otherwise, it calls `capitalize-word', with prefix argument passed to it
8452to 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