Hi,
I'm the author of the (rewritten) go-mode and am trying to keep it
compatible with XEmacs.
One particular problem I am facing right now is that GNU Emacs 24 offers
prog-mode to derive from, while older GNU Emacs and Xemacs do not. So
for those, I want to derive from fundamental-mode instead.
The way I initially solved it for GNU Emacs was with an alias a la
(defalias 'go--prog-mode
(if (fboundp 'prog-mode) 'prog-mode 'fundamental-mode))
which I then used in the mode definition:
(define-derived-mode go-mode go--prog-mode "Go"
In GNU Emacs, this works fine. XEmacs, however, apparently tries to
inherit the keymap from go--prog-mode, instead of what it points to (in
this case fundamental-mode), which results in the following error when
trying to invoke go-mode:
Debugger entered--Lisp error: (wrong-type-argument keymapp nil)
set-keymap-parents(#<keymap size 6 0xf5> (nil))
(if (keymap-parent go-mode-map) nil (set-keymap-parents go-mode-map (list ...)))
(unless (keymap-parent go-mode-map) (set-keymap-parents go-mode-map (list ...)))
(progn (if (get ... ...) (put ... ... ...)) (unless (keymap-parent go-mode-map)
(set-keymap-parents go-mode-map ...)) (derived-mode-merge-syntax-tables (syntax-table)
go-mode-syntax-table))
(let ((delay-mode-hooks t)) (go--prog-mode) (setq major-mode (quote go-mode)) (setq
mode-name "Go") (progn (if ... ...) (unless ... ...)
(derived-mode-merge-syntax-tables ... go-mode-syntax-table)) (use-local-map go-mode-map)
(set-syntax-table go-mode-syntax-table) (set$
(progn (make-local-variable (quote delay-mode-hooks)) (let (...) (go--prog-mode) (setq
major-mode ...) (setq mode-name "Go") (progn ... ... ...) (use-local-map
go-mode-map) (set-syntax-table go-mode-syntax-table) (setq local-abbrev-table
go-mode-abbrev-table) (set ... .$
(delay-mode-hooks (go--prog-mode) (setq major-mode (quote go-mode)) (setq mode-name
"Go") (progn (if ... ...) (unless ... ...) (derived-mode-merge-syntax-tables ...
go-mode-syntax-table)) (use-local-map go-mode-map) (set-syntax-table go-mode-syntax-table)
(setq local-ab$
(lambda nil "Major mode for editing Go source text.\n\nThis mode provides (not
just) basic editing capabilities for\nworking with Go code. It offers almost complete
syntax\nhighlighting, indentation that is almost identical to gofmt and\nproper parsing of
the buffer con$
call-interactively(go-mode)
command-execute(go-mode t)
execute-extended-command(nil)
call-interactively(execute-extended-command)
(dispatch-event "[internal]")
I can only suspect that the keymap won't be the only issue, but also
hooks etc.
What I am wondering is, if using an alias is not an option, how else
could I derive the mode from prog-mode or fundamental-mode, depending on
what's available?
Cheers,
Dominik Honnef
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-beta