diff --git a/persistent-outline.el b/persistent-outline.el index 9e5d052..1a0bb95 100644 --- a/persistent-outline.el +++ b/persistent-outline.el @@ -4,6 +4,7 @@ ;; Author: Tom Willemse ;; 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))