axiom-developer
[Top][All Lists]
Advanced

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

Pamplhet mode for emacs (was: Re: [Axiom-developer] Unit package questio


From: David MENTRE
Subject: Pamplhet mode for emacs (was: Re: [Axiom-developer] Unit package question)
Date: Thu, 01 Sep 2005 22:12:04 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux)

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
-- 
David MENTRE <address@hidden> -- http://www.nongnu.org/axiom/





reply via email to

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