1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-08 15:35:02 +00:00

* lisp/progmodes/subword.el (subword-capitalize): Fix Stefan's mess.

Fixes: debbugs:15580
This commit is contained in:
Dima Kogan 2013-10-15 23:02:40 -04:00 committed by Stefan Monnier
parent 0283d6b0af
commit a24b996116
2 changed files with 24 additions and 18 deletions

View 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):

View 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)))
(condition-case nil
(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)))))
(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)))