Skip to content

Commit

Permalink
resolve setting custom directory on first run
Browse files Browse the repository at this point in the history
saves to custom variable after asking on startup
  • Loading branch information
slevin committed Sep 4, 2014
1 parent c99700d commit 34f9d31
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 49 deletions.
36 changes: 6 additions & 30 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,27 @@
# Todo

how to test getting a variable before starting?



maybe makunbound could get rid of it?
to test again
then just do the read variable first?


make sure directory exists and if not
create it recursively





should customizable morning pages directory
should ask the first time its run to set that


should make sure that directory exists before finding the file
test with a broken directory to see what happens


not sure if it should be a mode or not
if not a mode then remove references to "mode"


prefix all functions and variables with with mpages
and get rid of the mode stuff

change name

create readme to explain what it is

blog post on the process



# Future
zoom font default +1
could make it a setting
and wordwrap a setting

could check for ido and do ido read-directory-name

some testing just to figure out how to do it with emacs

create a cask package

blog post on the process

disappearing text (make it feel fading away)

could make time only count while in the buffer, currently
Expand Down
25 changes: 6 additions & 19 deletions mpages-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,14 @@ Increasing this number may improve performance."
:type 'integer
:group 'mpages)

(defcustom mpages-content-directory "~/wrk/words/"
(defcustom mpages-content-directory nil
"This is the directory to store your daily Morning Pages documents."
:type 'directory
:group 'mpages)

(defcustom testydir nil
"This is a testy dir."
:type 'directory
:group 'mpages)

;; (defcustom mpages-content-directory (read-directory-name "Directory for mpages files: ")
;; "This is the directory to store Morning Pages documents."
;; :type 'directory)

(defvar mpages-mode-start-time)
(defvar mpages-mode-count-timer)

;; (defun get-mpages-directory (dir)
;; (interactive "DDirectory for mpages files: ")
;; dir)

(defun formatted-count (num threshold)
"Colorize the NUM based on being above/below THRESHOLD."
(let ((numstr (number-to-string num)))
Expand Down Expand Up @@ -101,25 +88,25 @@ Increasing this number may improve performance."

(defun open-today ()
"Open a Morning Pages file for today."
(find-file (concat mpages-content-directory (format-time-string "%Y%m%d") ".txt"))
(find-file (concat (file-name-as-directory mpages-content-directory) (format-time-string "%Y%m%d") ".txt"))
(auto-fill-mode)
(set-fill-column 80))

;; open todays file
(defun mp-today ()
"Entry point to starting mpages-mode."
(interactive)
;; (if (not testydir)
;; (setq testydir (read-directory-name "Your directory: ")))
(if (not mpages-content-directory)
(customize-save-variable 'mpages-content-directory (file-name-as-directory (read-directory-name "Directory to put your Morning Pages: "))))
(make-directory mpages-content-directory t) ;; ensure it exists
(open-today)
(setup-time)
(setup-timer))


;; (defun testy ()
;; "Throwaway function for testing."
;; (interactive)
;; (update-word-count))
;; (makunbound 'mpages-content-directory))

(provide 'mpages-mode)
;;; mpages-mode.el ends here

0 comments on commit 34f9d31

Please sign in to comment.