diff options
| author | Masatake YAMATO | 2007-04-09 13:01:30 +0000 |
|---|---|---|
| committer | Masatake YAMATO | 2007-04-09 13:01:30 +0000 |
| commit | 11d13e96b0dfebc7664ec66030b6b5779485fcb8 (patch) | |
| tree | 7ab7f0ddec9c147c6325f59ce476060a3bd21371 | |
| parent | 287787ee7bfb0b1e3178b93745a036206a26fba6 (diff) | |
| download | emacs-11d13e96b0dfebc7664ec66030b6b5779485fcb8.tar.gz emacs-11d13e96b0dfebc7664ec66030b6b5779485fcb8.zip | |
(c-capitalize-subword): Implement
better mimic the behavior of `capitalize-word'. They no longer
move point with a negative argument.
Based on code by Paul Curry.
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/progmodes/cc-subword.el | 19 |
2 files changed, 19 insertions, 7 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 473cb45cf28..b9ed400e30a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2007-04-09 Masatake YAMATO <jet@gyve.org> | ||
| 2 | |||
| 3 | * progmodes/cc-subword.el (c-capitalize-subword): Implement | ||
| 4 | better mimic the behavior of `capitalize-word'. They no longer | ||
| 5 | move point with a negative argument. | ||
| 6 | Based on code by Paul Curry. | ||
| 7 | |||
| 1 | 2007-04-09 Paul Curry <dashteacup@gmail.com> (tiny change) | 8 | 2007-04-09 Paul Curry <dashteacup@gmail.com> (tiny change) |
| 2 | 9 | ||
| 3 | * progmodes/cc-subword.el (c-downcase-subword, c-upcase-subword): | 10 | * progmodes/cc-subword.el (c-downcase-subword, c-upcase-subword): |
diff --git a/lisp/progmodes/cc-subword.el b/lisp/progmodes/cc-subword.el index 9bdd991982b..a6a365d316b 100644 --- a/lisp/progmodes/cc-subword.el +++ b/lisp/progmodes/cc-subword.el | |||
| @@ -246,18 +246,23 @@ See the command `c-subword-mode' for a description of subwords. | |||
| 246 | Optional argument ARG is the same as for `capitalize-word'." | 246 | Optional argument ARG is the same as for `capitalize-word'." |
| 247 | (interactive "p") | 247 | (interactive "p") |
| 248 | (let ((count (abs arg)) | 248 | (let ((count (abs arg)) |
| 249 | (direction (if (< 0 arg) 1 -1))) | 249 | (start (point)) |
| 250 | (advance (if (< arg 0) nil t))) | ||
| 250 | (dotimes (i count) | 251 | (dotimes (i count) |
| 251 | (when (re-search-forward | 252 | (if advance |
| 252 | (concat "[" c-alpha "]") | 253 | (progn (re-search-forward |
| 253 | nil t) | 254 | (concat "[" c-alpha "]") |
| 254 | (goto-char (match-beginning 0))) | 255 | nil t) |
| 256 | (goto-char (match-beginning 0))) | ||
| 257 | (c-backward-subword)) | ||
| 255 | (let* ((p (point)) | 258 | (let* ((p (point)) |
| 256 | (pp (1+ p)) | 259 | (pp (1+ p)) |
| 257 | (np (c-forward-subword direction))) | 260 | (np (c-forward-subword))) |
| 258 | (upcase-region p pp) | 261 | (upcase-region p pp) |
| 259 | (downcase-region pp np) | 262 | (downcase-region pp np) |
| 260 | (goto-char np))))) | 263 | (goto-char (if advance np p)))) |
| 264 | (unless advance | ||
| 265 | (goto-char start)))) | ||
| 261 | 266 | ||
| 262 | 267 | ||
| 263 | 268 | ||