From 39ead8cdfcaa921beb901ecbf27c19314221aa32 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 18 Dec 2014 11:18:21 -0500 Subject: [PATCH] * lisp/progmodes/cc-cmds.el (c-subword-mode): Alias to subword-mode. (c-update-modeline): * lisp/progmodes/cc-langs.el (c-mode-menu): Use c-subword-mode. * lisp/progmodes/cc-mode.el (subword-mode): Move autoload to cc-cmds.el. (c-mode-base-map): Use c-subword-mode. --- lisp/ChangeLog | 20 ++++++++++++++------ lisp/progmodes/cc-cmds.el | 19 ++++++++++++++++--- lisp/progmodes/cc-langs.el | 6 +++--- lisp/progmodes/cc-mode.el | 7 +------ 4 files changed, 34 insertions(+), 18 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cb8348e1d51..b207deea0de 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,7 +1,15 @@ +2014-12-18 Stefan Monnier + + * progmodes/cc-cmds.el (c-subword-mode): Alias to subword-mode. + (c-update-modeline): + * progmodes/cc-langs.el (c-mode-menu): Use c-subword-mode. + * progmodes/cc-mode.el (subword-mode): Move autoload to cc-cmds.el. + (c-mode-base-map): Use c-subword-mode. + 2014-12-18 Eli Zaretskii - * international/mule-diag.el (describe-font-internal): Display - additional info returned by font-info. + * international/mule-diag.el (describe-font-internal): + Display additional info returned by font-info. * linum.el (linum--face-width): Rename from linum--face-height, and use the new functionality of font-info. @@ -21,8 +29,8 @@ 2014-12-17 Sam Steingold - * emacs-lisp/package.el (package--list-loaded-files): Handle - `(nil ...)' elements in `load-history'. + * emacs-lisp/package.el (package--list-loaded-files): + Handle `(nil ...)' elements in `load-history'. 2014-12-17 Teodor Zlatanov @@ -152,8 +160,8 @@ 2014-12-13 Fabián Ezequiel Gallina - * progmodes/python.el (python-shell-parse-command): Quote - `python-shell-interpreter`. (Bug#19289) + * progmodes/python.el (python-shell-parse-command): + Quote `python-shell-interpreter`. (Bug#19289) 2014-12-12 Stefan Monnier diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el index 55b676b1d9f..0724697f8e8 100644 --- a/lisp/progmodes/cc-cmds.el +++ b/lisp/progmodes/cc-cmds.el @@ -258,9 +258,11 @@ With universal argument, inserts the analysis as a comment on that line." "a" "") (if c-hungry-delete-key "h" "") (if (and - ;; subword might not be loaded. - (boundp 'subword-mode) - (symbol-value 'subword-mode)) + ;; (cc-)subword might not be loaded. + (boundp 'c-subword-mode) + (symbol-value 'c-subword-mode)) + ;; FIXME: subword-mode already comes with its + ;; own lighter! "w" ""))) ;; FIXME: Derived modes might want to use something else @@ -1304,6 +1306,17 @@ keyword on the line, the keyword is not inserted inside a literal, and (declare-function subword-forward "subword" (&optional arg)) (declare-function subword-backward "subword" (&optional arg)) +(cond + ((and (fboundp 'subword-mode) (not (fboundp 'c-subword-mode))) + ;; Recent Emacsen come with their own subword support. Use that. + (define-obsolete-function-alias 'c-subword-mode 'subword-mode "24.3") + (define-obsolete-variable-alias 'c-subword-mode 'subword-mode "24.3")) + (t + ;; Autoload directive for emacsen that doesn't have an older CC Mode + ;; version in the dist. + (autoload 'c-subword-mode "cc-subword" + "Mode enabling subword movement and editing keys." t))) + ;; "nomenclature" functions + c-scope-operator. (defun c-forward-into-nomenclature (&optional arg) "Compatibility alias for `c-forward-subword'." diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index 375725e6834..b93cc780732 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -318,9 +318,9 @@ the evaluated constant value at compile time." :style toggle :selected c-auto-newline] ["Hungry delete" c-toggle-hungry-state :style toggle :selected c-hungry-delete-key] - ["Subword mode" subword-mode - :style toggle :selected (and (boundp 'subword-mode) - subword-mode)]))) + ["Subword mode" c-subword-mode + :style toggle :selected (and (boundp 'c-subword-mode) + c-subword-mode)]))) ;;; Syntax tables. diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 4b8e41f1c54..a4824479b3c 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -108,11 +108,6 @@ ;; with your version of Emacs, you are incompatible! (cc-external-require 'easymenu) -;; Autoload directive for emacsen that doesn't have an older CC Mode -;; version in the dist. -(autoload 'subword-mode "subword" - "Mode enabling subword movement and editing keys." t) - ;; Load cc-fonts first after font-lock is loaded, since it isn't ;; necessary until font locking is requested. ; (eval-after-load "font-lock" ; 2006-07-09: font-lock is now preloaded. @@ -379,7 +374,7 @@ control). See \"cc-mode.el\" for more info." ;; conflicts with OOBR ;;(define-key c-mode-base-map "\C-c\C-v" 'c-version) ;; (define-key c-mode-base-map "\C-c\C-y" 'c-toggle-hungry-state) Commented out by ACM, 2005-11-22. - (define-key c-mode-base-map "\C-c\C-w" 'subword-mode) + (define-key c-mode-base-map "\C-c\C-w" 'c-subword-mode) ) ;; We don't require the outline package, but we configure it a bit anyway. -- 2.39.2