# HG changeset patch # User Kim F. Storm # Date 1147565953 0 # Node ID 4cc85f377783823d64b00b489d79012d310d6aa5 # Parent 0ef29cb33be4d2c1b69b1bc29793b672d4f24eea (c-forward-subword, c-backward-subword): Add CUA move property. diff -r 0ef29cb33be4 -r 4cc85f377783 lisp/progmodes/cc-subword.el --- a/lisp/progmodes/cc-subword.el Sat May 13 18:32:00 2006 +0000 +++ b/lisp/progmodes/cc-subword.el Sun May 14 00:19:13 2006 +0000 @@ -167,6 +167,8 @@ (t (point)))) +(put 'c-forward-subword 'CUA 'move) + (defun c-backward-subword (&optional arg) "Do the same as `backward-word' but on subwords. See the command `c-subword-mode' for a description of subwords. @@ -193,6 +195,8 @@ (point)) nil t)))) +(put 'c-backward-subword 'CUA 'move) + (defun c-kill-subword (arg) "Do the same as `kill-word' but on subwords. See the command `c-subword-mode' for a description of subwords. @@ -222,7 +226,7 @@ (let ((count (abs arg)) (direction (if (< 0 arg) 1 -1))) (dotimes (i count) - (when (re-search-forward + (when (re-search-forward (concat "[" c-alpha "]") nil t) (goto-char (match-beginning 0))) @@ -253,15 +257,15 @@ ;; (defun c-forward-subword-internal () (if (and - (save-excursion + (save-excursion (let ((case-fold-search nil)) - (re-search-forward + (re-search-forward (concat "\\W*\\(\\([" c-upper "]*\\W?\\)[" c-lower c-digit "]*\\)") nil t))) (> (match-end 0) (point))) ; So we don't get stuck at a ; "word-constituent" which isn't c-upper, ; c-lower or c-digit - (goto-char + (goto-char (cond ((< 1 (- (match-end 2) (match-beginning 2))) (1- (match-end 2))) @@ -271,15 +275,15 @@ (defun c-backward-subword-internal () - (if (save-excursion - (let ((case-fold-search nil)) + (if (save-excursion + (let ((case-fold-search nil)) (re-search-backward (concat "\\(\\(\\W\\|[" c-lower c-digit "]\\)\\([" c-upper "]+\\W*\\)" - "\\|\\W\\w+\\)") + "\\|\\W\\w+\\)") nil t))) - (goto-char - (cond + (goto-char + (cond ((and (match-end 3) (< 1 (- (match-end 3) (match-beginning 3))) (not (eq (point) (match-end 3))))