;;; org-docview.el --- support for links to doc-view-mode buffers (require 'org) (org-add-link-type "docview" 'org-docview-open) (add-hook 'org-store-link-functions 'org-docview-store-link) (defun org-docview-open (link) (when (string-match "\\(.*\\):\\([0-9]+\\)$" link) (let* ((path (match-string 1 link)) (page (string-to-number (match-string 2 link)))) (org-open-file path 1) ;; let org-mode open the file (in-emacs = 1) ;; so that org-link-frame-setup is respected (doc-view-goto-page page) ))) (defun org-docview-store-link () "Store a link to a docview buffer" (when (eq major-mode 'doc-view-mode) ;; This buffer is in doc-view-mode (let* ((path buffer-file-name) (page (doc-view-current-page)) (link (concat "docview:" path ":" (number-to-string page))) (description "")) (org-store-link-props :type "docview" :link link)))) (provide 'org-docview)