in reply to XS mode for (x)emacs?

perl/xs cperl

http://rzlab.ucr.edu/debian/public_emacs

... set-key "\C-xp" 'gnuserv-edit) ;; Use c-mode for perl .xs files (add-to-list 'auto-mode-alist '("\\.xs\\'" . c-mode)) (add-to-list 'auto-mode-alist '("\\.\\([pP][Llm]\\|al\\)\\'" . cperl-m +ode)) (add-to-list 'interpreter-mode-alist '("perl" . cperl-mode)) (add-to-list 'interpreter-mode-alist '("perl5" . cperl-mode)) (add-to-list 'interpreter-mode-alist '("miniperl" . cperl-mode)) (setq cperl-hairy t cperl-indent-level 4 ;; cperl-auto-newline t ;; cperl-auto-newline-after-colon t cperl-continued-statement-offset 4 cperl-brace-offset -4 cperl-label-offset -4 cperl-highlight-variables-indiscriminately t cperl-electric-lbrace-space nil ) (add-hook 'cperl-mode-hook (lambda () (cperl-set-style "K&R"))) (setq c-indent-level 8) (setq c-brace-imaginary-offset 0) (setq c-brace-offset -8) (setq c-argdecl-indent 8) (setq c-label-offset -8) ...

Replies are listed 'Best First'.
Re^2: XS mode for (x)emacs?
by ForgotPasswordAgain (Vicar) on Aug 23, 2006 at 12:28 UTC

    As far as I can tell, the only thing relevant to XS there is

    (add-to-list 'auto-mode-alist '("\\.xs\\'" . c-mode))

    which is to say they set files ending in ".xs" to C mode. But XS files aren't C code. A snippet for example:

    # ----------------------------------------- MODULE = Mozilla::DOM PACKAGE = Mozilla::DOM::NSEvent PREFIX = m +oz_dom_ PRBool moz_dom_DispatchEvent (target, event) nsIDOMEventTarget *target; nsIDOMEvent *event; PREINIT: PRBool rv; CODE: target->DispatchEvent(event, &rv); RETVAL = rv; OUTPUT: RETVAL

    Though at a glance it looks like the syntax highlighting is okay in C mode. It would be neat if there was an XS mode, similar to mmm-mode in that it could use different modes in different regions of the page (e.g. in mmm-mode, the HTML is done differently than the %perl sections; the XS mode could distinguish the C code at the top from the XS code at the bottom).