Commits

camlspotter  committed afae5f4

fix of -lines

  • Participants
  • Parent commits f6085f8

Comments (0)

Files changed (3)

 
 lexer.cmi: parser.cmi
 
-PROGRAM = indent
+PROGRAM = ocaml-indent
 
 OCAML_LIBS +=
 OCAML_CLIBS +=
 
 MyOCamlProgram($(PROGRAM), $(FILES))
 
-.DEFAULT: indent
+.DEFAULT: ocaml-indent
 
 clean:
 	rm -f *.cm* *.o *output *.sp?t
 module Stack = struct
     
   type k = 
-      | KExpr of int
-      | KParen of int
-      | KBrace of int
-      | KBracket of int
-      | KLet of [`Top | `Local ] * int 
-      | KVal 
-      | KType of int 
-      | KException of int
-      | KNone 
-      | KStruct of int 
-      | KSig of int 
-      | KModule of int 
-      | KOpen 
-      | KBegin of int
-      | KObject of int
-      | KMatch of int
-      | KTry of int
-      | KWith of int
-      | KWhile of int
-      | KIf of int
-      | KThen of int
-      | KElse of int
-      | KFor of int
-      | KDo of int
-      | KFunction of int
-      | KFun of int
+    | KExpr of int
+    | KParen of int
+    | KBrace of int
+    | KBracket of int
+    | KLet of [`Top | `Local ] * int 
+    | KVal 
+    | KType of int 
+    | KException of int
+    | KNone 
+    | KStruct of int 
+    | KSig of int 
+    | KModule of int 
+    | KOpen 
+    | KBegin of int
+    | KObject of int
+    | KMatch of int
+    | KTry of int
+    | KWith of int
+    | KWhile of int
+    | KIf of int
+    | KThen of int
+    | KElse of int
+    | KFor of int
+    | KDo of int
+    | KFunction of int
+    | KFun of int
   with sexp
 
   type elt = { k : k;
   in
 
   (* Fix the indentation. It may be updated by the previous call of [token]. *)
-  let fixed_region = Region.move_chars (state'.last_indent - state.orig_indent) orig_region in
+  let fixed_region = 
+    (* CR jfuruse: Spaghetti... *)
+    if fix_indent then Region.move_chars (state'.last_indent - state.orig_indent) orig_region else orig_region
+  in
   let state = { state with last_indent = state'.last_indent } in
 
   (* Rerun [token] *)

File ocaml-indent.el

+(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")
 
 
 	(message (format "ocaml-indent -lines %d-%d" start-lnum end-lnum))
 	(call-process-region 1 end-char
-			     "/home/jfuruse/.share/projects/ocaml-indent/indent" 
+			     ocaml-indent-command
 			     nil ; delete
 			     ocaml-indent-process-buffer ; buffer
-			     t ;display
+			     nil ;display
 			     "-lines" (format "%d-%d" start-lnum end-lnum)
 			     )
-	(display-buffer ocaml-indent-process-buffer)
+        ;; (display-buffer ocaml-indent-process-buffer)
 	(let ((indented
 	       (with-current-buffer ocaml-indent-process-buffer
 		 (buffer-substring (point-min) (point-max)))))