Merge pull request #4842 from rgrinberg/fix-ocamlformat
ocamlforamt hook: buffers without a file name
This commit is contained in:
commit
876bdb523c
1 changed files with 6 additions and 5 deletions
|
@ -111,9 +111,10 @@
|
||||||
(setq +format-with 'ocp-indent)
|
(setq +format-with 'ocp-indent)
|
||||||
(when (and (executable-find "ocamlformat")
|
(when (and (executable-find "ocamlformat")
|
||||||
(locate-dominating-file default-directory ".ocamlformat"))
|
(locate-dominating-file default-directory ".ocamlformat"))
|
||||||
|
(when buffer-file-name
|
||||||
(let ((ext (file-name-extension buffer-file-name t)))
|
(let ((ext (file-name-extension buffer-file-name t)))
|
||||||
(cond ((equal ext ".eliom")
|
(cond ((equal ext ".eliom")
|
||||||
(setq-local ocamlformat-file-kind 'implementation))
|
(setq-local ocamlformat-file-kind 'implementation))
|
||||||
((equal ext ".eliomi")
|
((equal ext ".eliomi")
|
||||||
(setq-local ocamlformat-file-kind 'interface))))
|
(setq-local ocamlformat-file-kind 'interface)))))
|
||||||
(setq +format-with 'ocamlformat))))
|
(setq +format-with 'ocamlformat))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue