org-bookmark.el 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. ;;; org-bookmark.el - Support for links to bookmark
  2. ;; Copyright (C) 2008 Free Software Foundation, Inc.
  3. ;;
  4. ;; Author: Tokuya Kameshima <kames AT fa2.so-net.ne.jp>
  5. ;; Version: 1.0
  6. ;; Keywords: outlines, hypermedia, calendar, wp
  7. ;;
  8. ;; This file is not part of GNU Emacs.
  9. ;;
  10. ;; Emacs is free software; you can redistribute it and/or modify
  11. ;; it under the terms of the GNU General Public License as published by
  12. ;; the Free Software Foundation; either version 3, or (at your option)
  13. ;; any later version.
  14. ;; GNU Emacs is distributed in the hope that it will be useful,
  15. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. ;; GNU General Public License for more details.
  18. ;; You should have received a copy of the GNU General Public License
  19. ;; along with GNU Emacs; see the file COPYING. If not, write to the
  20. ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  21. ;; Boston, MA 02110-1301, USA.
  22. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  23. (require 'org)
  24. (require 'bookmark)
  25. (org-add-link-type "bookmark" 'org-bookmark-open)
  26. (add-hook 'org-store-link-functions 'org-bookmark-store-link)
  27. (defun org-bookmark-open (bookmark)
  28. "Visit the bookmark BOOKMARK."
  29. (bookmark-jump bookmark))
  30. (defun org-bookmark-store-link ()
  31. "Store a link to the current line's bookmark in Emacs bookmark list window."
  32. (if (eq major-mode 'bookmark-bmenu-mode)
  33. (let ((bookmark (bookmark-bmenu-bookmark)))
  34. (if bookmark
  35. (org-store-link-props :link (org-make-link "bookmark:" bookmark)
  36. :description bookmark)))))
  37. (provide 'org-bookmark)
  38. ;;; org-bookmark.el ends here