axiom-developer
[Top][All Lists]
Advanced

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

[Axiom-developer] [Axiom In Emacs]


From: kai Kaminski
Subject: [Axiom-developer] [Axiom In Emacs]
Date: Thu, 08 Sep 2005 04:04:10 -0500

Changes http://www.axiom-developer.org/zope/mathaction/AxiomInEmacs/diff
--

??changed:
-The first step is to put <tt>noweb-mode.el</tt>, which is contained in
-the Noweb distribution, into your <tt>load-path</tt>. Then add the
-following to your <tt>.emacs</tt> to load <tt>noweb-mode</tt>:
-<pre>
-;; NOWEB-MODE
-(require 'noweb-mode)
-(add-to-list 'auto-mode-alist
-  '(".*\\.pamphlet" . noweb-mode))
-</pre>
The first step is to put 'noweb-mode.el', which is contained in
the Noweb distribution, into your 'load-path'. Then add the
following to your '.emacs' to load 'noweb-mode'::

  ;; NOWEB-MODE
  (require 'noweb-mode)
  (add-to-list 'auto-mode-alist
    '(".*\\\\.pamphlet" . noweb-mode))


??changed:
-First of all you can use the Emacs command <tt>noweb-set-code-mode</tt>, which
First of all you can use the Emacs command 'noweb-set-code-mode', which

??changed:
-call <tt>noweb-insert-mode-line</tt> (a misnomer). It will insert a
call 'noweb-insert-mode-line' (a misnomer). It will insert a

??changed:
-containing lisp code, for example, should have the following first line:
-<pre>
-% -*- mode: Noweb; noweb-code-mode: lisp-mode -*-
-</pre>
containing lisp code, for example, should have the following first line::

  % -*- mode: Noweb; noweb-code-mode: lisp-mode -*-

??changed:
-<tt>foo.ext.pamphlet</tt>, where <tt>ext</tt> indicates the type of
-the code chunks. For example, <tt>foo.lisp.pamphlet</tt> would contain Lisp
-code and <tt>bar.spad.pamphlet</tt> would contain spad code. This allows for a
'foo.ext.pamphlet', where 'ext' indicates the type of
the code chunks. For example, 'foo.lisp.pamphlet' would contain Lisp
code and 'bar.spad.pamphlet' would contain spad code. This allows for a

??changed:
-your <tt>.emacs</tt>:
-<pre>
-(defun kai:set-code-mode ()
-  (let* ((filename (buffer-file-name)))
-    (let ((end (string-match "\\.pamphlet" filename)))
-      (noweb-set-code-mode
-       (assoc-default (substring filename 0 end)
-                      auto-mode-alist
-                      'string-match
-                      'fundamental-mode)))))
-
-(add-hook 'noweb-mode-hook 'kai:set-code-mode)
-</pre>
your '.emacs'::

  (defun kai:set-code-mode ()
    (let* ((filename (buffer-file-name)))
      (let ((end (string-match "\\\\.pamphlet" filename)))
        (noweb-set-code-mode
         (assoc-default (substring filename 0 end)
                        auto-mode-alist
                        'string-match
                        'fundamental-mode)))))
  
  (add-hook 'noweb-mode-hook 'kai:set-code-mode)


??changed:
-the <tt>auto-mode-alist</tt>-mechanism to choose the code mode and
the 'auto-mode-alist'-mechanism to choose the code mode and

??changed:
-finds oneself in a situation, where a pamphlet looks like this:
-<pre>
-\documentclass{article}
-\usepackage{noweb}
-
-\begin{document}
-  \title{DWIM.BOOT.PAMPHLET}
-  \author{John Doe}
-  \maketitle
-
-<<*>>=
-source code
-@
-</pre>
-The pamphlet doesn't contain any documentation and just one big code
-  chunk. Usually that means that the original author didn't use
-  literate programming and that the source code was just transformed
-  to a pamphlet in the obvious - and useless - way. If you want to
-  transform it into a true literate program you'll often want to take
-[31 more lines...]
finds oneself in a situation, where a pamphlet looks like this::

  \documentclass{article}
  \usepackage{noweb}
  
  \begin{document}
    \title{DWIM.BOOT.PAMPHLET}
    \author{John Doe}
    \maketitle
  
  <<*>>=
  source code
  @

The pamphlet doesn't contain any documentation and just one big
code chunk. Usually that means that the original author didn't
use literate programming and that the source code was just
transformed to a pamphlet in the obvious - and useless - way. If
you want to transform it into a true literate program you'll
often want to take a consecutive region of code, replace it with
a chunk marker, say '&lt;&lt;foo&gt;&gt;', and add a new chunk
containing the replaced code somewhere else in the file. This is
made somewhat easier by the following two Elisp functions::

  (defun kai:noweb-extract-chunk (chunk-name start end)
    (interactive "sChunk name: \nr")
    (let* ((chunk (delete-and-extract-region start end)))
      (kill-new (concat "<<" chunk-name ">>=\n" chunk "address@hidden"))
      (save-excursion
        (goto-char start)
        (insert (concat "<<" chunk-name ">>\n"))))
    (noweb-update-chunk-vector))
  
  (defun kai:noweb-yank (&rest args)
    (interactive "")
    (apply 'yank args)
    (noweb-update-chunk-vector))
  
  (add-hook 'noweb-mode-hook
            (lambda ()
              (global-set-key [(control ?c) ?x] 'kai:noweb-extract-chunk)
              (global-set-key [(control ?c) ?y] 'kai:noweb-yank)))

To use them, just mark a region of code and press 'C-c x'. You'll
be prompted for a chunk name. Then go to the point where you want
the new chunk to reside and press 'C-c y'.

It would be nicer, if one could bind 'kai:noweb-yank'
to 'C-y' instead. Unfortunately that doesn't work. The problem

??changed:
-for <tt>C-y</tt>. I'm not sure if this explanation is accurate,
for 'C-y'. I'm not sure if this explanation is accurate,

??changed:
-put <a href="boot-mode.el"><tt>boot-mode.el</tt></a> into
-your <tt>load-path</tt> and add the following to
-your <tt>.emacs</tt>:
-<pre>
-;; BOOT-MODE
-(require 'boot-mode)
-(add-to-list 'auto-mode-alist
-  '(".*\\.boot" . boot-mode))
-</pre>
put <a href="boot-mode.el">'boot-mode.el'</a> into
your 'load-path' and add the following to
your '.emacs'::

  ;; BOOT-MODE
  (require 'boot-mode)
  (add-to-list 'auto-mode-alist
    '(".*\\\\.boot" . boot-mode))

??changed:
-high-lighting and making <tt>comment-region</tt> work.
-
high-lighting and making 'comment-region' work.


--
forwarded from http://www.axiom-developer.org/zope/mathaction/address@hidden




reply via email to

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