Function: hs-hide-block-at-point
hs-hide-block-at-point is a byte-compiled function defined in
hideshow.el.gz.
Signature
(hs-hide-block-at-point &optional END COMMENT-REG)
Documentation
Hide block if on block beginning.
Optional arg END means reposition at end. Optional arg COMMENT-REG is a list of the form (BEGIN END) and specifies the limits of the comment, or nil if the block is not a comment.
The block beginning is adjusted by hs-adjust-block-beginning
and then further adjusted to be at the end of the line.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/hideshow.el.gz
(defun hs-hide-block-at-point (&optional end comment-reg)
"Hide block if on block beginning.
Optional arg END means reposition at end.
Optional arg COMMENT-REG is a list of the form (BEGIN END) and
specifies the limits of the comment, or nil if the block is not
a comment.
The block beginning is adjusted by `hs-adjust-block-beginning'
and then further adjusted to be at the end of the line."
(if comment-reg
(hs-hide-comment-region (car comment-reg) (cadr comment-reg) end)
(when (funcall hs-looking-at-block-start-p-func)
(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
(goto-char (funcall (or hs-adjust-block-beginning #'identity)
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 nil)
(match-beginning 0)
(point)))
(when (and (< p q) (> (count-lines p q) 1))
(cond ((and hs-allow-nesting (setq ov (hs-overlay-at p)))
(delete-overlay ov))
((not hs-allow-nesting)
(hs-discard-overlays p q)))
(hs-make-overlay p q 'code (- header-end p)))
(goto-char (if end q (min p header-end)))))))