Version number set to 6.01a, release 6.01a.
[org-mode.git] / lisp / org-info.el
blobedef5321f1cc275d971cb19eda9b93abc3dfff16
1 ;;; org-info.el --- Support for links to Info nodes from within Org-Mode
3 ;; Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
5 ;; Author: Carsten Dominik <carsten at orgmode dot org>
6 ;; Keywords: outlines, hypermedia, calendar, wp
7 ;; Homepage: http://orgmode.org
8 ;; Version: 6.01a
9 ;;
10 ;; This file is part of GNU Emacs.
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 3, or (at your option)
15 ;; any later version.
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25 ;; Boston, MA 02110-1301, USA.
26 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
28 ;;; Commentary:
30 ;; This file implements links to Info nodes from within Org-mode.
31 ;; Org-mode loads this module by default - if this is not what you want,
32 ;; configure the variable `org-modules'.
34 ;;; Code:
36 (require 'org)
38 ;; Declare external functions and variables
40 (declare-function Info-find-node "info" (filename nodename
41 &optional no-going-back))
42 (defvar Info-current-file)
43 (defvar Info-current-node)
45 ;; Install the link type
46 (org-add-link-type "info" 'org-info-open)
47 (add-hook 'org-store-link-functions 'org-info-store-link)
49 ;; Implementation
50 (defun org-info-store-link ()
51 "Store a link to an Info file and node."
52 "Store a link to an INFO folder or message."
53 (when (eq major-mode 'Info-mode)
54 (let (link desc)
55 (setq link (org-make-link "info:"
56 (file-name-nondirectory Info-current-file)
57 ":" Info-current-node))
58 (setq desc (concat (file-name-nondirectory Info-current-file)
59 ":" Info-current-node))
60 (org-store-link-props :type "info" :file Info-current-file
61 :node Info-current-node
62 :link link :desc desc)
63 link)))
65 (defun org-info-open (path)
66 "Follow an Info file and node link specified by PATH."
67 (org-info-follow-link path))
70 (defun org-info-follow-link (name)
71 "Follow an Info file and node link specified by NAME."
72 (if (or (string-match "\\(.*\\)::?\\(.*\\)" name)
73 (string-match "\\(.*\\)" name))
74 (progn
75 (require 'info)
76 (if (match-string 2 name) ; If there isn't a node, choose "Top"
77 (Info-find-node (match-string 1 name) (match-string 2 name))
78 (Info-find-node (match-string 1 name) "Top")))
79 (message "Could not open: %s" name)))
81 (provide 'org-info)
83 ;;; org-info.el ends here