Selective tag inheritance.
[org-mode/org-tableheadings.git] / org-info.el
blob3d71b8b3254bc01c00630b12fefa440bc48a75a1
1 ;;; org-info.el - Support for links to Info nodes in 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: 1.0
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 for Org-mode.
31 ;; Org-mode loads this module by default - if this is not what you want,
32 ;; configure the variable `org-modules'.
34 (require 'org)
36 ;; Declare external functions and variables
37 (declare-function Info-find-node "info" (filename nodename
38 &optional no-going-back))
39 (defvar Info-current-file)
40 (defvar Info-current-node)
42 ;; Install the link type
43 (org-add-link-type "info" 'org-info-open)
44 (add-hook 'org-store-link-functions 'org-info-store-link)
46 ;; Implementation
47 (defun org-info-store-link ()
48 "Store a link to an INFO folder or message."
49 (when (eq major-mode 'Info-mode)
50 (let (link desc)
51 (setq link (org-make-link "info:"
52 (file-name-nondirectory Info-current-file)
53 ":" Info-current-node))
54 (setq desc (concat (file-name-nondirectory Info-current-file)
55 ":" Info-current-node))
56 (org-store-link-props :type "info" :file Info-current-file
57 :node Info-current-node
58 :link link :desc desc)
59 link)))
61 (defun org-info-open (path)
62 "Follow an INFO message link."
63 (org-info-follow-link path))
66 (defun org-info-follow-link (name)
67 "Follow an info file & node link to NAME."
68 (if (or (string-match "\\(.*\\)::?\\(.*\\)" name)
69 (string-match "\\(.*\\)" name))
70 (progn
71 (require 'info)
72 (if (match-string 2 name) ; If there isn't a node, choose "Top"
73 (Info-find-node (match-string 1 name) (match-string 2 name))
74 (Info-find-node (match-string 1 name) "Top")))
75 (message "Could not open: %s" name)))
77 (provide 'org-info)
79 ;;; org-info.el ends here