From 3bb384f95ca42dbc9415e4943f031d1f4b5dbcc3 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 25 Feb 2020 20:03:33 -0500 Subject: [PATCH] lang/ocaml: make asterix in continued comments optional --- modules/lang/ocaml/autoload.el | 2 +- modules/lang/ocaml/config.el | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/lang/ocaml/autoload.el b/modules/lang/ocaml/autoload.el index 9ab554c7e..45a942d07 100644 --- a/modules/lang/ocaml/autoload.el +++ b/modules/lang/ocaml/autoload.el @@ -5,5 +5,5 @@ "Break line at point and indent, continuing comment if within one." (interactive) (comment-indent-new-line) - (when (eq (char-before) ?*) + (when (and +ocaml-prefix-comments-with-asterisk (eq (char-before) ?*)) (just-one-space))) diff --git a/modules/lang/ocaml/config.el b/modules/lang/ocaml/config.el index d2db49bb6..1ae00fcc5 100644 --- a/modules/lang/ocaml/config.el +++ b/modules/lang/ocaml/config.el @@ -1,5 +1,12 @@ ;;; lang/ocaml/config.el -*- lexical-binding: t; -*- +(defvar +ocaml-prefix-comments-with-asterisk t + "If non-nil, continue block comments with a leading asterisk.") + + +;; +;;; Packages + (when (featurep! +lsp) (add-hook! '(tuareg-mode-local-vars-hook reason-mode-local-vars-hook) #'lsp!)) @@ -21,7 +28,8 @@ (when (featurep! :checkers spell) (add-hook 'tuareg-mode-local-vars-hook #'flyspell-prog-mode)) - ;; Ensure asterixes in block comments have at least one space of indentation + ;; Indent new lines in a comment block, and optionally prefix new comment + ;; lines with an asterix. See `+ocaml-prefix-comments-with-asterisk'. (setq-hook! 'tuareg-mode-hook comment-line-break-function #'+ocaml/comment-indent-new-line)