Function: hs-block-positions
hs-block-positions is a byte-compiled function defined in
hideshow.el.gz.
Signature
(hs-block-positions &optional ADJUST-BEG ADJUST-END)
Documentation
Return the current code block positions.
This returns a list with the current code block beginning and end positions. This does nothing if there is not a code block at current point.
If either ADJUST-BEG or ADJUST-END are non-nil, adjust block positions
according to hs-adjust-block-beginning, hs-adjust-block-end-function
and hs-block-end-regexp.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/hideshow.el.gz
(defun hs-block-positions (&optional adjust-beg adjust-end)
"Return the current code block positions.
This returns a list with the current code block beginning and end
positions. This does nothing if there is not a code block at current
point.
If either ADJUST-BEG or ADJUST-END are non-nil, adjust block positions
according to `hs-adjust-block-beginning', `hs-adjust-block-end-function'
and `hs-block-end-regexp'."
;; `catch' is used here if the search fails due unbalanced parentheses
;; or any other unknown error caused in `hs-forward-sexp-function'.
(catch 'hs--block-exit
(save-match-data
(save-excursion
(when (funcall hs-looking-at-block-start-predicate)
(let ((beg (match-end 0)) end)
;; `beg' is the point at the end of the block
;; beginning, which may need to be adjusted
(when adjust-beg
(save-excursion
(when hs-adjust-block-beginning-function
(goto-char (funcall hs-adjust-block-beginning-function beg)))
(setq beg (pos-eol))))
(goto-char (match-beginning hs-block-start-mdata-select))
(condition-case _
(funcall hs-forward-sexp-function 1)
(scan-error (throw 'hs--block-exit nil)))
;; `end' is the point at the end of the block
(setq end (cond ((not adjust-end) (point))
((and (stringp hs-block-end-regexp)
(looking-back hs-block-end-regexp nil))
(match-beginning 0))
((functionp hs-block-end-regexp)
(funcall hs-block-end-regexp)
(match-beginning 0))
(t (point))))
;; adjust block end (if needed)
(when (and adjust-end hs-adjust-block-end-function)
(setq end (or (funcall hs-adjust-block-end-function beg)
end)))
(list beg end)))))))