Commit 125a8a62 authored by Alan Mackenzie's avatar Alan Mackenzie
Browse files

CC Mode: create and use c-set-keymap-parent.

* lisp/progmodes/cc-defs.el (c-set-keymap-parent): New macro.

* lisp/progmodes/cc-mode.el (top-level): Remove cc-bytecomp-defun for
(c-make-inherited-keymap): Use c-set-keymap-parent in place of inline code.
parent 01a98e91
......@@ -417,6 +417,17 @@ to it is returned. This function does not modify the point or the mark."
;; Emacs.
`(setq mark-active ,activate)))
(defmacro c-set-keymap-parent (map parent)
;; XEmacs
((cc-bytecomp-fboundp 'set-keymap-parents)
`(set-keymap-parents ,map ,parent))
;; Emacs
((cc-bytecomp-fboundp 'set-keymap-parent)
`(set-keymap-parent ,map ,parent))
;; incompatible
(t (error "CC Mode is incompatible with this version of Emacs"))))
(defmacro c-delete-and-extract-region (start end)
"Delete the text between START and END and return it."
(if (cc-bytecomp-fboundp 'delete-and-extract-region)
......@@ -1266,6 +1277,7 @@ with value CHAR in the region [FROM to)."
(def-edebug-spec cc-eval-when-compile (&rest def-form))
(def-edebug-spec c-point t)
(def-edebug-spec c-set-region-active t)
(def-edebug-spec c-set-keymap-parent t)
(def-edebug-spec c-safe t)
(def-edebug-spec c-save-buffer-state let*)
(def-edebug-spec c-tentative-buffer-changes t)
......@@ -225,18 +225,7 @@ control). See \"cc-mode.el\" for more info."
(defun c-make-inherited-keymap ()
(let ((map (make-sparse-keymap)))
;; Necessary to use `cc-bytecomp-fboundp' below since this
;; function is called from top-level forms that are evaluated
;; while cc-bytecomp is active when one does M-x eval-buffer.
;; Emacs
((cc-bytecomp-fboundp 'set-keymap-parent)
(set-keymap-parent map c-mode-base-map))
;; XEmacs
((fboundp 'set-keymap-parents)
(set-keymap-parents map c-mode-base-map))
;; incompatible
(t (error "CC Mode is incompatible with this version of Emacs")))
(c-set-keymap-parent map c-mode-base-map)
(defun c-define-abbrev-table (name defs &optional doc)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment