Function: hpath:to-line

hpath:to-line is a byte-compiled function defined in hpath.el.

Signature

(hpath:to-line LINE-NUM)

Documentation

Move point to the start of an absolute LINE-NUM or the last line.

This ignores any buffer narrowing (aside from Koutlines) when computing the line number, but does restore the narrowing if point ends within the narrowed region.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hpath.el
(defun hpath:to-line (line-num)
  "Move point to the start of an absolute LINE-NUM or the last line.
This ignores any buffer narrowing (aside from Koutlines) when
computing the line number, but does restore the narrowing if
point ends within the narrowed region."
  (let ((omin (point-min))
	(omax (point-max)))
    (unwind-protect
	(progn (unless (derived-mode-p 'kotl-mode)
		 (widen))
	       (goto-char (point-min))
	       (if (eq selective-display t)
		   (re-search-forward "[\n\r]" nil 'end (1- line-num))
		 (forward-line (1- line-num))))
      (when (and (<= omin (point)) (>= omax (point)))
	(narrow-to-region omin omax)))))