Function: ibtypes::hyp-manual

ibtypes::hyp-manual is a byte-compiled function defined in hibtypes.el.

Signature

(ibtypes::hyp-manual)

Documentation

When on a Hyperbole manual file path, display it.

For example, display "hyperbole.html#Smart Keys" in a web browser using the local html version of the Hyperbole manual. When on "hyperbole.texi#Smart Keys", jump to the "Smart Keys" node in the local Texinfo manual. Without a node name, go to the top node.

Info file links like "hyperbole.info#Smart Keys" are handled by the Info-node implicit button type and displayed in the Emacs Info browser.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hibtypes.el
;;; ========================================================================
;;; Uses web browser to display links to Hyperbole HTML manual sections;
;;; Links are of the form "hyperbole.html#Smart Keys"
;;; ========================================================================

(defib hyp-manual ()
  "When on a Hyperbole manual file path, display it.
For example, display \"hyperbole.html#Smart Keys\" in a web
browser using the local html version of the Hyperbole manual.
When on \"hyperbole.texi#Smart Keys\", jump to the \"Smart Keys\"
node in the local Texinfo manual.  Without a node name, go to the
top node.

Info file links like \"hyperbole.info#Smart Keys\" are handled by
the `Info-node' implicit button type and displayed in the Emacs
Info browser."
  (let* ((path-start-end (hargs:delimited "\"" "\"" nil nil t))
	 (path (nth 0 path-start-end))
	 (start (nth 1 path-start-end))
	 (end (nth 2 path-start-end))
	 node)
    (when (stringp path)
      (setq path (string-trim path))
      (when (string-match "\\`hyperbole.\\(html\\|texi\\)\\(#.*\\)?\\'" path)
	(save-match-data
	  (setq node (match-string 2 path))
	  (when node
	    (setq node (string-trim (substring node 1))))
	  (ibut:label-set path start end))
	(if (equal "html" (match-string 1 path))
	    (progn
	      ;; Any spaces in #section must be replaced with dashes to match html ids
	      (when node
		(setq node (replace-regexp-in-string "\\s-+" "-" node)))
	      (hact 'www-url (concat "file://"
				     (expand-file-name "hyperbole.html" (hpath:expand "${hyperb:dir}/man/"))
				     (when node "#") node)))
	  ;; texi file
	  (hact 'link-to-file (concat
			       (expand-file-name
				"hyperbole.texi"
				(hpath:expand "${hyperb:dir}/man/"))
			       (when node "#") node)))))))