12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- (require 'org)
- (declare-function Info-find-node "info" (filename nodename
- &optional no-going-back))
- (defvar Info-current-file)
- (defvar Info-current-node)
- (org-add-link-type "info" 'org-info-open)
- (add-hook 'org-store-link-functions 'org-info-store-link)
- (defun org-info-store-link ()
- "Store a link to an Info file and node."
- (when (eq major-mode 'Info-mode)
- (let (link desc)
- (setq link (concat "info:"
- (file-name-nondirectory Info-current-file)
- "#" Info-current-node))
- (setq desc (concat (file-name-nondirectory Info-current-file)
- "#" Info-current-node))
- (org-store-link-props :type "info" :file Info-current-file
- :node Info-current-node
- :link link :desc desc)
- link)))
- (defun org-info-open (path)
- "Follow an Info file and node link specified by PATH."
- (org-info-follow-link path))
- (defun org-info-follow-link (name)
- "Follow an Info file and node link specified by NAME."
- (if (or (string-match "\\(.*\\)[#:]:?\\(.*\\)" name)
- (string-match "\\(.*\\)" name))
- (progn
- (require 'info)
- (if (match-string 2 name)
- (Info-find-node (match-string 1 name) (match-string 2 name))
- (Info-find-node (match-string 1 name) "Top")))
- (message "Could not open: %s" name)))
- (provide 'org-info)
|