Function: hyrolo-hdr-to-first-line-p

hyrolo-hdr-to-first-line-p is a byte-compiled function defined in hyrolo.el.

Signature

(hyrolo-hdr-to-first-line-p)

Documentation

If point is within a file header, go to the start of its first line.

If point moves, return t; otherwise, don't move and return nil. Thus, if point is already at the start of the first line of the file header, return nil.

The header includes lines matching both hyrolo-hdr-regexp and hbut:source-prefix.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260822.1645/hyrolo.el
(defun hyrolo-hdr-to-first-line-p ()
  "If point is within a file header, go to the start of its first line.
If point moves, return t; otherwise, don't move and return nil.  Thus,
if point is already at the start of the first line of the file header,
return nil.

The header includes lines matching both `hyrolo-hdr-regexp' and
`hbut:source-prefix'."
  (let ((opoint (point))
        level-change)
    (if (derived-mode-p 'hyrolo-mode)
	(cond ((get-text-property (point) :hyrolo-level)
	       nil)
	      ((and (not (bobp))
                    (get-text-property (1- (point)) :hyrolo-hdr))
	       (goto-char (1- (point)))
	       t)
	      ((and (not (bobp))
                    (get-text-property (1- (point)) :hyrolo-level))
	       nil)
	      ((progn (goto-char (line-end-position))
                      (when (and (not (bobp))
                                 (setq level-change (previous-single-property-change (point) :hyrolo-level)))
                        (goto-char (1- level-change))
                        (looking-at hyrolo-hdr-regexp))))
	      (t (goto-char opoint)
		 nil))
      ;; Otherwise, any file header must start at the first line of the buffer.
      ;; If an entry prefix is found when searching backwards, then not
      ;; in the header.
      (cond ((and (bobp) (looking-at hyrolo-hdr-regexp))
             nil)
	    ((progn (goto-char (line-end-position))
		    (while (and (re-search-backward hyrolo-hdr-and-entry-regexp nil t)
				(looking-at (concat hyrolo-hdr-regexp
						    "\\|^" (if (boundp 'hbut:source-prefix) hbut:source-prefix "@loc> ")))))
		    (looking-at hyrolo-hdr-regexp)))
	    (t (goto-char opoint)
	       nil)))))