Skip to content

Commit 80f2fd3

Browse files
committed
Restore Demo 1 and Demo 2
1 parent 7bc54ea commit 80f2fd3

File tree

5 files changed

+612
-4
lines changed

5 files changed

+612
-4
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ Presuming [Elpaca](https://github.com/progfolio/elpaca), use as follows:
6565
- [Commands that operate on region](#commands-that-operate-on-region)
6666
- [IDE-like features](#ide-like-features)
6767
- [Demos](#demos)
68-
- [[Demo 1: Practice generating code](http://abo-abo.github.io/lispy/demo-1)](#demo-1-practice-generating-codehttpabo-abogithubiolispydemo-1)
69-
- [[Demo 2: The substitution model for procedure application](http://abo-abo.github.io/lispy/demo-2)](#demo-2-the-substitution-model-for-procedure-applicationhttpabo-abogithubiolispydemo-2)
68+
- [[Demo 1: Practice generating code](http://enzuru.github.io/lispy/demo-1.html)](#demo-1-practice-generating-codehttpabo-abogithubiolispydemo-1)
69+
- [[Demo 2: The substitution model for procedure application](http://enzuru.github.io/lispy/demo-2.html)](#demo-2-the-substitution-model-for-procedure-applicationhttpabo-abogithubiolispydemo-2)
7070
- [[Demo 3: Down the rabbit hole](http://abo-abo.github.io/lispy/demo-3)](#demo-3-down-the-rabbit-holehttpabo-abogithubiolispydemo-3)
7171
- [[Demo 4: Project Euler p100 and Clojure](http://abo-abo.github.io/lispy/demo-4)](#demo-4-project-euler-p100-and-clojurehttpabo-abogithubiolispydemo-4)
7272
- [[Demo 5: ->>ification](http://abo-abo.github.io/lispy/demo-5)](#demo-5--ificationhttpabo-abogithubiolispydemo-5)
@@ -593,8 +593,8 @@ their output will be updated after the eval.
593593

594594
# Demos
595595

596-
## [Demo 1: Practice generating code](http://abo-abo.github.io/lispy/demo-1)
597-
## [Demo 2: The substitution model for procedure application](http://abo-abo.github.io/lispy/demo-2)
596+
## [Demo 1: Practice generating code](http://enzuru.github.io/lispy/demo-1.html)
597+
## [Demo 2: The substitution model for procedure application](http://enzuru.github.io/lispy/demo-2.html)
598598
## [Demo 3: Down the rabbit hole](http://abo-abo.github.io/lispy/demo-3)
599599
## [Demo 4: Project Euler p100 and Clojure](http://abo-abo.github.io/lispy/demo-4)
600600
## [Demo 5: ->>ification](http://abo-abo.github.io/lispy/demo-5)

docs/demo-1.html

Lines changed: 156 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/demo-1.org

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#+TITLE: lispy.el demo 1: practice generating code
2+
#+LANGUAGE: en
3+
#+OPTIONS: H:3 num:nil toc:nil
4+
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="demo-style.css"/>
5+
6+
| [[https://github.com/abo-abo/lispy][Back to github]] | [[https://raw.githubusercontent.com/abo-abo/lispy/gh-pages/demo-1.org][This file in org-mode]] | [[http://abo-abo.github.io/lispy/][Function reference]] |
7+
8+
* Intro
9+
Comes from [[http://emacs.stackexchange.com/questions/3881/changing-the-role-of-the-underline-and-the-minus-sign-just-in-latex-mode][this emacs.stackexchange question]].
10+
* Task summary
11+
For =LaTeX-mode=, swap ~-~ to ~_~, and swap ~6~ to ~^~.
12+
* Screencast
13+
The screencast for this demo is here: https://www.youtube.com/watch?v=2w1h48CYOMo
14+
* Resulting code
15+
#+begin_src emacs-lisp
16+
(define-key LaTeX-mode-map "_" (lambda () (interactive) (insert "-")))
17+
(define-key LaTeX-mode-map "-" (lambda () (interactive) (insert "_")))
18+
(define-key LaTeX-mode-map "^" (lambda () (interactive) (insert "6")))
19+
(define-key LaTeX-mode-map "6" (lambda () (interactive) (insert "^")))
20+
#+end_src
21+
* How to generate this code:
22+
** step one
23+
Write:
24+
#+begin_src emacs-lisp
25+
"-" "_"
26+
"6" "^"
27+
#+end_src
28+
- position the point at the start
29+
- ~C-7~ to add one cursor
30+
- ~M-m~ to mark the first string
31+
- ~>~ to extend the region to the second string
32+
- ~c~ to clone region
33+
- ~i~ to select the first element of the region
34+
- ~s~ to move the region down
35+
- ~C-7~ to cancel =multiple-cursors=.
36+
You should now have:
37+
#+begin_src emacs-lisp
38+
"_" "-"
39+
"-" "_"
40+
"^" "6"
41+
"6" "^"
42+
#+end_src
43+
** step two
44+
Write:
45+
#+begin_src emacs-lisp
46+
(define-key LaTeX-mode-map (lambda () (interactive) (insert)))
47+
#+end_src
48+
Kill it with ~C-,~ or ~C-k~.
49+
** step three
50+
- position the point at the start
51+
- ~M-3 C-7~ to add three cursors
52+
- ~C-y~ to paste the code from before
53+
- add one space
54+
- ~M-m~ mark
55+
- ~>~ grow
56+
- ~ok~ insert up
57+
- ~iw~ select first and move up
58+
- ~jj~ go down twice
59+
- ~okok~ insert up twice
60+
- ~C-7~ to cancel =multiple-cursors=
61+
62+
#+BEGIN_HTML
63+
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
64+
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
65+
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
66+
#+END_HTML

0 commit comments

Comments
 (0)