Merge branch 'maint'
[org-mode.git] / contrib / lisp / org-ebib.el
blob2136a134437c47e32a2ea66b29203617f00d3ffe
1 ;;; org-ebib.el - Support for links to Ebib's entries in Org
2 ;;
3 ;; Author: Grégoire Jadi <daimrod@gmail.com>
4 ;;
5 ;; This file is not yet part of GNU Emacs.
6 ;;
7 ;; This program is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation; either version 3, or (at your option)
10 ;; any later version.
12 ;; This program is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;; GNU General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
19 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
21 ;;; Commentary:
23 (require 'org)
25 (org-add-link-type "ebib" 'org-ebib-open)
27 (add-hook 'org-store-link-functions 'org-ebib-store-link)
29 (defun org-ebib-open (key)
30 "Open Ebib and jump to KEY."
31 (ebib nil key))
33 (defun org-ebib-store-link ()
34 "Store a key to an Ebib entry."
35 (when (memq major-mode '(ebib-index-mode ebib-entry-mode))
36 ;; This is an Ebib entry
37 (let* ((key (ebib-cur-entry-key))
38 (link (concat "ebib:" key))
39 (description (ignore-errors (ebib-db-get-field-value 'title key ebib-cur-db))))
40 (org-store-link-props
41 :type "ebib"
42 :link link
43 :description description))))
45 (provide 'org-ebib)
47 ;;; org-ebib.el ends here