diff options
| author | Dima Kogan | 2013-10-14 15:20:29 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2013-10-14 15:20:29 -0400 |
| commit | c2de5588b4c8799f9b5a545bbace588f2454640e (patch) | |
| tree | 5d2702d8c317c5f8a722b8f4b697ec1a88ad72f0 | |
| parent | 279066b2b3a56e94c4a5dc994e0349db03a52c09 (diff) | |
| download | emacs-c2de5588b4c8799f9b5a545bbace588f2454640e.tar.gz emacs-c2de5588b4c8799f9b5a545bbace588f2454640e.zip | |
* lisp/progmodes/subword.el (subword-capitalize): Be careful when
the search for [[:alpha:]] fails.
Fixes: debbugs:15580
| -rw-r--r-- | lisp/ChangeLog | 17 | ||||
| -rw-r--r-- | lisp/progmodes/subword.el | 37 |
2 files changed, 30 insertions, 24 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4471d4c2b25..ea25c557a51 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2013-10-14 Dima Kogan <dima@secretsauce.net> (tiny change) | ||
| 2 | |||
| 3 | * progmodes/subword.el (subword-capitalize): Be careful when | ||
| 4 | the search for [[:alpha:]] fails (bug#15580). | ||
| 5 | |||
| 1 | 2013-10-14 Eli Zaretskii <eliz@gnu.org> | 6 | 2013-10-14 Eli Zaretskii <eliz@gnu.org> |
| 2 | 7 | ||
| 3 | * menu-bar.el (tty-menu-navigation-map): Bind shifted mouse clicks | 8 | * menu-bar.el (tty-menu-navigation-map): Bind shifted mouse clicks |
| @@ -5,8 +10,8 @@ | |||
| 5 | 10 | ||
| 6 | 2013-10-14 Dmitry Gutov <dgutov@yandex.ru> | 11 | 2013-10-14 Dmitry Gutov <dgutov@yandex.ru> |
| 7 | 12 | ||
| 8 | * progmodes/ruby-mode.el (ruby-smie--args-separator-p): Handle | 13 | * progmodes/ruby-mode.el (ruby-smie--args-separator-p): |
| 9 | methods ending with `?' and `!'. | 14 | Handle methods ending with `?' and `!'. |
| 10 | 15 | ||
| 11 | 2013-10-14 Akinori MUSHA <knu@iDaemons.org> | 16 | 2013-10-14 Akinori MUSHA <knu@iDaemons.org> |
| 12 | 17 | ||
| @@ -41,8 +46,8 @@ | |||
| 41 | Fix indentation/fontification of Java enum with | 46 | Fix indentation/fontification of Java enum with |
| 42 | "implements"/generic. | 47 | "implements"/generic. |
| 43 | 48 | ||
| 44 | * progmodes/cc-engine.el (c-backward-over-enum-header): Extracted | 49 | * progmodes/cc-engine.el (c-backward-over-enum-header): |
| 45 | from the three other places and enhanced to handle generics. | 50 | Extracted from the three other places and enhanced to handle generics. |
| 46 | (c-inside-bracelist-p): Uses new function above. | 51 | (c-inside-bracelist-p): Uses new function above. |
| 47 | * progmodes/cc-fonts.el (c-font-lock-declarations): Uses new | 52 | * progmodes/cc-fonts.el (c-font-lock-declarations): Uses new |
| 48 | function above. | 53 | function above. |
| @@ -230,8 +235,8 @@ | |||
| 230 | 235 | ||
| 231 | * tooltip.el (tooltip-mode): Don't error out on TTYs. | 236 | * tooltip.el (tooltip-mode): Don't error out on TTYs. |
| 232 | 237 | ||
| 233 | * menu-bar.el (popup-menu, popup-menu-normalize-position): Moved | 238 | * menu-bar.el (popup-menu, popup-menu-normalize-position): |
| 234 | here from mouse.el. | 239 | Move here from mouse.el. |
| 235 | (popup-menu): Support menu-bar navigation on TTYs using C-f/C-b | 240 | (popup-menu): Support menu-bar navigation on TTYs using C-f/C-b |
| 236 | and arrow keys. | 241 | and arrow keys. |
| 237 | (tty-menu-navigation-map): New map for TTY menu navigation. | 242 | (tty-menu-navigation-map): New map for TTY menu navigation. |
diff --git a/lisp/progmodes/subword.el b/lisp/progmodes/subword.el index 8cf4feb62cb..1232588ca32 100644 --- a/lisp/progmodes/subword.el +++ b/lisp/progmodes/subword.el | |||
| @@ -257,24 +257,25 @@ Optional argument ARG is the same as for `upcase-word'." | |||
| 257 | See the command `subword-mode' for a description of subwords. | 257 | See the command `subword-mode' for a description of subwords. |
| 258 | Optional argument ARG is the same as for `capitalize-word'." | 258 | Optional argument ARG is the same as for `capitalize-word'." |
| 259 | (interactive "p") | 259 | (interactive "p") |
| 260 | (let ((count (abs arg)) | 260 | (catch 'search-failed |
| 261 | (start (point)) | 261 | (let ((count (abs arg)) |
| 262 | (advance (if (< arg 0) nil t))) | 262 | (start (point)) |
| 263 | (dotimes (i count) | 263 | (advance (>= arg 0))) |
| 264 | (if advance | 264 | |
| 265 | (progn (re-search-forward | 265 | (dotimes (i count) |
| 266 | (concat "[[:alpha:]]") | 266 | (if advance |
| 267 | nil t) | 267 | (progn |
| 268 | (goto-char (match-beginning 0))) | 268 | (search-forward "[[:alpha:]]") |
| 269 | (subword-backward)) | 269 | (goto-char (match-beginning 0))) |
| 270 | (let* ((p (point)) | 270 | (subword-backward)) |
| 271 | (pp (1+ p)) | 271 | (let* ((p (point)) |
| 272 | (np (subword-forward))) | 272 | (pp (1+ p)) |
| 273 | (upcase-region p pp) | 273 | (np (subword-forward))) |
| 274 | (downcase-region pp np) | 274 | (upcase-region p pp) |
| 275 | (goto-char (if advance np p)))) | 275 | (downcase-region pp np) |
| 276 | (unless advance | 276 | (goto-char (if advance np p)))) |
| 277 | (goto-char start)))) | 277 | (unless advance |
| 278 | (goto-char start))))) | ||
| 278 | 279 | ||
| 279 | 280 | ||
| 280 | 281 | ||