1 ;;;_ org2blog/dia-links.el --- Dia links and general support, for org
5 ;; Copyright (C) 2010 Tom Breton (Tehom)
7 ;; Author: Tom Breton (Tehom) <tehom@panix.com>
8 ;; Keywords: lisp, internal, outlines
10 ;; This file 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 2, or (at your option)
15 ;; This file is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to
22 ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
27 ;; $$MOVE ME to org-mode
32 (require 'org2blog
/for-org-html
)
33 (require 'org2blog
/make-target
)
36 ;;;_ , Dia links specifically
38 ;;In emacs 23, user may set these per directory using .dir-locals.
39 (defconst tehom-org-dia-src-path
"diagrams/"
42 (defconst tehom-org-dia-image-path
"images/"
43 "Path to dia images" )
45 ;;;_ . Set up dia links
47 (org-add-link-type "dia" 'tehom-org-dia-open
'tehom-org-dia-export
)
49 ;;No store-link is possible because dia is outside emacs.
51 ;;;_ . tehom-org-dia-open
53 (defun tehom-org-dia-open (path)
54 "Open the diagram with dia"
56 (start-process-shell-command "dia" nil
"dia"
57 (org2blog:convert-filename
58 path
".dia" tehom-org-dia-src-path
)))
63 ;;Can't automate testing this.
65 ;;;_ , tehom-org-dia-export
66 (defun tehom-org-dia-export (path desc format
)
72 ;;Same base name, with "png" suffix
73 (org2blog:convert-filename
74 path
".png" tehom-org-dia-image-path
)))
76 ;;Cause the image to be made if out of date.
77 (org2blog:make-target image-filename
)
79 "file" image-filename desc desc
"" t
))))
82 ;;Can't automate testing this.
87 (provide 'org2blog
/dia-links
)
89 ;;;_ * Local emacs vars.
90 ;;;_ + Local variables:
95 ;;; org2blog/dia-links.el ends here