lang/ocaml: make asterix in continued comments optional

This commit is contained in:
Henrik Lissner 2020-02-25 20:03:33 -05:00
parent cb67aa00b9
commit 3bb384f95c
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 10 additions and 2 deletions

View file

@ -5,5 +5,5 @@
"Break line at point and indent, continuing comment if within one." "Break line at point and indent, continuing comment if within one."
(interactive) (interactive)
(comment-indent-new-line) (comment-indent-new-line)
(when (eq (char-before) ?*) (when (and +ocaml-prefix-comments-with-asterisk (eq (char-before) ?*))
(just-one-space))) (just-one-space)))

View file

@ -1,5 +1,12 @@
;;; lang/ocaml/config.el -*- lexical-binding: t; -*- ;;; 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) (when (featurep! +lsp)
(add-hook! '(tuareg-mode-local-vars-hook reason-mode-local-vars-hook) (add-hook! '(tuareg-mode-local-vars-hook reason-mode-local-vars-hook)
#'lsp!)) #'lsp!))
@ -21,7 +28,8 @@
(when (featurep! :checkers spell) (when (featurep! :checkers spell)
(add-hook 'tuareg-mode-local-vars-hook #'flyspell-prog-mode)) (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 (setq-hook! 'tuareg-mode-hook
comment-line-break-function #'+ocaml/comment-indent-new-line) comment-line-break-function #'+ocaml/comment-indent-new-line)