changeset 87314:238289d30e93

(c-subword-mode): Drop support for systems without define-minor-mode.
author Glenn Morris <rgm@gnu.org>
date Tue, 18 Dec 2007 02:32:04 +0000
parents 119f37472d94
children 34b619baa980
files lisp/progmodes/cc-subword.el
diffstat 1 files changed, 20 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/cc-subword.el	Tue Dec 18 02:31:15 2007 +0000
+++ b/lisp/progmodes/cc-subword.el	Tue Dec 18 02:32:04 2007 +0000
@@ -88,45 +88,27 @@
 (cc-require 'cc-defs)
 (cc-require 'cc-cmds)
 
-;; Don't complain about the `define-minor-mode' form if it isn't defined.
-(cc-bytecomp-defvar c-subword-mode)
-
-;; Autoload directives must be on the top level, so we construct an
-;; autoload form instead.
-;;;###autoload (autoload 'c-subword-mode "cc-subword" "Mode enabling subword movement and editing keys." t)
-
-(if (not (fboundp 'define-minor-mode))
-    (defun c-subword-mode ()
-      "(Missing) mode enabling subword movement and editing keys.
-This mode is not (yet) available in this version of (X)Emacs.  Sorry!  If
-you really want it, please send a request to <bug-gnu-emacs@gnu.org>,
-telling us which (X)Emacs version you're using."
-      (interactive)
-      (error
-       "c-subword-mode is not (yet) available in this version of (X)Emacs.  Sorry!"))
+(defvar c-subword-mode-map
+  (let ((map (make-sparse-keymap)))
+    (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.")
 
-  (defvar c-subword-mode-map
-    (let ((map (make-sparse-keymap)))
-      (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.")
-
-  ;; Produces compiler warning about make-variable-buffer-local not
-  ;; being called at toplevel (due to fboundp test).
-  (define-minor-mode c-subword-mode
-    "Mode enabling subword movement and editing keys.
+;;;###autoload
+(define-minor-mode c-subword-mode
+  "Mode enabling subword movement and editing keys.
 In spite of GNU Coding Standards, it is popular to name a symbol by
 mixing uppercase and lowercase letters, e.g. \"GtkWidget\",
 \"EmacsFrameClass\", \"NSGraphicsContext\", etc.  Here we call these
@@ -150,8 +132,6 @@
     c-subword-mode-map
     (c-update-modeline))
 
-  )
-
 (defun c-forward-subword (&optional arg)
   "Do the same as `forward-word' but on subwords.
 See the command `c-subword-mode' for a description of subwords.