1 ;;;_ org2blog/common/l2r.el --- Persistence for org2blog
5 ;; Copyright (C) 2010 Tom Breton (Tehom)
7 ;; Author: Tom Breton (Tehom) <tehom@panix.com>
8 ;; Keywords: lisp, internal
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 ;; Acquisition functionality for particular modules is in the
28 ;; respective modules (all two of them)
33 (require 'tinydb
/persist
)
37 ;;;_ , Convert links as Atom indicates
39 ;;Should be absolutized (another variable, internal?). And should
40 ;;fetch it on a per-directory basis.
41 (defcustom org2blog
/common
/l2r-alist-file
42 "~/.org2blog-local2remote-alist"
43 "File that contains the persisting alist from local filenames to
48 (defvar org2blog
/common
/l2r-tq
49 (tinydb-persist-make-q org2blog
/common
/l2r-alist-file
'())
50 "Tiny db object for org2blog/common/l2r" )
52 ;;;_ . org2blog/common/l2r-remote-url
53 (defun org2blog/common
/l2r-remote-url
(path)
54 "Return the persisting translation of PATH."
57 (if (string-match "file://" path
)
58 (substring path
(match-end 0))
60 (true-path (expand-file-name path
)))
62 (tinydb-alist-assoc org2blog
/common
/l2r-tq true-path
))))
64 ;;;_ . org2blog/common/l2r-cvt-link
65 (defun org2blog/common
/l2r-cvt-link
(opt-plist type path
)
66 "Convert arguments to (type path) list of the remote url."
67 (declare (ignored opt-plist
))
70 (org2blog/common
/l2r-remote-url path
)))
72 (list type cvted-path
))))
74 ;;;_ . org2blog/common/l2r-store-remote-url
75 (defun org2blog/common
/l2r-store-remote-url
(filepath url
)
76 "Persistingly store the translation from FILEPATH to URL."
77 (assert (file-name-absolute-p filepath
) t
)
79 org2blog
/common
/l2r-tq filepath
(list url
)))
80 ;;;_ . org2blog/common/l2r-store-remote-url-yx
82 (defun org2blog/common
/l2r-store-remote-url-yx
(url filepath
)
83 "Persistingly store the translation from FILEPATH to URL.
84 An arg-conformant version of `org2blog/common/l2r-store-remote-url'"
85 (assert (file-name-absolute-p filepath
) t
)
87 org2blog
/common
/l2r-tq filepath
(list url
)))
92 (provide 'org2blog
/common
/l2r
)
94 ;;;_ * Local emacs vars.
95 ;;;_ + Local variables:
100 ;;; org2blog/common/l2r.el ends here