+2007-04-09 Masatake YAMATO <jet@gyve.org>
+
+ * progmodes/cc-subword.el (c-capitalize-subword): Implement
+ better mimic the behavior of `capitalize-word'. They no longer
+ move point with a negative argument.
+ Based on code by Paul Curry.
+
2007-04-09 Paul Curry <dashteacup@gmail.com> (tiny change)
* progmodes/cc-subword.el (c-downcase-subword, c-upcase-subword):
Optional argument ARG is the same as for `capitalize-word'."
(interactive "p")
(let ((count (abs arg))
- (direction (if (< 0 arg) 1 -1)))
+ (start (point))
+ (advance (if (< arg 0) nil t)))
(dotimes (i count)
- (when (re-search-forward
- (concat "[" c-alpha "]")
- nil t)
- (goto-char (match-beginning 0)))
+ (if advance
+ (progn (re-search-forward
+ (concat "[" c-alpha "]")
+ nil t)
+ (goto-char (match-beginning 0)))
+ (c-backward-subword))
(let* ((p (point))
(pp (1+ p))
- (np (c-forward-subword direction)))
+ (np (c-forward-subword)))
(upcase-region p pp)
(downcase-region pp np)
- (goto-char np)))))
+ (goto-char (if advance np p))))
+ (unless advance
+ (goto-char start))))
\f