<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2006/02/2e21262671d26ca4956db3bbfcf39ca0"
  from="Till Varoquaux &lt;till.varoquaux@g...&gt;"
  author="Till Varoquaux"
  date="2006-02-21T00:56:29"
  subject="Re: [Caml-list] ocaml+twt v0.81"
  prev="2006/02/6f98d2c26e5095e71bb6eaa96087bdde"
  next="2006/02/6e8644261e1ff1045c0356df8ce210aa"
  prev-in-thread="2006/02/1960cff274fc22ecd5e68e74b16e589d"
  prev-thread="2006/02/b6b3ba9e65e001f4a0dbca1489eda7d0"
  next-thread="2006/02/26e0e034e81973bfaabae58148b29f96"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="ocaml+twt v0.81">
<msg 
  url="2006/02/1960cff274fc22ecd5e68e74b16e589d"
  from="Mike Lin &lt;mikelin@m...&gt;"
  author="Mike Lin"
  date="2006-02-19T06:20:07"
  subject="ocaml+twt v0.81">
<msg 
  url="2006/02/2e21262671d26ca4956db3bbfcf39ca0"
  from="Till Varoquaux &lt;till.varoquaux@g...&gt;"
  author="Till Varoquaux"
  date="2006-02-21T00:56:29"
  subject="Re: [Caml-list] ocaml+twt v0.81">
</msg>
</msg>
</thread>

<contents>
Thank you for this great utility!

I'd like to know what emac configuration users have. Hopefully we can
work towards a good sample file which could be included in the
distribution. Currently I use:

;;behaves like vim's autoindent
(defun caml+twt-calculate-indentation ()
     (save-excursion
       (beginning-of-line)
       (if (bobp)
	   ;;If this is the first line then it should be set to 0
	   0
       (forward-line -1)
	 ;;Begin navigating to find the first previous non blank line...
       (while (and (not (bobp)) (looking-at "[:blank:]*\n"))
	 (forward-line -1))
       (current-indentation)
       )
       ))

;;Ripped of python.el hopefully we will be able to circle through tab
indentation
;;level someday
(defun caml+twt-indent-line ()
  (let ((target (caml+twt-calculate-indentation))
	(pos (- (point-max) (point))))
    (if (= target (current-indentation))
	(if (&lt; (current-column) (current-indentation))
	    (back-to-indentation))
      (beginning-of-line)
      (delete-horizontal-space)
      (indent-to target)
      (if (&gt; (- (point-max) pos) (point))
	  (goto-char (- (point-max) pos))))))

(define-derived-mode caml+twt-mode tuareg-mode "tuareg twt mode"
  (setq indent-line-function 'caml+twt-indent-line)
  (setq indent-tabs-mode 'nil)
  )

;;(autoload 'caml+twt-mode "caml+twt" "Major mode for editing Ocaml+twt code" t)
(add-to-list 'auto-mode-alist '("\\.twt" . caml+twt-mode))

Cheers,
Till Varoquaux

P.S.: please be tolerant these are my first elisp lines ever...

</contents>

</message>

