emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/progmodes/cc-subword.el


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/lisp/progmodes/cc-subword.el
Date: Wed, 26 Apr 2006 20:21:58 +0000

Index: emacs/lisp/progmodes/cc-subword.el
diff -u emacs/lisp/progmodes/cc-subword.el:1.2 
emacs/lisp/progmodes/cc-subword.el:1.3
--- emacs/lisp/progmodes/cc-subword.el:1.2      Fri Feb 10 09:00:31 2006
+++ emacs/lisp/progmodes/cc-subword.el  Wed Apr 26 20:21:56 2006
@@ -107,36 +107,19 @@
 
   (defvar c-subword-mode-map
     (let ((map (make-sparse-keymap)))
-      (substitute-key-definition 'forward-word
-                                'c-forward-subword
-                                map global-map)
-      (substitute-key-definition 'backward-word
-                                'c-backward-subword
-                                map global-map)
-      (substitute-key-definition 'mark-word
-                                'c-mark-subword
-                                map global-map)
-    
-      (substitute-key-definition 'kill-word
-                                'c-kill-subword
-                                map global-map)
-      (substitute-key-definition 'backward-kill-word
-                                'c-backward-kill-subword
-                                map global-map)
-    
-      (substitute-key-definition 'transpose-words
-                                'c-transpose-subwords
-                                map global-map)
-    
-      (substitute-key-definition 'capitalize-word
-                                'c-capitalize-subword
-                                map global-map)
-      (substitute-key-definition 'upcase-word
-                                'c-upcase-subword
-                                map global-map)
-      (substitute-key-definition 'downcase-word
-                                'c-downcase-subword
-                                map global-map)
+      (dolist (cmd '(forward-word backward-word mark-word
+                     kill-word backward-kill-word
+                     transpose-words
+                     capitalize-word upcase-word downcase-word))
+        (let ((othercmd (let ((name (symbol-name cmd)))
+                          (string-match "\\(.*-\\)\\(word.*\\)" name)
+                          (intern (concat "c-"
+                                          (match-string 1 name)
+                                          "sub"
+                                          (match-string 2 name))))))
+          (if (fboundp 'command-remapping)
+              (define-key map (vector 'remap cmd) othercmd)
+            (substitute-key-definition cmd othercmd map global-map))))
       map)
     "Keymap used in command `c-subword-mode' minor mode.")
 
@@ -308,5 +291,5 @@
 
 (cc-provide 'cc-subword)
 
-;;; arch-tag: 2be9d294-7f30-4626-95e6-9964bb93c7a3
+;; arch-tag: 2be9d294-7f30-4626-95e6-9964bb93c7a3
 ;;; cc-subword.el ends here




reply via email to

[Prev in Thread] Current Thread [Next in Thread]