"Tutorial language.")
(make-variable-buffer-local 'tutorial--lang)
+(defvar tutorial--buffer nil
+ "The selected tutorial buffer.")
+
(defun tutorial--describe-nonstandard-key (value)
"Give more information about a changed key binding.
This is used in `help-with-tutorial'. The information includes
(unless (eq prop-val 'key-sequence)
(delete-region prop-start prop-end))))))
+(defun tutorial--save-on-kill ()
+ "Query the user about saving the tutorial when killing Emacs."
+ (when (buffer-live-p tutorial--buffer)
+ (with-current-buffer tutorial--buffer
+ (if (y-or-n-p "Save your position in the tutorial? ")
+ (tutorial--save-tutorial-to (tutorial--saved-file))
+ (message "Tutorial position not saved"))))
+ t)
+
(defun tutorial--save-tutorial ()
"Save the tutorial buffer.
This saves the part of the tutorial before and after the area
;; (Re)build the tutorial buffer if it is not ok
(unless old-tut-is-ok
(switch-to-buffer (get-buffer-create tut-buf-name))
+ (setq tutorial--buffer (current-buffer))
;; (unless old-tut-buf (text-mode))
(unless lang (error "Variable lang is nil"))
(setq tutorial--lang lang)
;; a hook to save it when the buffer is killed.
(setq buffer-auto-save-file-name nil)
(add-hook 'kill-buffer-hook 'tutorial--save-tutorial nil t)
+ (add-hook 'kill-emacs-query-functions 'tutorial--save-on-kill)
;; Insert the tutorial. First offer to resume last tutorial
;; editing session.