WIP: Add lem-tutor interactive tutorial extension#2144
WIP: Add lem-tutor interactive tutorial extension#2144Catsquotl wants to merge 2 commits intolem-project:mainfrom
Conversation
Closes lem-project#1967 - Alt-x tutorial opens an interactive tutorial buffer - Working copy saved to (lem-home)/lem-tutor-saves/ - Cursor position persisted across sessions - Lesson 1: Movement - Lesson 2: Files and Configuration
|
|
||
| (in-package :lem-tutor) | ||
| (defparameter *tutorial-text* (merge-pathnames "original.txt" (asdf:system-source-directory :lem-tutor))) | ||
| (defparameter *save-file* (merge-pathnames "lem-tutor-saves/lem-tutor-save.txt" (lem-home))) |
There was a problem hiding this comment.
orange flag here: calling merge-pathname and (lem-home) at the top-level works on your machine, but if you share a binary to users/friends, they will have your value in the parameter, and this won't work on their machine. Same on CI. Solution: wrap in a function.
;; exple:
(defparameter *foo* nil)
(defun foo ()
(if *foo*
*foo*
(setf *foo* (merge-pathname …)))| (when (probe-file *progress-file*) | ||
| (with-open-file (stream *progress-file* | ||
| :direction :input) | ||
| (let* ((plist (read stream)) |
There was a problem hiding this comment.
Add error handling maybe, just in case? You never know what users do :p
| @@ -0,0 +1,20 @@ | |||
| MIT License | |||
|
|
|||
| Copyright (c) 2026 Catsquotl | |||
There was a problem hiding this comment.
Is a LICENSE file necessary? First time I see it in extensions/.
| Alt-x Hold Alt, press x | ||
| C-x C-c Hold Control, press x; then hold Control, press c | ||
|
|
||
| "C-" means Control. "M-" means Alt. |
There was a problem hiding this comment.
I would quite like that we wrote Alt and not M ! No ?
(we can say in passing that sometimes we write M- for Alt, it helps)
|
|
||
| Every action in lem is a named command. Keys are shortcuts to commands, | ||
| but there are many commands that have no key binding at all. You can call any command | ||
| by name with Alt-x. |
| ========= | ||
| INTRODUCTION | ||
|
|
||
| You are reading lem-tutor, an interactive tutorial for the lem editor. |
There was a problem hiding this comment.
nitpick: lem with a capital Lem ?
| QUITTING | ||
|
|
||
| To leave lem: | ||
| C-x C-c Quit lem |
There was a problem hiding this comment.
Here, sometimes, or always, give the equivalent command name that we can call with Alt- ? To remind we don't have to memorize keys but we can find commands.
| ----- | ||
| >> C-x C-c | ||
| ----- | ||
| To return to this tutorial after quitting: Alt-x lem-tutor. |
There was a problem hiding this comment.
is lem-tutor correct or can we call Alt-tutorial too ?
| C-v Scroll down one screen | ||
| M-v Scroll up one screen | ||
|
|
||
| This lesson covers the rest. |
There was a problem hiding this comment.
Shall we mention in passing that Lem has a vi-mode? So power-users that didn't know can try right away, others can carry on the tutorial. vi-mode would not be taught here.
your call.
There was a problem hiding this comment.
I've thought about adding an option to choose lem or vi mode for the tutorial. Maybe worth revistliting at this point? Or just assume vi-mode users know what they are doing. I am unsure if that is always the case.
There was a problem hiding this comment.
we can revisit later, let's not double the work for this tutorial first pass. I assume vi-mode users know what they do yeah.
|
|
||
| Its location is one of: | ||
| ~/.lem/init.lisp | ||
| ~/.config/lem/init.lisp (Lem 2.2 and later) |
There was a problem hiding this comment.
suggesting to only mention the new 2.2 location
| or to enable them permanently at startup: | ||
|
|
||
| (add-hook *after-init-hook* (lambda () | ||
| (lem/line-numbers:toggle-line-numbers))) |
There was a problem hiding this comment.
They don't have the same effect? The one-liner seems to be working, no?
There was a problem hiding this comment.
That was deliberate so the user would at least have 2 buffers open to play with in the buffer section and get some hands on experience on editing and configuring lem.
|
👌 I love the progression. |
Closes #1967
This PR does not include tests. Given the code I am unsure what those would even look like.
To review and test:
Claude AI did not write the code, helped me reason through it and held my hand at through most mistakes though