]> git.eshelyaron.com Git - emacs.git/commitdiff
(c-capitalize-subword): Implement
authorMasatake YAMATO <jet@gyve.org>
Mon, 9 Apr 2007 13:01:30 +0000 (13:01 +0000)
committerMasatake YAMATO <jet@gyve.org>
Mon, 9 Apr 2007 13:01:30 +0000 (13:01 +0000)
better mimic the behavior of `capitalize-word'. They no longer
move point with a  negative argument.
Based on code by Paul Curry.

lisp/ChangeLog
lisp/progmodes/cc-subword.el

index 473cb45cf2825a09a6dc26e7a26ef4a19b0d3b7e..b9ed400e30a33fc6207a93a2a8b3b44500fb66d5 100644 (file)
@@ -1,3 +1,10 @@
+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): 
index 9bdd991982b723d37ac1f7c291d0292f40409328..a6a365d316b2434edfdb736981578e0138b3608c 100644 (file)
@@ -246,18 +246,23 @@ See the command `c-subword-mode' for a description of subwords.
 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