Skip to content
Browse files

Fixed org-devonthink.el

  • Loading branch information...
1 parent 5767317 commit 4c0dadda53f036477e25bbb948482d61b04335a1 @jwiegley committed Apr 4, 2010
Showing with 18 additions and 20 deletions.
  1. +18 −20 org-devonthink.el
View
38 org-devonthink.el
@@ -1,33 +1,31 @@
-;;; org-devonthink.el - Support for links to dtp messages by Message-ID
+;;; org-devonthink.el - Support for links to dtp messages by their UUID
;; version 1.1, by John Wiegley <johnw@gnu.org>
(require 'org)
-(org-add-link-type "dtp" 'org-dtp-open)
-
-;(add-hook 'org-store-link-functions 'org-dtp-store-link)
+(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."
- (do-applescript (format "
- tell application \"DEVONthink Pro\"
- activate
- open window for record (get record at \"%s\")
- end tell" (replace-regexp-in-string "%20" " " record-location))))
+ (shell-command (concat "open x-devonthink-item:" record-location)))
-(defun org-insert-dtp-link ()
+(defun org-get-dtp-link ()
(interactive)
- (let ((name (read (do-applescript (format "
+ (let ((name (do-applescript (format "
tell application \"DEVONthink Pro\"
get name of content record
- end tell"))))
- (location (read (do-applescript (format "
+ end tell")))
+ (location (do-applescript (format "
tell application \"DEVONthink Pro\"
- get location of content record
- end tell")))))
- (insert (org-make-link-string
- (concat "dtp://" (concat location name)) name))))
+ get uuid of content record
+ end tell"))))
+ (org-make-link-string
+ (concat "x-devonthink-item://" location) name)))
+
+(defun org-insert-dtp-link ()
+ (interactive)
+ (insert (org-get-dtp-link)))
(defun org-dtp-store-link ()
"Store a link to an dtp e-mail message by Message-ID."
@@ -36,9 +34,9 @@
(clipboard-yank)
(buffer-string))))
(org-store-link-props
- :type "dtp"
- :link (cons (concat "dtp:" link-name)
- (concat "dtp:" 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)

0 comments on commit 4c0dadd

Please sign in to comment.
Something went wrong with that request. Please try again.