Function: subword-capitalize
subword-capitalize is an interactive and byte-compiled function
defined in subword.el.gz.
Signature
(subword-capitalize ARG)
Documentation
Do the same as capitalize-word but on subwords.
See the command subword-mode(var)/subword-mode(fun) for a description of subwords.
Optional argument ARG is the same as for capitalize-word.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/subword.el.gz
(defun subword-capitalize (arg)
"Do the same as `capitalize-word' but on subwords.
See the command `subword-mode' for a description of subwords.
Optional argument ARG is the same as for `capitalize-word'."
(interactive "p")
(condition-case nil
(let ((count (abs arg))
(start (point))
(advance (>= arg 0)))
(dotimes (_i count)
(if advance
(progn
(re-search-forward "[[:alpha:]]")
(goto-char (match-beginning 0)))
(subword-backward))
(let* ((p (point))
(pp (1+ p))
(np (subword-forward)))
(upcase-region p pp)
(downcase-region pp np)
(goto-char (if advance np p))))
(unless advance
(goto-char start)))
(search-failed nil)))