- (when (looking-at hs-block-start-regexp)
- (let* ((mdata (match-data t))
- (pure-p (match-end 0))
- (p
- ;; `p' is the point at the end of the block beginning,
- ;; which may need to be adjusted
- (save-excursion
- (goto-char (funcall (or hs-adjust-block-beginning
- 'identity)
- pure-p))
- ;; whatever the adjustment, we move to eol
- (line-end-position)))
- (q
- ;; `q' is the point at the end of the block
- (progn (hs-forward-sexp mdata 1)
- (end-of-line)
- (point)))
- ov)
- (when (and (< p (point)) (> (count-lines p q) 1))
+ (when (hs-looking-at-block-start-p)
+ (let ((mdata (match-data t))
+ (header-end (match-end 0))
+ p q ov)
+ ;; `p' is the point at the end of the block beginning, which
+ ;; may need to be adjusted
+ (save-excursion
+ (if hs-adjust-block-beginning
+ (goto-char (funcall hs-adjust-block-beginning
+ header-end))
+ (goto-char header-end))
+ (setq p (line-end-position)))
+ ;; `q' is the point at the end of the block
+ (hs-forward-sexp mdata 1)
+ (setq q (if (looking-back hs-block-end-regexp)
+ (match-beginning 0)
+ (point)))
+ (when (and (< p q) (> (count-lines p q) 1))