Add Version header, docs, generics

This commit is contained in:
Tom Willemse 2013-12-10 01:58:57 +01:00
parent 0d9b833858
commit 6a9af94b7a

View file

@ -4,6 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: convenience, outlines
;; Version: 0.1.0
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
@ -47,8 +48,11 @@
:group 'persistent-outline
:type 'directory)
(defclass perso-file-local-storage () ())
(defclass perso-filesystem-storage () ())
(defclass perso-file-local-storage () ()
:documentation
"A storage back-end that saves the state in a file-local variable.")
(defclass perso-filesystem-storage () ()
"A storage back-end that saves the state in a dedicated file.")
(defvar perso-outline)
@ -134,6 +138,9 @@ functions for creating backup and autosave filenames."
(unless (file-exists-p directory)
(make-directory directory :parents))))
(defgeneric perso-save-to-storage (storage outline)
"Tell the storage back-end to save the current outline state.")
(defmethod perso-save-to-storage ((storage perso-file-local-storage)
outline)
"Save the current states to a file-local variable."
@ -150,6 +157,9 @@ functions for creating backup and autosave filenames."
(print outline (current-buffer))
(write-file filename))))
(defgeneric perso-load-from-storage (storage)
"Tell the storage back-end to load the saved outline state.")
(defmethod perso-load-from-storage ((storage perso-file-local-storage))
"Load saved states from a file-local variable."
(when (boundp (make-local-variable 'perso-outline))