Created
December 28, 2013 13:37
-
-
Save Philonous/8159582 to your computer and use it in GitHub Desktop.
This file contains 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 smart-hyphen (n) | |
"Capitalize the next word, or behave as the usual '-'." | |
(interactive "p") | |
(if (memq (get-text-property (point) 'face) | |
'(font-lock-doc-face | |
font-lock-comment-face | |
font-lock-string-face)) | |
(self-insert-command n) | |
(progn (insert ?-) | |
(let ((next (read-char))) | |
(insert (if (eq ?w (char-syntax next)) | |
(progn | |
(delete-char -1) | |
(upcase next)) | |
next)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment