Function: hs-show-block

hs-show-block is an interactive and byte-compiled function defined in hideshow.el.gz.

Signature

(hs-show-block &optional END)

Documentation

Select a block and show it.

With prefix arg, reposition at END. Upon completion, point is repositioned and the normal hook hs-show-hook is run. See documentation for functions hs-hide-block and run-hooks.

View in manual

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/hideshow.el.gz
(defun hs-show-block (&optional end)
  "Select a block and show it.
With prefix arg, reposition at END.  Upon completion, point is
repositioned and the normal hook `hs-show-hook' is run.
See documentation for functions `hs-hide-block' and `run-hooks'."
  (interactive "P")
  (hs-life-goes-on
   (or
    ;; first see if we have something at the end of the line
    (let ((ov (hs-overlay-at (line-end-position)))
          (here (point)))
      (when ov
        (goto-char
         (cond (end (overlay-end ov))
               ((eq 'comment (overlay-get ov 'hs)) here)
               (t (+ (overlay-start ov) (overlay-get ov 'hs-b-offset)))))
        (delete-overlay ov)
        t))
    ;; not immediately obvious, look for a suitable block
    (let ((c-reg (hs-inside-comment-p))
          p q)
      (cond (c-reg
             (when (car c-reg)
               (setq p (car c-reg)
                     q (cadr c-reg))))
            ((and (funcall hs-find-block-beginning-func)
                  ;; ugh, fresh match-data
                  (funcall hs-looking-at-block-start-p-func))
             (setq p (point)
                   q (progn (hs-forward-sexp (match-data t) 1) (point)))))
      (when (and p q)
        (hs-discard-overlays p q)
        (goto-char (if end q (1+ p))))))
   (run-hooks 'hs-show-hook)))