Function: haskell-cabal-subsection

haskell-cabal-subsection is a natively compiled function defined in haskell-cabal.el.

Signature

(haskell-cabal-subsection)

Documentation

Get the name and bounds of of the current subsection

Source Code

;; Defined in /nix/store/9lz2mhw95f9fqxr9mnq46k3f6qz3aq83-emacs-packages-deps/share/emacs/site-lisp/elpa/haskell-mode-20260904.1042/haskell-cabal.el
(defun haskell-cabal-subsection ()
  "Get the name and bounds of of the current subsection"
  (save-excursion
    (haskell-cabal-beginning-of-subsection)
    (when (looking-at "\\([ \t]*\\(\\w*\\):\\)[ \t]*")
      (list :name (match-string-no-properties 2)
            :beginning (match-end 0)
            :end (save-match-data (haskell-cabal-subsection-end))
            :data-start-column (save-excursion (goto-char (match-end 0))
                                               (current-column))
            ;; Note: Redundant leading commas are allowed since Cabal 2.2.
            ;; Example:
            ;; build-depends:
            ;;      , base
            ;;      , text
            ;;
            ;; Note: More than one newlines are allowed after the subsection name.
            ;; Example:
            ;; build-depends:
            ;;
            ;;
            ;;      base
            :data-indent-column (save-excursion (goto-char (match-end 0))
                                                (when (looking-at "\n[\n\t ]*  +\\([\\w,]*\\)") (goto-char (match-beginning 1)))
                                                (current-column)
                                                )))))