summaryrefslogtreecommitdiff
path: root/lisp/progmodes/subword.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/progmodes/subword.el')
-rw-r--r--lisp/progmodes/subword.el39
1 files changed, 20 insertions, 19 deletions
diff --git a/lisp/progmodes/subword.el b/lisp/progmodes/subword.el
index 1232588ca32..15535ba4f52 100644
--- a/lisp/progmodes/subword.el
+++ b/lisp/progmodes/subword.el
@@ -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)))