Function: actypes::text-toc

actypes::text-toc is an interactive and byte-compiled function defined in hactypes.el.

Signature

(actypes::text-toc SECTION)

Documentation

Jump to the text file SECTION referenced by a table of contents entry at point.

SECTION is a string and can be just the leading part of a section heading.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20261030.2317/hactypes.el
(defact text-toc (section)
  "Jump to the text file SECTION referenced by a table of contents entry at point.
SECTION is a string and can be just the leading part of a section heading."
  (interactive "sGo to section named: ")
  (when (stringp section)
    (let (leader-chars)
      ;; Move past the ibtype matched TOC entry so searches herein skip it
      (forward-line 1)
      (setq section (string-trim section))
      (if (string-match "\\`\\([-+*o]+\\)[ \t]*" section)
          (progn
            (setq leader-chars (match-string 1 section))
	    (actypes::link-to-regexp-match
	     (concat "^[ \t]*\\("
                     (regexp-quote (make-string (length leader-chars) ?*))
                     "\\|"
                     (regexp-quote (make-string (length leader-chars) ?#))
		     "\\)[ \t]*"
                     (regexp-quote (substring section (match-end 0))))
	     1 (current-buffer) t))
        (actypes::link-to-regexp-match (concat "^[ \t]*" (regexp-quote section))
				       1 (current-buffer) t))
      (while (and (= (forward-line -1) 0)
		  (looking-at "[ \t]*[-=][-=]")))
      (forward-line 1)
      (recenter 0))))