Created
October 9, 2014 19:50
-
-
Save jmdeldin/9a27f0a9a186abb7e2f8 to your computer and use it in GitHub Desktop.
Uppercase MySQL keywords in Emacs
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
(defun jm/fix-sql-case (start end) | |
"Uppercase SQL keywords" | |
(interactive "r") | |
(save-restriction | |
(narrow-to-region start end) | |
(goto-char 1) | |
(let ((case-fold-search nil)) | |
(while (search-forward-regexp | |
(mapconcat 'downcase (mapcar 'symbol-name '(select from inner outer left join where and in group by into on)) "\\|") | |
nil t) | |
(replace-match (upcase (match-string 0)) t nil))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment