ocaml-indent / ocaml-indent.el

The default branch has multiple heads

Full commit
; ; add ocaml-indent.el directory to load-path
; (setq ocaml-indent-command "WHERE-YOU-INSTALLED-ocaml-indent/ocaml-indent")
; (require 'ocaml-indent)
; (add-hook 
;  'tuareg-mode-hook
;  '(lambda ()
;        ...
;        (local-set-key (kbd "<C-tab>") 'ocaml-indent) ; Use <tab> if you dare.
;        ...
;        )...)

(defgroup ocaml-indent ()
  "OCaml-indent: OCaml indenter writtein OCaml."
  :group 'languages)

(defcustom ocaml-indent-command "WHERE-YOU-INSTALLED-ocaml-indent/ocaml-indent"
  "*The command which invokes ocaml-indent."
  :type 'string :group 'ocaml-indent)

(defconst ocaml-indent-process-buffer "*ocaml-indent-process*"
  "The name of ocaml-indent communication buffer")

(defun ocaml-indent-run (&optional debug)
  (let ((region-active (and transient-mark-mode mark-active)))
	    (line-number-at-pos (progn
				  (if region-active (goto-char (region-beginning)))
	    (line-number-at-pos (progn
				  (if region-active (progn
						      (goto-char (region-end))
						      (forward-char -1))) 

	 ; When the region is active but size 0, at the line head, end-lnum- < start-lnum .
 	 ; Fix is required.
	 (end-lnum (max start-lnum end-lnum-)) 
	    (goto-char (point-min)) (forward-line (1- start-lnum)) ; to line (start-lnum)

	    (goto-char (point-min)) (forward-line end-lnum) ; to line (end-lnum + 1)


	(with-current-buffer (get-buffer-create ocaml-indent-process-buffer)

	(let* ((base-command '(call-process-region 1 end-char
						   nil ; delete
						   ocaml-indent-process-buffer ; buffer
						   nil ;display
	       (base-options (list "-lines" (format "%d-%d" start-lnum end-lnum)))
	       (options (if debug (append (list "-debug") base-options) base-options))
	       (function (append base-command options))
	  (message "%S %S" ocaml-indent-command options)
	  (eval function))

        ;; (display-buffer ocaml-indent-process-buffer)
	(let ((indented
	       (with-current-buffer ocaml-indent-process-buffer
		 (buffer-substring (point-min) (point-max)))))
	    (delete-region start-char end-char)
	    (goto-char start-char)
	    (insert indented)))

(defun ocaml-indent ()

(defun ocaml-indent-debug ()
  (ocaml-indent-run t))

(provide 'ocaml-indent)