From 27558c0dd51aafd1a94555b5911e4905e48025d7 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Tue, 18 Dec 2007 02:32:04 +0000 Subject: [PATCH] (c-subword-mode): Drop support for systems without define-minor-mode. --- lisp/progmodes/cc-subword.el | 62 ++++++++++++------------------------ 1 file changed, 21 insertions(+), 41 deletions(-) diff --git a/lisp/progmodes/cc-subword.el b/lisp/progmodes/cc-subword.el index d3e613fa254..0838a2ef6af 100644 --- a/lisp/progmodes/cc-subword.el +++ b/lisp/progmodes/cc-subword.el @@ -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 , -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.") - - ;; 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. +(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.") + +;;;###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 @@ as words. 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. -- 2.39.2