Created
August 14, 2009 04:16
-
-
Save doitian/167640 to your computer and use it in GitHub Desktop.
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
| ;;; The command is extracted from interactively query-replace-regexp: | |
| ;;; 1) M-C-% or "M-x query-replace-regexp" | |
| ;;; 2) Search: \<[[:upper:]]\{2,\}\> | |
| ;;; 3) Replace: \,(capitalize \&) | |
| ;;; 4) After finish the query replace, use C-x M-: to extract the command | |
| (defun iy/query-capitalize-upper-word () | |
| "Capitalize the word with all letters in upcase" | |
| (interactive) | |
| (query-replace-regexp | |
| "\\<[[:upper:]]\\{2,\\}\\>" | |
| (quote (replace-eval-replacement | |
| replace-quote (capitalize (match-string 0)))) | |
| nil | |
| (if (and transient-mark-mode mark-active) | |
| (region-beginning)) | |
| (if (and transient-mark-mode mark-active) | |
| (region-end)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment