Following the Mode Tutorial, I /almost/ finished my own mode (my-mode). Now I only have the problem, that my mode-map settings seem to be ignored:
(defvar my-mode-map (let ((map (make-sparse-keymap))) (define-key map [(return)] 'newline-and-indent) (define-key map [(meta-y)] 'imenu ) (define-key map [(control-c) (control-c)] 'compile ) map) "Keymap for `my-mode'.") ;;;###autoload (define-derived-mode my-mode fundamental-mode "My" "A major mode for editing My files." :syntax-table my-mode-syntax-table (setq-local comment-start "// ") (setq-local comment-end "") (setq-local comment-start-skip "\\s<+\\s-*") (setq-local font-lock-defaults '(my-font-lock-keywords nil t) ) (setq-local tab-width 2) (setq-local default-tab-width 2) (setq-local indent-line-function 'my-indent-line) (setq-local compile-command (my-compiler-command)) (setq-local imenu-generic-expression '((nil "^\\s *EventList\\s +\\(\\sw+\\)" 1)) ) )
The elisp-info tells me that:
• The new mode has its own sparse keymap, named `VARIANT-map`. `define-derived-mode` makes the parent mode’s keymap the parent of the new map, unless `VARIANT-map` is already set and already has a parent.
So I think that my map should be active. When I open a file that uses
my-mode-map is defined:
my-mode-map is a variable defined in `my.el`. Its value is (keymap (control-c keymap (control-c . compile)) (meta-y . imenu) (return . newline-and-indent))
(describe-key-briefly) tells me:
C-c C-c is undefined
On my last post, I made the error that I didn't restart Emacs from scratch, when reproducing this error. This time I did so and I still see this behaviour...
Why is my map not active?