axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-developer] Re: Pamplhet mode for emacs


From: Ralf Hemmecke
Subject: [Axiom-developer] Re: Pamplhet mode for emacs
Date: Mon, 19 Sep 2005 12:00:59 +0200
User-agent: Mozilla Thunderbird 1.0 (X11/20041206)

There is also mmm-mode. That should be even better if several file types
are mixed withing a pamphlet file.

http://mmm-mode.sourceforge.net/

Ralf

David MENTRE wrote:
Hello,

Martin Rubey <address@hidden> writes:


An important thing would either be a fantastic pamphlet mode for emacs
or the possibility to retain a little of the documentation in the
source file.


noweb (the tool behind Tim's pamphlets) provides an emacs mode
(noweb-mode). It allows to use simultaneously two modes, latex-mode for
the LaTeX part and another mode for the program part. With most emacs
modes, font coloring and auto indentation is correct (except sometimes
the first line of a code chunk). Maybe you were thinking at more
elaborate things but this is a first start.

For what it's worth, I'm using following code in my .emacs:

;; To have noweb mode automatically
(setq auto-mode-alist
      (append '(("\\.pamphlet$"  . noweb-mode)
                ) auto-mode-alist))

;; many thanks to Hubert Canon <address@hidden> for this code
(add-hook 'noweb-mode-hook 'my-noweb-set-mode-code)
(defun my-noweb-set-mode-code ()
  (let* ((filename (file-name-nondirectory buffer-file-name))
         (mode (cond ((string-match "^Makefile" filename) 'makefile-mode)
                     ((string-match "\\.lisp\\.pamphlet$" filename) 'lisp-mode)
                     ((string-match "\\.lsp\\.pamphlet$" filename) 'lisp-mode)
                     ((string-match "\\.clisp\\.pamphlet$" filename) 'lisp-mode)
                     ((string-match "\\.c\\.pamphlet$" filename) 'c-mode)
                     ((string-match "\\.h\\.pamphlet$" filename) 'c-mode)
                     ((string-match "\\.ml\\.nw$" filename) 'caml-mode)
                     ((string-match "\\.mli\\.nw$" filename) 'caml-mode)
                     ((string-match "\\.cd\\.nw$" filename) 'caml-mode)
                     ((string-match "\\.c\\.nw$" filename) 'c-mode)
                     ((string-match "\\.h\\.nw$" filename) 'c-mode)
                     ((string-match "\\.xdr\\.nw$" filename) 'c-mode)
                     ((string-match "\\.dtd\\.nw$" filename) 'sgml-mode)
                     ((string-match "\\.ui\\.nw$" filename) 'nxml-mode)
                     (t 'fundamental-mode))))
    (noweb-set-code-mode mode)))


Yours,
david





reply via email to

[Prev in Thread] Current Thread [Next in Thread]