literate haskell (again)

Jan-Willem Maessen jmaessen@alum.mit.edu
Fri, 22 Mar 2002 11:31:32 -0500


Jorge Adriano <jadrian@mat.uc.pt> writes:
> Tried using Andrew Cookes haskell.sty and liked it a lot, but seems like the 
> (X)emacs haskell mode doesn't support the \begin{code} \end{code}  literate 
> programming style, just the one where code is preceded by '> '.
> 
> Anyone has got an hack available for this?

According to my haskell-mode.el:

------------snip
;; Default literate style for ambiguous literate buffers.
(defvar haskell-literate-default 'bird
  "*If the style of a literate buffer is ambiguous, then this variable
gives the default value for `haskell-literate'.  This variable should
be set to the preferred literate style.  For example, place within
.emacs:

   (setq haskell-literate-default 'latex)")
------------snip

So you probably want to change this as per the instructions.

I use Ralf Hinze's lhs2TeX and an ancient version of the Utrecht
attribute grammar tool, and have therefore hacked my haskell-mode.el
to do the appropriate thing with the other literate code markers for
both of these files:

------------snip
(defvar haskell-latex-begin
  "^\\\\\\(begin{code}$\\|begin{spec}$\\|BC$\\|BT{.*}$\\)"
  "Regexp distinguishing start of LaTeX code regions.")
(defvar haskell-latex-start
  "\\\\\\(begin{code}\\|begin{spec}\\|BC\\|BT{.*}\\)"
  "Regexp distinguishing just LaTeX start text.")
(defvar haskell-latex-end
  "^\\\\\\(end{code}$\\|end{spec}$\\|EC$\\|ET$\\)"
  "Regexp distinguishing end of LaTeX code regions.")
(defvar haskell-latex-finish
  "\\\\\\(end{code}\\|end{spec}\\|EC\\|ET\\)"
  "Regexp distinguishing just LaTeX end text.")
(defvar haskell-latex-boundary
  "^\\\\\\(\\(begin{code}$\\|begin{spec}$\\|BC$\\|BT{.*}$\\)\\|\\(end{code}$\\|end{spec}$\\|EC$\\|ET$\\)\\)"
  "Regexp finding boundaries in LaTeX code")
------------snip

-Jan-Willem Maessen