mirror of
https://github.com/doomemacs/doomemacs.git
synced 2026-01-18 23:21:22 -08:00
40 lines
1.4 KiB
EmacsLisp
40 lines
1.4 KiB
EmacsLisp
;;; config/tutorial/autoload/tutorial.el -*- lexical-binding: t; -*-
|
|
|
|
(defvar doom-tutorial-hist-file
|
|
(expand-file-name "tutorial-progress.el" doom-cache-dir)
|
|
"Directory where tutorial progress information is saved.")
|
|
|
|
(defvar doom-tutorial--progress
|
|
(when (file-exists-p doom-tutorial-hist-file)
|
|
(with-temp-buffer
|
|
(insert-file-contents doom-tutorial-hist-file)
|
|
(read (current-buffer))))
|
|
"An alist of tutorials and progress information.")
|
|
|
|
(defun doom-tutorial--save-progress ()
|
|
"Write `doom-tutorial--progress' to `doom-tutorial-hist-file'."
|
|
(with-temp-buffer
|
|
(insert
|
|
";; -*- mode: emacs-lisp -*-\n"
|
|
";; Tutorial progress file, automatically generated by `doom-tutorial--save-progress'.\n"
|
|
"\n")
|
|
(let ((print-length nil)
|
|
(print-level nil)
|
|
(print-quoted t))
|
|
(prin1 doom-tutorial--progress
|
|
(current-buffer)))
|
|
(insert ?\n)
|
|
(condition-case err
|
|
(write-region (point-min) (point-max) doom-tutorial-hist-file nil
|
|
(unless (called-interactively-p 'interactive) 'quiet))
|
|
(file-error
|
|
(lwarn '(doom-tutorial-hist-file) :warning "Error writing `%s': %s"
|
|
doom-tutorial-hist-file (caddr err))))))
|
|
|
|
;;;###autoload
|
|
(defun take-the-tutorial! ()
|
|
"Tutorial entry point."
|
|
(interactive)
|
|
(with-current-buffer (get-buffer-create "*doom-tutorial*")
|
|
(switch-to-buffer (current-buffer))
|
|
(insert "TODO: this needs some work")))
|