Syntax highlighting in sub-mode (C in ConTeXt)

Bug #851700 reported by lborgman
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
nXhtml
New
Undecided
Unassigned

Bug Description

Hello,

How can I get syntax highlighting in the C sub-mode, when the major mode
is context?

Here my setup (latest versions of emacs, nxhtml and auctex):

file test.el:
--8<---------------cut here---------------start------------->8---
(load "~/emacs/packages/nxhtml/autostart")
(add-to-list 'load-path "~/emacs/packages/auctex")
(load "auctex")

(defun mumamo-chunk-ctx-c (pos max)
  (mumamo-quick-chunk-forward pos max "\\startC" "\\stopC"
                              'borders 'c-mode))

(add-to-list 'auto-mode-alist '("\\.tex\\'" . context-mumamo-mode))

(define-mumamo-multi-major-mode context-mumamo-mode
  "Turn on multiple major modes for ConTeXt with main mode `context-mode'."
  ("ConTeXt Family" context-mode (mumamo-chunk-ctx-c)))
--8<---------------cut here---------------end--------------->8---

file test.tex:
--8<---------------cut here---------------start------------->8---
\starttext
\startC
/* comment */
void func(void)
{
    if(bla)
        blub;
}
\stopC
$a+b$ % math
\stoptext
--8<---------------cut here---------------end--------------->8---

command: "emacs -l test.el test.tex"

Result: no syntax highlighting in C-mode, and some error messages.

compile-log buffer:
--8<---------------cut here---------------start------------->8---
Error: Wrong type argument: number-or-marker-p, nil
--8<---------------cut here---------------end--------------->8---

message buffer:
--8<---------------cut here---------------start------------->8---
Assertion failed: (functionp byte-compiled-fun)
- Please try M-: (mumamo-post-command-1) to see what happened.
nil
Symbol's function definition is void: mumamo-border-mode
- Please try M-: (mumamo-post-command-1) to see what happened.
--8<---------------cut here---------------end--------------->8---

And in the backtrace buffer after invoking (mumamo-post-command-1):
--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (void-function mumamo-border-mode)
  mumamo-border-mode()
  funcall(mumamo-border-mode)
  (let ((mumamo-fetching-major t)) (funcall major))
  (save-current-buffer (set-buffer temp-buf) (let ((mumamo-fetching-major t)) (funcall major)) (setq local-map (current-local-map)) (when local-map (setq local-map (copy-keymap (current-local-map)))) (add-to-list (quote mumamo-major-modes-local-maps) (cons major-mode local-map)) (unless (eq major major-mode) (add-to-list (quote mumamo-major-modes-local-maps) (cons major local-map))))
  (with-current-buffer temp-buf (let ((mumamo-fetching-major t)) (funcall major)) (setq local-map (current-local-map)) (when local-map (setq local-map (copy-keymap (current-local-map)))) (add-to-list (quote mumamo-major-modes-local-maps) (cons major-mode local-map)) (unless (eq major major-mode) (add-to-list (quote mumamo-major-modes-local-maps) (cons major local-map))))
  (let (temp-buf-name temp-buf local-map) (setq temp-buf-name (concat "mumamo-fetch-major-mode-local-" (symbol-name major))) (setq temp-buf (get-buffer temp-buf-name)) (when temp-buf (kill-buffer temp-buf)) (setq temp-buf (get-buffer-create temp-buf-name)) (with-current-buffer temp-buf (let ((mumamo-fetching-major t)) (funcall major)) (setq local-map (current-local-map)) (when local-map (setq local-map (copy-keymap (current-local-map)))) (add-to-list (quote mumamo-major-modes-local-maps) (cons major-mode local-map)) (unless (eq major major-mode) (add-to-list (quote mumamo-major-modes-local-maps) (cons major local-map)))) (kill-buffer temp-buf) local-map)
  mumamo-fetch-local-map(mumamo-border-mode)
  (setq map (mumamo-fetch-local-map major))
  (if map nil (setq map (mumamo-fetch-local-map major)))
  (unless map (setq map (mumamo-fetch-local-map major)))
  (let* ((map-rec (assoc major mumamo-major-modes-local-maps)) (map (cdr map-rec))) (unless map (setq map (mumamo-fetch-local-map major))) (unless (eq map (quote no-local-map)) (use-local-map map)) (add-hook (quote pre-command-hook) (quote mumamo-set-major-pre-command) nil t) (mumamo-request-idle-set-major-mode))
  (if (<= 0 mumamo-set-major-mode-delay) (let* ((map-rec (assoc major mumamo-major-modes-local-maps)) (map (cdr map-rec))) (unless map (setq map (mumamo-fetch-local-map major))) (unless (eq map (quote no-local-map)) (use-local-map map)) (add-hook (quote pre-command-hook) (quote mumamo-set-major-pre-command) nil t) (mumamo-request-idle-set-major-mode)) (mumamo-set-major major ovl) (message "Switched to %s" major-mode))
  (if mumamo-done-first-set-major (if (<= 0 mumamo-set-major-mode-delay) (let* ((map-rec (assoc major mumamo-major-modes-local-maps)) (map (cdr map-rec))) (unless map (setq map (mumamo-fetch-local-map major))) (unless (eq map (quote no-local-map)) (use-local-map map)) (add-hook (quote pre-command-hook) (quote mumamo-set-major-pre-command) nil t) (mumamo-request-idle-set-major-mode)) (mumamo-set-major major ovl) (message "Switched to %s" major-mode)) (mumamo-set-major major ovl))
  (if (not set-it-now) (unless (mumamo-fun-eq major major-mode) (when mumamo-idle-set-major-mode-timer (mumamo-request-idle-set-major-mode))) (if mumamo-done-first-set-major (if (<= 0 mumamo-set-major-mode-delay) (let* ((map-rec (assoc major mumamo-major-modes-local-maps)) (map (cdr map-rec))) (unless map (setq map (mumamo-fetch-local-map major))) (unless (eq map (quote no-local-map)) (use-local-map map)) (add-hook (quote pre-command-hook) (quote mumamo-set-major-pre-command) nil t) (mumamo-request-idle-set-major-mode)) (mumamo-set-major major ovl) (message "Switched to %s" major-mode)) (mumamo-set-major major ovl)))
  (let* ((in-pre-hook (memq (quote mumamo-set-major-pre-command) pre-command-hook)) (ovl (unless in-pre-hook (mumamo-post-command-get-chunk (point)))) (major (when ovl (mumamo-chunk-keyboard-major-mode ovl (point)))) (set-it-now (not (or in-pre-hook (mumamo-fun-eq major major-mode))))) (if (not set-it-now) (unless (mumamo-fun-eq major major-mode) (when mumamo-idle-set-major-mode-timer (mumamo-request-idle-set-major-mode))) (if mumamo-done-first-set-major (if (<= 0 mumamo-set-major-mode-delay) (let* ((map-rec (assoc major mumamo-major-modes-local-maps)) (map (cdr map-rec))) (unless map (setq map (mumamo-fetch-local-map major))) (unless (eq map (quote no-local-map)) (use-local-map map)) (add-hook (quote pre-command-hook) (quote mumamo-set-major-pre-command) nil t) (mumamo-request-idle-set-major-mode)) (mumamo-set-major major ovl) (message "Switched to %s" major-mode)) (mumamo-set-major major ovl))))
  mumamo-set-major-post-command()
  (if font-lock-mode (mumamo-set-major-post-command))
  mumamo-post-command-1()
  eval((mumamo-post-command-1) nil)
  eval-expression((mumamo-post-command-1) nil)
  call-interactively(eval-expression nil nil)
--8<---------------cut here---------------end--------------->8---

I don't know, if the missing syntax highlighting is related to the error
messages...

TIA for any help!
Peter

Revision history for this message
lborgman (lennart-borgman) wrote :

Hi Peter,

There seem to be a bug here somewhere. No idea though what is wrong at the moment. Some questions:

1) Are you using the latest nXhtml beta from the repository?

2) What version of Emacs are you using?

Revision history for this message
Peter (pmlists) wrote : Re: [Bug 851700] Re: Syntax highlighting in sub-mode (C in ConTeXt)

On Fri, Sep 16 2011, lborgman wrote:

> 1) Are you using the latest nXhtml beta from the repository?

Hi Lennart,

Yes. Latest version from http://bazaar.launchpad.net/~nxhtml/nxhtml/main/

> 2) What version of Emacs are you using?

Latest bzr version also (24.0.50.2).

--
           Peter

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.