* lisp/progmodes/subword.el (subword-capitalize): Fix Stefan's mess.
authorDima Kogan <dima@secretsauce.net>
Wed, 16 Oct 2013 03:02:40 +0000 (23:02 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Wed, 16 Oct 2013 03:02:40 +0000 (23:02 -0400)
Fixes: debbugs:15580

lisp/ChangeLog
lisp/progmodes/subword.el

index f51947f..134219a 100644 (file)
@@ -1,3 +1,8 @@
+2013-10-16  Dima Kogan  <dima@secretsauce.net>  (tiny change)
+
+       * progmodes/subword.el (subword-capitalize): Fix Stefan's mess
+       (bug#15580).
+
 2013-10-16  Glenn Morris  <rgm@gnu.org>
 
        * ansi-color.el (ansi-color-drop-regexp):
index 1232588..15535ba 100644 (file)
@@ -257,25 +257,26 @@ Optional argument ARG is the same as for `upcase-word'."
 See the command `subword-mode' for a description of subwords.
 Optional argument ARG is the same as for `capitalize-word'."
   (interactive "p")
-  (catch 'search-failed
-    (let ((count (abs arg))
-          (start (point))
-          (advance (>= arg 0)))
-
-      (dotimes (i count)
-        (if advance
-            (progn
-              (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)))))
+  (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)))
 
 \f