Function: ConTeXt-current-section

ConTeXt-current-section is a byte-compiled function defined in context.el.

Signature

(ConTeXt-current-section)

Documentation

Return the level of the section that contain point.

See also ConTeXt-section for description of levels.

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/context.el
;; LaTeX has a max function here, which makes no sense.
;; I think you want to insert a section that is max ConTeXt-largest-level
;; (May 3, 2023) The above comment is wrong.  Here "large" refers to
;; coarseness of document structure grouping.  That is, "chapter" is
;; larger than "section", "section" is larger than "subsection" etc.
;; On the other hand, the corresponding levels are numbered in the
;; reversed order.  That is, "chapter" is level 1, "section" is level
;; 2 etc.  Hence the largest _section_ has the smallest _level_.
;; That's the reason we use `max' rather than `min' here.
(defun ConTeXt-current-section ()
  "Return the level of the section that contain point.
See also `ConTeXt-section' for description of levels."
  (save-excursion
    (max (ConTeXt-largest-level)
         (if (re-search-backward outline-regexp nil t)
             (- (ConTeXt-outline-level) (ConTeXt-outline-offset))
           (ConTeXt-largest-level)))))