Find file
82e39d3 Dec 13, 2016
51 lines (41 sloc) 1.5 KB
;;; org-devonthink.el - Support for links to dtp messages by their UUID
;; version 1.1, by John Wiegley <>
(require 'org)
(org-add-link-type "x-devonthink-item" 'org-dtp-open)
(defun org-dtp-open (record-location)
"Visit the dtp message with the given Message-ID."
(shell-command (concat "open x-devonthink-item:" record-location)))
(defun org-get-dtp-link (&optional given-name)
(let ((name (or given-name
(do-applescript (format "
tell application \"DEVONthink Pro\"
get name of content record
end tell"))))
(location (do-applescript (format "
tell application \"DEVONthink Pro\"
get uuid of content record
end tell"))))
(concat "x-devonthink-item://" location) name)))
(defun org-insert-dtp-link ()
(let (name)
(when (region-active-p)
(setq name (buffer-substring-no-properties (region-beginning)
(delete-region (region-beginning) (region-end)))
(insert (org-get-dtp-link name))))
(defun org-dtp-store-link ()
"Store a link to an dtp e-mail message by Message-ID."
(let ((link-name
:type "x-devonthink-item"
:link (cons (concat "x-devonthink-item://" link-name)
(concat "x-devonthink-item://" link-name))
:description (file-name-nondirectory link-name))))
(provide 'org-devonthink)
;;; org-devonthink.el ends here