mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-13 09:32:47 +00:00
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 set-keymap-parents. (c-make-inherited-keymap): Use c-set-keymap-parent in place of inline code.
This commit is contained in:
parent
01a98e918d
commit
125a8a62db
@ -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)
|
||||
(cond
|
||||
;; 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.
|
||||
(cond
|
||||
;; 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)
|
||||
map))
|
||||
|
||||
(defun c-define-abbrev-table (name defs &optional doc)
|
||||
|
Loading…
Reference in New Issue
Block a user