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)