Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 51 lines (41 sloc) 1.567 kB
4c0dadd @jwiegley Fixed org-devonthink.el
authored
1 ;;; org-devonthink.el - Support for links to dtp messages by their UUID
eb0e991 @jwiegley committed
authored
2
3 ;; version 1.1, by John Wiegley <johnw@gnu.org>
4
5 (require 'org)
6
4c0dadd @jwiegley Fixed org-devonthink.el
authored
7 (org-add-link-type "x-devonthink-item" 'org-dtp-open)
eb0e991 @jwiegley committed
authored
8
9 (defun org-dtp-open (record-location)
10 "Visit the dtp message with the given Message-ID."
4c0dadd @jwiegley Fixed org-devonthink.el
authored
11 (shell-command (concat "open x-devonthink-item:" record-location)))
eb0e991 @jwiegley committed
authored
12
7b1297a @jwiegley Customization to Org-devonthink
authored
13 (defun org-get-dtp-link (&optional given-name)
0e4e310 @jwiegley changes
authored
14 (interactive)
7b1297a @jwiegley Customization to Org-devonthink
authored
15 (let ((name (or given-name
16 (substring (do-applescript (format "
0e4e310 @jwiegley changes
authored
17 tell application \"DEVONthink Pro\"
18 get name of content record
7b1297a @jwiegley Customization to Org-devonthink
authored
19 end tell")) 1 -1)))
1cb2d78 @jwiegley Fixed org-devonthink for Lion
authored
20 (location (substring (do-applescript (format "
0e4e310 @jwiegley changes
authored
21 tell application \"DEVONthink Pro\"
4c0dadd @jwiegley Fixed org-devonthink.el
authored
22 get uuid of content record
1cb2d78 @jwiegley Fixed org-devonthink for Lion
authored
23 end tell")) 1 -1)))
4c0dadd @jwiegley Fixed org-devonthink.el
authored
24 (org-make-link-string
25 (concat "x-devonthink-item://" location) name)))
26
27 (defun org-insert-dtp-link ()
28 (interactive)
7b1297a @jwiegley Customization to Org-devonthink
authored
29 (let (name)
30 (when (region-active-p)
31 (setq name (buffer-substring-no-properties (region-beginning)
32 (region-end)))
33 (delete-region (region-beginning) (region-end)))
34 (insert (org-get-dtp-link name))))
0e4e310 @jwiegley changes
authored
35
eb0e991 @jwiegley committed
authored
36 (defun org-dtp-store-link ()
37 "Store a link to an dtp e-mail message by Message-ID."
38 (let ((link-name
39 (with-temp-buffer
40 (clipboard-yank)
41 (buffer-string))))
42 (org-store-link-props
4c0dadd @jwiegley Fixed org-devonthink.el
authored
43 :type "x-devonthink-item"
44 :link (cons (concat "x-devonthink-item://" link-name)
45 (concat "x-devonthink-item://" link-name))
eb0e991 @jwiegley committed
authored
46 :description (file-name-nondirectory link-name))))
47
48 (provide 'org-devonthink)
49
50 ;;; org-devonthink.el ends here
Something went wrong with that request. Please try again.