Function: c-ts-mode--block-comment-offset

c-ts-mode--block-comment-offset is a byte-compiled function defined in c-ts-mode.el.gz.

Signature

(c-ts-mode--block-comment-offset N PARENT BOL &rest _)

Documentation

Indentation offset for lines in block comments.

One space if line starts with "*", three if the previous line is blank or the first line of the comment, and otherwise same as previous line.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/c-ts-mode.el.gz
(defun c-ts-mode--block-comment-offset (_n parent _bol &rest _)
  "Indentation offset for lines in block comments.

One space if line starts with \"*\", three if the previous line is blank
or the first line of the comment, and otherwise same as previous line."
  (save-excursion
    (beginning-of-line)
    (let* ((c-point (treesit-node-start parent))
	   (starred? (looking-at-p (rx (* blank) "*")))
	   (first-or-second? (<= (line-beginning-position 0) c-point)))
      (forward-line -1)
      (let ((prev-indent (current-indentation)))
        (cond (starred? 1)
              ((or first-or-second? (= prev-indent 0)) 3)
              (t (- prev-indent (progn (goto-char c-point)
                                       (current-column)))))))))