diff --git a/persistent-outline.el b/persistent-outline.el index 73c9a9b..a9dfa09 100644 --- a/persistent-outline.el +++ b/persistent-outline.el @@ -26,10 +26,26 @@ (require 'eieio) +(defgroup persistent-outline nil + "Customization settings for persistent-outline." + :group 'outlines) + +(defcustom persistent-outline-storage 'perso-filesystem-storage + "How to store outlines." + :group 'persistent-outline + :type '(radio + (const :tag "In separate file" perso-filesystem-storage) + (const :tag "In a file-local variable" perso-file-local-storage))) + +(defcustom persistent-outline-storage-directory + (concat user-emacs-directory "perso/") + "Directory where `perso-filesystem-storage' will save its files." + :group 'persistent-outline + :type 'directory) + (defclass perso-file-local-storage () ()) (defclass perso-filesystem-storage () ()) -(defvar perso-storage 'perso-filesystem-storage) (defvar perso-outline) (defun perso-outline-state () @@ -75,7 +91,7 @@ outlines)) (defun perso--get-filename (file) - (concat "~/.emacs.d/perso/" + (concat persistent-outline-storage-directory (subst-char-in-string ?/ ?! (replace-regexp-in-string "!" "!!" buffer-file-name)))) @@ -115,14 +131,15 @@ (defun persistent-outline-save () (interactive) (save-excursion - (perso-save-to-storage (make-instance perso-storage) + (perso-save-to-storage (make-instance persistent-outline-storage) (perso-record-outline)))) (defun persistent-outline-load () (interactive) (save-excursion (perso-apply-outline - (perso-load-from-storage (make-instance perso-storage))))) + (perso-load-from-storage + (make-instance persistent-outline-storage))))) ;;;###autoload (define-minor-mode persistent-outline-mode