emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 7e32904998: Don't have the tutorial ask to save if we haven't mov


From: Lars Ingebrigtsen
Subject: master 7e32904998: Don't have the tutorial ask to save if we haven't moved
Date: Thu, 19 May 2022 21:59:44 -0400 (EDT)

branch: master
commit 7e32904998db6bcaff78c9329efa1fcbc26cbd70
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Don't have the tutorial ask to save if we haven't moved
    
    * lisp/tutorial.el (tutorial--save-on-kill): Don't ask if the user
    hasn't moved point (bug#37326).
    (help-with-tutorial): Set the start point.
---
 lisp/tutorial.el | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lisp/tutorial.el b/lisp/tutorial.el
index 0f3a1506d6..2c787ae559 100644
--- a/lisp/tutorial.el
+++ b/lisp/tutorial.el
@@ -649,13 +649,15 @@ with some explanatory links."
         (unless (eq prop-val 'key-sequence)
          (delete-region prop-start prop-end))))))
 
+(defvar tutorial--starting-point)
 (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"))))
+      (unless (= (point) tutorial--starting-point)
+        (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 ()
@@ -734,7 +736,6 @@ See `tutorial--save-tutorial' for more information."
         (message "Can't save tutorial: %s is not a directory"
                  tutorial-dir)))))
 
-
 ;;;###autoload
 (defun help-with-tutorial (&optional arg dont-ask-for-revert)
   "Select the Emacs learn-by-doing tutorial.
@@ -914,6 +915,7 @@ Run the Viper tutorial? "))
               (forward-line 1)
               (newline (- n (/ n 2)))))
           (goto-char (point-min)))
+        (setq-local tutorial--starting-point (point))
         (setq buffer-undo-list nil)
         (set-buffer-modified-p nil)))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]