Function: outline--comment-level

outline--comment-level is a byte-compiled function defined in outline.el.gz.

Signature

(outline--comment-level)

Documentation

Return the level of a comment-prefixed outline heading.

Point must be at the beginning of a heading line. When the line matches outline--comment-regexp with a non-empty group 1 (the heading-level characters), return the length of that group's match. Otherwise defer to the function outline-level(var)/outline-level(fun) that was in effect before comment-heading setup, saved in outline--saved-outline-level, after re-establishing its expected match data from outline--saved-outline-regexp.

This is installed into the variable outline-level(var)/outline-level(fun) by outline--setup-from-comment-regexp.

Source Code

;; Defined in /usr/src/emacs/lisp/outline.el.gz
(defun outline--comment-level ()
  "Return the level of a comment-prefixed outline heading.
Point must be at the beginning of a heading line.  When the line matches
`outline--comment-regexp' with a non-empty group 1 (the heading-level
characters), return the length of that group's match.  Otherwise defer to
the function `outline-level' that was in effect before comment-heading
setup, saved in `outline--saved-outline-level', after re-establishing its
expected match data from `outline--saved-outline-regexp'.

This is installed into the variable `outline-level' by
`outline--setup-from-comment-regexp'."
  (if (and outline--comment-regexp
           (looking-at outline--comment-regexp)
           (match-beginning 1))
      (- (match-end 1) (match-beginning 1))
    (when outline--saved-outline-regexp
      (looking-at outline--saved-outline-regexp))
    (funcall (or outline--saved-outline-level #'outline-level))))