Add customization options
This commit is contained in:
parent
4e029b58b1
commit
77181eb9b6
1 changed files with 21 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue