Skip to content

Commit

Permalink
Add keyword pairs for ocaml
Browse files Browse the repository at this point in the history
  • Loading branch information
Khady committed May 24, 2018
1 parent b8c6847 commit 570330c
Showing 1 changed file with 53 additions and 2 deletions.
55 changes: 53 additions & 2 deletions smartparens-ml.el
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

;; Author: Ta Quang Trung <taquangtrungvn@gmail.com>
;; Matus Goljer <matus.goljer@gmail.com>
;; Louis Roché <louis@louisroche.net>
;; Maintainer: Matus Goljer <matus.goljer@gmail.com>
;; Created: 14 July 2016
;; Keywords: smartparens, ML, ocaml, reason
Expand Down Expand Up @@ -50,8 +51,58 @@
(require 'smartparens)

;;; Local pairs for ML-family languages
(sp-with-modes '(tuareg-mode fsharp-mode) (sp-local-pair "(*" "*)" ))
(sp-with-modes '(reason-mode) (sp-local-pair "/*" "*/" ))

(sp-with-modes '(fsharp-mode)
(sp-local-pair "(*" "*)" ))

;; all the keywords pairs are expanded only if followed by "SPC"
;; event. This will reduce false positives like 'dIFficult' to
;; trigger.
(sp-with-modes '(tuareg-mode)
;; Disable ` because it is used in polymorphic variants
(sp-local-pair "`" nil :actions nil)
(sp-local-pair "(*" "*)" )
(sp-local-pair "if" "then"
:when '(("SPC"))
:unless '(sp-in-comment-p sp-in-string-p)
:post-handlers '(sp-latex-insert-spaces-inside-pair))
(sp-local-pair "while" "done"
:when '(("SPC"))
:unless '(sp-in-comment-p sp-in-string-p)
:post-handlers '(sp-latex-insert-spaces-inside-pair))
(sp-local-pair "for" "done"
:when '(("SPC"))
:unless '(sp-in-comment-p sp-in-string-p)
:post-handlers '(sp-latex-insert-spaces-inside-pair))
(sp-local-pair "begin" "end"
:when '(("SPC"))
:unless '(sp-in-comment-p sp-in-string-p)
:post-handlers '(sp-latex-insert-spaces-inside-pair))
(sp-local-pair "struct" "end"
:when '(("SPC"))
:unless '(sp-in-comment-p sp-in-string-p)
:post-handlers '(sp-latex-insert-spaces-inside-pair))
(sp-local-pair "sig" "end"
:when '(("SPC"))
:unless '(sp-in-comment-p sp-in-string-p)
:post-handlers '(sp-latex-insert-spaces-inside-pair))
(sp-local-pair "object" "end"
:when '(("SPC"))
:unless '(sp-in-comment-p sp-in-string-p)
:post-handlers '(sp-latex-insert-spaces-inside-pair))
(sp-local-pair "match" "with"
:when '(("SPC"))
:unless '(sp-in-comment-p sp-in-string-p)
:post-handlers '(sp-latex-insert-spaces-inside-pair))
(sp-local-pair "try" "with"
:when '(("SPC"))
:unless '(sp-in-comment-p sp-in-string-p)
:post-handlers '(sp-latex-insert-spaces-inside-pair)))

(sp-with-modes '(reason-mode)
;; Disable ` because it is used in polymorphic variants
(sp-local-pair "`" nil :actions nil)
(sp-local-pair "/*" "*/" ))

(provide 'smartparens-ml)
;;; smartparens-ml.el ends here

0 comments on commit 570330c

Please sign in to comment.