Function: texinfo-find-pointer

texinfo-find-pointer is a byte-compiled function defined in texnfo-upd.el.gz.

Signature

(texinfo-find-pointer BEGINNING END LEVEL DIRECTION)

Documentation

Move point to section associated with next, previous, or up pointer.

Return type of pointer (either normal or no-pointer).

The first and second arguments bound the search for a pointer to the beginning and end, respectively, of the enclosing higher level section. The third argument is a string specifying the general kind of section such as "chapter" or "section". When looking for the Next pointer, the section found will be at the same hierarchical level in the Texinfo file; when looking for the Previous pointer, the section found will be at the same or higher hierarchical level in the Texinfo file; when looking for the Up pointer, the section found will be at some level higher in the Texinfo file. The fourth argument
(one of next, previous, or up) specifies whether to find the
Next, Previous, or Up pointer.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/texnfo-upd.el.gz
(defun texinfo-find-pointer (beginning end level direction)
  "Move point to section associated with next, previous, or up pointer.
Return type of pointer (either `normal' or `no-pointer').

The first and second arguments bound the search for a pointer to the
beginning and end, respectively, of the enclosing higher level
section.  The third argument is a string specifying the general kind
of section such as \"chapter\" or \"section\".  When looking for the
`Next' pointer, the section found will be at the same hierarchical
level in the Texinfo file; when looking for the `Previous' pointer,
the section found will be at the same or higher hierarchical level in
the Texinfo file; when looking for the `Up' pointer, the section found
will be at some level higher in the Texinfo file.  The fourth argument
\(one of `next', `previous', or `up') specifies whether to find the
`Next', `Previous', or `Up' pointer."
  (let ((case-fold-search t))
    (cond ((eq direction 'next)
	   (forward-line 3)             ; skip over current node
	   ;; Search for section commands accompanied by node lines;
	   ;; ignore section commands in the middle of nodes.
	   (if (re-search-forward
                ;; A `Top' node is never a next pointer, so won't find it.
		(concat
		 ;; Match node line.
		 "\\(^@node\\).*\n"
		 ;; Match comment, ifinfo, ifnottex line, if any
		 (concat
                  "\\(\\("
                  "\\(^@c\\).*\n\\)"
                  "\\|"
                  "\\(^@ifinfo[ ]*\n\\)"
                  "\\|"
                  "\\(^@ifnottex[ ]*\n\\)"
                  "\\)?")
		 (eval
		  (cdr (assoc level texinfo-update-menu-same-level-regexps)) t))
		end
		t)
	       'normal
	     'no-pointer))
	  ((eq direction 'previous)
	   (if (re-search-backward
		(concat
		 "\\("
		 ;; Match node line.
		 "\\(^@node\\).*\n"
		 ;; Match comment, ifinfo, ifnottex line, if any
		 (concat
                  "\\(\\("
                  "\\(^@c\\).*\n\\)"
                  "\\|"
                  "\\(^@ifinfo[ ]*\n\\)"
                  "\\|"
                  "\\(^@ifnottex[ ]*\n\\)"
                  "\\)?")
		 (eval
		  (cdr (assoc level texinfo-update-menu-same-level-regexps)) t)
		 "\\|"
		 ;; Match node line.
		 "\\(^@node\\).*\n"
		 ;; Match comment, ifinfo, ifnottex line, if any
		 (concat
                  "\\(\\("
                  "\\(^@c\\).*\n\\)"
                  "\\|"
                  "\\(^@ifinfo[ ]*\n\\)"
                  "\\|"
                  "\\(^@ifnottex[ ]*\n\\)"
                  "\\)?")
		 (eval
		  (cdr (assoc level texinfo-update-menu-higher-regexps)) t)
		 "\\|"
		 ;; Handle `Top' node specially.
		 "^@node [ \t]*top[ \t]*\\(,\\|$\\)"
		 "\\)")
		beginning
		t)
	       'normal
	     'no-pointer))
	  ((eq direction 'up)
	   (if (re-search-backward
		(concat
		 "\\("
		 ;; Match node line.
		 "\\(^@node\\).*\n"
		 ;; Match comment, ifinfo, ifnottex line, if any
		 (concat
                  "\\(\\("
                  "\\(^@c\\).*\n\\)"
                  "\\|"
                  "\\(^@ifinfo[ ]*\n\\)"
                  "\\|"
                  "\\(^@ifnottex[ ]*\n\\)"
                  "\\)?")
		 (eval (cdr (assoc level texinfo-update-menu-higher-regexps)) t)
		 "\\|"
		 ;; Handle `Top' node specially.
		 "^@node [ \t]*top[ \t]*\\(,\\|$\\)"
		 "\\)")
		(save-excursion
		  (goto-char beginning)
		  (line-beginning-position))
		t)
	       'normal
	     'no-pointer))
	  (t
           (error "texinfo-find-pointer: Lack proper arguments")))))