From 1c20d6fb8a82b035177c0b9a66188f780d03c494 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20Roch=C3=A9?= Date: Sun, 12 Aug 2018 15:56:41 +0000 Subject: [PATCH] add keyword pairs for ocaml --- smartparens-ml.el | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/smartparens-ml.el b/smartparens-ml.el index 55008c4e..5c4049ac 100644 --- a/smartparens-ml.el +++ b/smartparens-ml.el @@ -60,7 +60,48 @@ (sp-local-pair "`" nil :actions nil) ;; Disable ' because it is used in value names and types (sp-local-pair "'" nil :actions nil) - (sp-local-pair "(*" "*)" )) + (sp-local-pair "(*" "*)" ) + ;; Because we want to support strings like {| { |}, this pair has to + ;; be disabled in strings. Is this behavior complete? It has to + ;; detect correctly the matching pairs when using the {id| |id} + ;; syntax. + (sp-local-pair "{" "}" :unless '(sp-in-string-p)) + (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