Function: hs-find-block-beginning

hs-find-block-beginning is a byte-compiled function defined in hideshow.el.gz.

Signature

(hs-find-block-beginning)

Documentation

Reposition point at block-start.

Return point, or nil if original point was not in a block.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/hideshow.el.gz
(defun hs-find-block-beginning ()
  "Reposition point at block-start.
Return point, or nil if original point was not in a block."
  (let ((done nil)
        (here (point)))
    ;; look if current line is block start
    (if (funcall hs-looking-at-block-start-p-func)
        (point)
      ;; look backward for the start of a block that contains the cursor
      (while (and (re-search-backward hs-block-start-regexp nil t)
		  ;; go again if in a comment or a string
		  (or (save-match-data (nth 8 (syntax-ppss)))
		      (not (setq done
				 (< here (save-excursion
					   (hs-forward-sexp (match-data t) 1)
					   (point))))))))
      (if done
          (point)
        (goto-char here)
        nil))))