diff options
author | Dima Kogan <dima@secretsauce.net> | 2013-10-15 23:02:40 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2013-10-15 23:02:40 -0400 |
commit | a24b996116895c3bc8c78842ba014711fad4839c (patch) | |
tree | 4b96b7d746a2ea7ccb7ddbea8551f1d54995ea78 /lisp/progmodes/subword.el | |
parent | 0283d6b0afbae2d45a10e95e47d753dd20ce2b04 (diff) | |
download | emacs-a24b996116895c3bc8c78842ba014711fad4839c.tar.gz emacs-a24b996116895c3bc8c78842ba014711fad4839c.tar.bz2 emacs-a24b996116895c3bc8c78842ba014711fad4839c.zip |
* lisp/progmodes/subword.el (subword-capitalize): Fix Stefan's mess.
Fixes: debbugs:15580
Diffstat (limited to 'lisp/progmodes/subword.el')
-rw-r--r-- | lisp/progmodes/subword.el | 39 |
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))) |