Updated do-elinstall to take advantage of new elinstall
[org2blog.git] / l2r.el
blobe379f474c3f3a5f8d436ad69f2a59162592bb9fe
1 ;;;_ org2blog/l2r.el --- Persistence for org2blog
3 ;;;_. Headers
4 ;;;_ , License
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)
13 ;; any later version.
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.
25 ;;;_ , Commentary:
27 ;; Acquisition functionality for particular modules is in the
28 ;; respective modules (all two of them)
31 ;;;_ , Requires
33 (require 'tinydb/persist)
35 ;;;_. Body
37 ;;;_ , Convert links as Atom indicates
38 ;;;_ . Customization
39 ;;Should be absolutized (another variable, internal?). And should
40 ;;fetch it on a per-directory basis.
41 (defcustom org2blog/l2r-alist-file
42 "~/.org2blog-local2remote-alist"
43 "File that contains the persisting alist from local filenames to
44 remote URLs"
45 :type 'file
46 :group 'org)
47 ;;;_ . Variables
48 (defvar org2blog/l2r-tq
49 (tinydb-persist-make-q org2blog/l2r-alist-file '())
50 "Tiny db object for org2blog/l2r" )
52 ;;;_ . org2blog/l2r-remote-url
53 (defun org2blog/l2r-remote-url (path)
54 "Return the persisting translation of PATH."
55 (cadr
56 (tinydb-alist-assoc org2blog/l2r-tq (expand-file-name path))))
58 ;;;_ . org2blog/l2r-cvt-link
59 (defun org2blog/l2r-cvt-link (opt-plist type path)
60 "Convert arguments to (type path) list of the remote url."
61 (declare (ignored opt-plist))
62 (let
63 ((cvted-path
64 (org2blog/l2r-remote-url path)))
65 (when cvted-path
66 (list type cvted-path))))
68 ;;;_ . org2blog/l2r-store-remote-url
69 (defun org2blog/l2r-store-remote-url (filepath url)
70 "Persistingly store the translation from FILEPATH to URL."
71 (assert (file-name-absolute-p filepath) t)
72 (tinydb-alist-pushnew
73 org2blog/l2r-tq filepath (list url)))
74 ;;;_ . org2blog/l2r-store-remote-url-yx
75 ;;;###autoload
76 (defun org2blog/l2r-store-remote-url-yx (url filepath)
77 "Persistingly store the translation from FILEPATH to URL.
78 An arg-conformant version of `org2blog/l2r-store-remote-url'"
79 (assert (file-name-absolute-p filepath) t)
80 (tinydb-alist-pushnew
81 org2blog/l2r-tq filepath (list url)))
83 ;;;_. Footers
84 ;;;_ , Provides
86 (provide 'org2blog/l2r)
88 ;;;_ * Local emacs vars.
89 ;;;_ + Local variables:
90 ;;;_ + mode: allout
91 ;;;_ + End:
93 ;;;_ , End
94 ;;; org2blog/l2r.el ends here