Function: org-comment-line-break-function

org-comment-line-break-function is a byte-compiled function defined in org.el.gz.

Signature

(org-comment-line-break-function &optional SOFT)

Documentation

Break line at point and indent, continuing comment if within one.

The inserted newline is marked hard if variable use-hard-newlines(var)/use-hard-newlines(fun) is true, unless optional argument SOFT is non-nil.

This function is a simplified version of comment-indent-new-line that bypasses the complex Emacs machinery dealing with comments. We instead rely on Org parser, utilizing org-adaptive-fill-function

Source Code

;; Defined in /usr/src/emacs/lisp/org/org.el.gz
(defun org-comment-line-break-function (&optional soft)
  "Break line at point and indent, continuing comment if within one.
The inserted newline is marked hard if variable
`use-hard-newlines' is true, unless optional argument SOFT is
non-nil.

This function is a simplified version of `comment-indent-new-line'
that bypasses the complex Emacs machinery dealing with comments.
We instead rely on Org parser, utilizing `org-adaptive-fill-function'"
  (let ((fill-prefix (org-adaptive-fill-function)))
    (if soft (insert-and-inherit ?\n) (newline 1))
    (save-excursion (forward-char -1) (delete-horizontal-space))
    (delete-horizontal-space)
    (indent-to-left-margin)
    (when fill-prefix
      (insert-before-markers-and-inherit fill-prefix))))