Add arch tagline
[bpt/emacs.git] / lisp / org / org-info.el
CommitLineData
20908596
CD
1;;; org-info.el --- Support for links to Info nodes from within Org-Mode
2
3;; Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
4
5;; Author: Carsten Dominik <carsten at orgmode dot org>
6;; Keywords: outlines, hypermedia, calendar, wp
7;; Homepage: http://orgmode.org
8;; Version: 6.02b
9;;
10;; This file is part of GNU Emacs.
11;;
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.
16
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.
21
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
27;;
28;;; Commentary:
29
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'.
33
34;;; Code:
35
36(require 'org)
37
38;; Declare external functions and variables
39
40(declare-function Info-find-node "info" (filename nodename
41 &optional no-going-back))
42(defvar Info-current-file)
43(defvar Info-current-node)
44
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)
48
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)))
64
65(defun org-info-open (path)
66 "Follow an Info file and node link specified by PATH."
67 (org-info-follow-link path))
68
69
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)))
80
81(provide 'org-info)
82
88ac7b50 83;; arch-tag: 1e289f54-7176-487f-b575-dd4854bab15e
20908596 84;;; org-info.el ends here