aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim F. Storm2006-05-14 00:19:13 +0000
committerKim F. Storm2006-05-14 00:19:13 +0000
commit5e8c9892ef5e73c8b6f04a61ffa8b7f64efee54f (patch)
tree65c59cb2bd9ad8121539adb3e97b2e8cd62d7b9d
parentdac85f4b38ae8722b01dfab956b7a5b97955763e (diff)
downloademacs-5e8c9892ef5e73c8b6f04a61ffa8b7f64efee54f.tar.gz
emacs-5e8c9892ef5e73c8b6f04a61ffa8b7f64efee54f.zip
(c-forward-subword, c-backward-subword):
Add CUA move property.
-rw-r--r--lisp/progmodes/cc-subword.el22
1 files changed, 13 insertions, 9 deletions
diff --git a/lisp/progmodes/cc-subword.el b/lisp/progmodes/cc-subword.el
index 72227e33290..c1ed9e300e7 100644
--- a/lisp/progmodes/cc-subword.el
+++ b/lisp/progmodes/cc-subword.el
@@ -167,6 +167,8 @@ Optional argument ARG is the same as for `forward-word'."
167 (t 167 (t
168 (point)))) 168 (point))))
169 169
170(put 'c-forward-subword 'CUA 'move)
171
170(defun c-backward-subword (&optional arg) 172(defun c-backward-subword (&optional arg)
171 "Do the same as `backward-word' but on subwords. 173 "Do the same as `backward-word' but on subwords.
172See the command `c-subword-mode' for a description of subwords. 174See the command `c-subword-mode' for a description of subwords.
@@ -193,6 +195,8 @@ Optional argument ARG is the same as for `mark-word'."
193 (point)) 195 (point))
194 nil t)))) 196 nil t))))
195 197
198(put 'c-backward-subword 'CUA 'move)
199
196(defun c-kill-subword (arg) 200(defun c-kill-subword (arg)
197 "Do the same as `kill-word' but on subwords. 201 "Do the same as `kill-word' but on subwords.
198See the command `c-subword-mode' for a description of subwords. 202See the command `c-subword-mode' for a description of subwords.
@@ -222,7 +226,7 @@ Optional argument ARG is the same as for `capitalize-word'."
222 (let ((count (abs arg)) 226 (let ((count (abs arg))
223 (direction (if (< 0 arg) 1 -1))) 227 (direction (if (< 0 arg) 1 -1)))
224 (dotimes (i count) 228 (dotimes (i count)
225 (when (re-search-forward 229 (when (re-search-forward
226 (concat "[" c-alpha "]") 230 (concat "[" c-alpha "]")
227 nil t) 231 nil t)
228 (goto-char (match-beginning 0))) 232 (goto-char (match-beginning 0)))
@@ -253,15 +257,15 @@ Optional argument ARG is the same as for `upcase-word'."
253;; 257;;
254(defun c-forward-subword-internal () 258(defun c-forward-subword-internal ()
255 (if (and 259 (if (and
256 (save-excursion 260 (save-excursion
257 (let ((case-fold-search nil)) 261 (let ((case-fold-search nil))
258 (re-search-forward 262 (re-search-forward
259 (concat "\\W*\\(\\([" c-upper "]*\\W?\\)[" c-lower c-digit "]*\\)") 263 (concat "\\W*\\(\\([" c-upper "]*\\W?\\)[" c-lower c-digit "]*\\)")
260 nil t))) 264 nil t)))
261 (> (match-end 0) (point))) ; So we don't get stuck at a 265 (> (match-end 0) (point))) ; So we don't get stuck at a
262 ; "word-constituent" which isn't c-upper, 266 ; "word-constituent" which isn't c-upper,
263 ; c-lower or c-digit 267 ; c-lower or c-digit
264 (goto-char 268 (goto-char
265 (cond 269 (cond
266 ((< 1 (- (match-end 2) (match-beginning 2))) 270 ((< 1 (- (match-end 2) (match-beginning 2)))
267 (1- (match-end 2))) 271 (1- (match-end 2)))
@@ -271,15 +275,15 @@ Optional argument ARG is the same as for `upcase-word'."
271 275
272 276
273(defun c-backward-subword-internal () 277(defun c-backward-subword-internal ()
274 (if (save-excursion 278 (if (save-excursion
275 (let ((case-fold-search nil)) 279 (let ((case-fold-search nil))
276 (re-search-backward 280 (re-search-backward
277 (concat 281 (concat
278 "\\(\\(\\W\\|[" c-lower c-digit "]\\)\\([" c-upper "]+\\W*\\)" 282 "\\(\\(\\W\\|[" c-lower c-digit "]\\)\\([" c-upper "]+\\W*\\)"
279 "\\|\\W\\w+\\)") 283 "\\|\\W\\w+\\)")
280 nil t))) 284 nil t)))
281 (goto-char 285 (goto-char
282 (cond 286 (cond
283 ((and (match-end 3) 287 ((and (match-end 3)
284 (< 1 (- (match-end 3) (match-beginning 3))) 288 (< 1 (- (match-end 3) (match-beginning 3)))
285 (not (eq (point) (match-end 3)))) 289 (not (eq (point) (match-end 3))))