Advertisement
brickviking

2019-notes.eev

Oct 18th, 2020 (edited)
821
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 19.27 KB | None | 0 0
  1. [INCLUDE TH/speedbar.blogme]
  2. [SETFAVICON dednat4/dednat4-icon.png]
  3. [SETFAVICON IMAGES/forthsun.png]
  4. [#
  5. (defun c () (interactive) (find-blogme3-sh0-if "emacsconf2019"))
  6. (defun u () (interactive) (find-blogme-upload-links "emacsconf2019"))
  7. ;;    http://angg.twu.net/emacsconf2019.html
  8. ;; file:///home/edrx/TH/L/emacsconf2019.html
  9. ;; (eco)
  10. ;;
  11. #]
  12. [lua:
  13.   require "sexp"   -- (find-blogme3 "sexp.lua")
  14.   def [[ ECS0 1 time youtube_make_url("86yiRG8YJD0", time) ]]
  15.   def [[ ECS  2 time,text BR()..R(ECS0(time), time).." "..text ]]
  16.   def [[ ECSQ 2 time,text ECS(time, Q(text)) ]]
  17. ]
  18. [SETHEADSTYLE [LUCIDA]]
  19. [htmlize [J Eev @ EmacsConf 2019]
  20.  
  21. [P This is what I submitted to the [R https://emacsconf.org/2019
  22. EmacsConf 2019]:]
  23.  
  24. [NARROW
  25. [P [BF Title:]
  26.   [BR] How to record executable notes with eev - and how to play them
  27.   back
  28.   ]
  29.  
  30. [P A transcription of what I say in the demo:
  31. [ECSQ 0:00 Hello. The name of this talk is ]
  32. [ECSQ 0:04 "How to record executable notes with Eev and how to play them back." ]
  33. [ECSQ 0:07 I'm Eduardo Ochs—this person here—the author of Eev, ]
  34. [ECSQ 0:11 and this is Selana Ochs, my main contributor at the moment. ]
  35. [ECSQ 0:16 Let me start by explaining the prehistory of Eev. ]
  36. [ECSQ 0:18 Eev appeared by accident. ]
  37. [ECSQ 0:21 I was fascinated by programming and from what I knew ]
  38. [ECSQ 0:25 UNIX seemed to be the right thing and in 1995 ]
  39. [ECSQ 0:28 I bought a computer that could run GNU Linux, ]
  40. [ECSQ 0:30 and a Linux CD. ]
  41. [ECSQ 0:32 I was studying mathematics at the University ]
  42. [ECSQ 0:34 (not computer science) and I was ]
  43. [ECSQ 0:37 able to learn a tiny bit of UNIX and Lisp at the University. ]
  44. [ECSQ 0:41 My social skills were very bad; ]
  45. [ECSQ 0:46 I couldn't socialize properly with ]
  46. [ECSQ 0:48 the people there who really knew Unix. ]
  47. [ECSQ 0:51 They kept saying to me that ]
  48. [ECSQ 0:53 everybody uses VI ]
  49. [ECSQ 0:55 but my memory was very bad ]
  50. [ECSQ 0:56 as bad as my social skills ]
  51. [ECSQ 0:58 and I typed slowly and with lots of mistakes ]
  52. [ECSQ 1:00 so at one point I decided to give up ]
  53. [ECSQ 1:03 learning VI and tried Emacs ]
  54. [ECSQ 1:05 and I found it [IT mind-blowing ]. ]
  55. [ECSQ 1:07 I was taking notes about ]
  56. [ECSQ 1:10 everything that I was learning ]
  57. [ECSQ 1:14 and my notes started to have ]
  58. [ECSQ 1:16 lots of elisp hyperlinks like these. ]
  59. [ECSQ 1:17 When we execute this ]
  60. [ECSQ 1:19 [COLOR GREEN (find-file "/usr/share/emacs/19.24/lisp") ]
  61. [ECSQ 1:21 it opens a certain directory ]
  62. [ECSQ 1:22 with lots of interesting files in it ]
  63. [ECSQ 1:25 and when we execute this ]
  64. [ECSQ 1:28 [COLOR GREEN (find-file "/usr/share/emacs/19.24/lisp/files.el") ]
  65. [ECSQ 1:29 it opens a specific file in the directory. ]
  66. [ECSQ 1:31 At first I was using hundreds of hyperlinks ]
  67. [ECSQ 1:33 like this to take notes of ]
  68. [ECSQ 1:35 everything that I found interesting. ]
  69. [ECSQ 1:38 It was easy to follow these ]
  70. [ECSQ 1:40 expressions as hyperlinks. ]
  71. [ECSQ 1:42 In the beginning I used the standard function ]
  72. [ECSQ 1:45 'find_file' ]
  73. [ECSQ 1:48 and then I created a variant of it called ]
  74. [ECSQ 1:50 'find_fline' ]
  75. [ECSQ 1:51 that accepted extra arguments. ]
  76. [ECSQ 1:53 In the beginning it only supported the ]
  77. [ECSQ 1:55 line number like this that would ]
  78. [ECSQ 1:56 open this file and go to the line 423 ]
  79. [ECSQ 1:57 and then I made it accept]
  80. [ECSQ 2:02 a string to search for ]
  81. [ECSQ 2:05 so this variant here would open this file ]
  82. [ECSQ 2:09 and search for the first ]
  83. [ECSQ 2:10 occurrence of this string here ]
  84. [ECSQ 2:12 and I also invented shorter hyperlinks]
  85. [ECSQ 2:16 like these three here in which ]
  86. [ECSQ 2:19 I do not need to specify the directory ]
  87. [ECSQ 2:23 like this because this directory is ]
  88. [ECSQ 2:26 somehow embedded in this code here: 'e'. ]
  89. [ECSQ 2:29 'e' means the directory with the list ]
  90. [ECSQ 2:34 files in Emacs. ]
  91. [ECSQ 2:36 I also wrote a very primitive way ]
  92. [ECSQ 2:38 to send the current region to a shell. ]
  93. [ECSQ 2:42 When I typed "Meta-x Eev" ]
  94. [ECSQ 2:44 which means "emacs-execute-verbosely", ]
  95. [ECSQ 2:48 this command wrote the region into a ]
  96. [ECSQ 2:50 certain temporary file; if I went to ]
  97. [ECSQ 2:54 the shell and I typed 'ee' ]
  98. [ECSQ 2:56 it would run the commands in this ]
  99. [ECSQ 2:57 temporary file to execute them. ]
  100. [ECSQ 3:00 Now these are some technical details that I did not want to discuss now. ]
  101. [ECSQ 3:04 In a few months using that I had created several ]
  102. [ECSQ 3:08 other kinds of elisp hyperlinks, all of them also supporting these  ]
  103. [ECSQ 3:13 extra arguments that indicated usually strings to search for ]
  104. [ECSQ 3:18 but also sometimes I could use that to point to a certain line number. ]
  105. [ECSQ 3:23 I called these as extra arguments: "pos-spec-lists.",
  106. [ECSQ 3:27 and here are some examples. These hyperlinks here ]
  107. [ECSQ 3:32 would open the man page of GNU awk and go to the specific section in it. ]
  108. [ECSQ 3:39 These hyperlinks open the info manual of "make" and go to  ]
  109. [ECSQ 3:47 certain nodes in this menu and in some cases it also looks first ]
  110. [ECSQ 3:52 for these strings in these nodes. ]
  111. [ECSQ 3:57 These are the hyperlinks here; they run certain commands in the shell ]
  112. [ECSQ 4:02 and then display its output. ]
  113. [ECSQ 4:07 The Elisp hyperlink set that I was using ]
  114. [ECSQ 4:11 could be always be put in comments in scripting languages. They were ]
  115. [ECSQ 4:16 always the sexp at the end of the line—so let me show you an example here. ]
  116. [ECSQ 4:21 This thing here is a small TCL script, this line is a comment, and this s-expression here is ]
  117. [ECSQ 4:30 treated by TCL as a comment but in Emacs we can put the cursor here say and then ]
  118. [ECSQ 4:36 we type "Ctrl-e" to go to the end of the line and then "Ctrl-x Ctrl-e" to ]
  119. [ECSQ 4:40 execute this and if we execute this we visit the file ]
  120. [ECSQ 4:45 that is mentioned in the line below. ]
  121. [ECSQ 4:48 I was doing that so much going to the end of the line and then ]
  122. [ECSQ 4:53 executing the expression before point that I defined a key that would do that; ]
  123. [ECSQ 4:59 so the fact that "Meta-e" would work like "Ctrl-e" to go to ]
  124. [ECSQ 5:02 the end of the line and then "Ctrl-x Ctrl-e" ]
  125. [ECSQ 5:06 and my name for it was 'eval-sexp-eol' (end of line here). ]
  126. [ECSQ 5:12 So "Ctl-x Ctl-e",  that's the standard key sequence, means ]
  127. [ECSQ 5:16 'eval-last-sexp' and I named "Meta-e" 'eval-sexp-eol'. ]
  128. [ECSQ 5:24 At the time all the languages and interpreters that I was using ]
  129. [ECSQ 5:30 supported at least hyperlinks in comments like this ]
  130. [ECSQ 5:34 and I also created variants of "Meta-x eev" that could ]
  131. [ECSQ 5:38 send the region to other interpreters and in a few years using that, ]
  132. [ECSQ 5:44 I had several megabytes of notes and scripts. ]
  133. [ECSQ 5:47 I not only had scripts with elisp hyperlinks in comments, ]
  134. [ECSQ 5:52 but also I had tons of executable notes— ]
  135. [ECSQ 5:56 I called them "e-scripts"—that were totally free form; ]
  136. [ECSQ 6:00 some parts of them were blocks of elisp hyperlinks, ]
  137. [ECSQ 6:04 some other parts were blocks of codes to be sent to shells and to other interpreters, ]
  138. [ESCQ 6:08 and some other parts with just comments in English or Portuguese or whatever. ]
  139. [ECSQ 6:15 In 1995 I started to have dial-up internet at home and in 1999 ]
  140. [ESCQ 6:21 I created a home page and I uploaded all the scripts and notes ]
  141. [ECSQ 6:25 to my home page because it was good karma and it was a way to become a person ]
  142. [ECSQ 6:33 who deserves hints and help, instead of just being the idiot that I was ]
  143. [ECSQ 6:38 considered in my University because I couldn't learn VI. ]
  144. [ECSQ 6:41 And at that point I was absolutely sure that everybody was using Emacs like that, ]
  145. [ECSQ 6:48 that Emacs was made to be used with elisp hyperlinks. ]
  146. [ECSQ 6:56 At one point I sent an email to one of the Emacs mailing lists, in the email ]
  147. [ECSQ 7:02 I used some of the things that I use at home—some elisp hyperlinks ]
  148. [ECSQ 7:06 and some other tricks—and I explained how to use everything there, ]
  149. [ESCQ 7:11 and I apologized for the ugly names. I said: ]
  150. [ESCQ 7:14 "I don't know what are the standard functions that do that, so I wrote my own ones…" ]
  151. [ECSQ 7:19 and I apologized for choosing bad names with them. ]
  152. [ECSQ 7:23 Richard Stallman himself answered and his answer was sort of: ]
  153. [ECSQ 7:27 "This looks interesting and as far as I know no one else is using Emacs like this. ]
  154. [ECSQ 7:34 Someone should clean up the code and document it so that ]
  155. [ECSQ 7:38 we can include it in Emacs; can you do that?" ]
  156. [ESCQ 7:41 Well, this was amazing, it wasn't believable; I wasn't no one in ]
  157. [ECSQ 7:46 the university. I was just an idiot; and  suddenly God spoke to me ]
  158. [ECSQ 7:50 and gave me a mission. So I started then to work to ]
  159. [ECSQ 7:57 make Eev into an official package. I submitted some code ]
  160. [ECSQ 8:00 and Stallman answered very briefly. He had some objections that I didn't ]
  161. [ECSQ 8:06 understand very well, they didn't make much sense to me. ]
  162. [ECSQ 8:10 And in the year 2000 I discovered that he was going to give a talk ]
  163. [ECSQ 8:14 in a city close to where I live. I live in Rio De Janerio in Brazil, ]
  164. [ECSQ 8:18 and he was going to give a talk in Campinas that is just 500 kilometers away  ]
  165. [ECSQ 8:23 from Rio De Janerio. I went there, I attended the talk ]
  166. [ECSQ 8:27 and I chatted with Stallman after the talk. I mentioned ]
  167. [ECSQ 8:31 things about Eev and he remembered the discussion and the code ]
  168. [ECSQ 8:36 and he said that "…users should not be forced to see elisp…" ]
  169. [ECSQ 8:39 and then I was incredibly offended, that was totally absurd ]
  170. [ECSQ 8:44 and Stallman was so scared so startled by my reaction that he walked away! ]
  171. [ECSQ 8:51 And the thing is that for me, the ability to write one-liners in Emacs Lisp ]
  172. [ESCQ 8:56 was the thing that completely dissolved the barrier between users and programmers. ]
  173. [ECSQ 9:01 It was a kind of a philosopher's stone that could turn users into ]
  174. [ECSQ 9:06 programmers almost magically. It was a catalyst and it was the distilled essence ]
  175. [ECSQ 9:13 of free software so it was absurd to say this; it was sick to say that ]
  176. [ECSQ 9:19 users should not be forced to see elisp. ]
  177. [ECSQ 9:23 Okay, so let me fast forward many years. ]
  178. [ECSQ 9:26 In the year 2000 I had "users should not be forced to see elisp" and also ]
  179. [ECSQ 9:32 "M-x eev" that was one of my ways of saving as executable notes. ]
  180. [ECSQ 9:39 It was difficult to set up because users that wanted to use it had to change their ]
  181. [ECSQ 9:45 rcfiles a bit, so very few people were trying Eev and installing it and using it. ]
  182. [ECSQ 9:54 So let me fast forward many years to 2019. "M-x eev" is obsolete now, I use something ]
  183. [ECSQ 10:03 called eepitch instead. The setup is now totally trivial, Eev comes with lots of ]
  184. [ECSQ 10:09 sandboxed tutorials with names like "find-*-intro". I've been using ]
  185. [ECSQ 10:16 Eev to teach Emacs and free software principles to people who ]
  186. [ECSQ 10:20 don't know anything about programming or UNIX that they're just kind of ]
  187. [ECSQ 10:24 fascinated by the idea of programming but they know very little. ]
  188. [ECSQ 10:28 Now people can learn Eev by memorizing just three keys or just two, ]
  189. [ECSQ 10:33 because this third one is secondary. M-e is for execute and M-j is for jump ]
  190. [ECSQ 10:39 M-k runs a kind of "kill this buffer" and sometimes can be used to go back from a hyperlink. ]
  191. [ECSQ 10:47 In April 10, 2019 Eev finally became an ELPA package, ]
  192. [ECSQ 10:55 it finally became official in some way. ]
  193. [ECSQ 10:59 This new Eev has lots of tutorials with names like this: "find-*-intro" ]
  194. [ECSQ 11:04 and when you install it with the beginner setup, and you start Emacs ]
  195. [ECSQ 11:10 in a certain way this starts Emacs, turning Eev mode on, and it opens the  main tutorial. ]
  196. [ECSQ 11:21 If you type just "M-j" without a numeric prefix you get a page with this header. ]
  197. [ECSQ 11:27 So it opens a page with this header and some mysterious things below it. ]
  198. [ECSQ 11:32 This part of the header explains how to run Eev "M-j" with some of the main numeric prefixes. ]
  199. [ECSQ 11:42 And so "M-5 M-j" goes to the main tutorial method, ]
  200. [ECSQ 11:50 "M-2 M-j" goes to a kind of a tutorial that is mainly an index of the main keys of ]
  201. [ECSQ 11:56 both Eev and Emacs, and we also have these three hyperlinks here. ]
  202. [ECSQ 12:04 This first one goes to a section of the manual of the main tutorial that explains "M-j", ]
  203. [ECSQ 12:12 this one goes to the section about the Eev keys in the tutorial about keys, ]
  204. [ECSQ 12:18 and this one goes to the first section about Emacs keys in this tutorial ]
  205. [ECSQ 12:25 that works like an index of keys. ]
  206. [ECSQ 12:29 If people followed this and they can follow hyperlinks that go to the ]
  207. [ECSQ 12:38 two pages in the Emacs manuals, they usually learned very quickly how to ]
  208. [ECSQ 12:43 navigate these manuals and how to go back to the tutorials  ]
  209. [ECSQ 12:47 and how to switch between tutorials, other files, the  ]
  210. [ECSQ 12:52 manuals and so on. Okay, let me show you a demo now. ]
  211. [ECSQ 12:57 I mentioned that "M-x eev" is now obsolete; it has been replaced by ]
  212. [ECSQ 13:04 something that we run, but by just typing "F8", ]
  213. [ECSQ 13:08 that always operates on the current line and moves down. ]
  214. [ECSQ 13:11 Let me show you an example of "executable notes and how to play them back".]
  215. [ECSQ 13:18 I will only be able to explain how to _record_ these executable notes in the longer video.]
  216. [ECSQ 13:25 Anyway: when I was recording this video I realized that xpdf was behaving in a very annoying way -]
  217. [ECSQ 13:34 it was changing the page in moments that I didn't want it to...]
  218. [ECSQ 13:39 and the problem was that when my finger was at the right side of the touchpad]
  219. [ECSQ 13:45 and I moved it up or down this would be interpreted as a _mousewheel scroll_,]
  220. [ECSQ 13:52 that would be interpreted as PageUp or PageDown,]
  221. [ECSQ 13:57 and I wanted to disable that - I wanted to disable the support for mousewheel scroll in xpdf.]
  222. [ECSQ 14:01 So I took a look at the man page for xpdf - here -]
  223. [ECSQ 14:06 I didn't find a simple way to change that by changing a configuration file]
  224. [ECSQ 14:11 but I found a section that described all the default mouse bindings - here -]
  225. [ECSQ 14:18 I found a line that seemed to be relevant - this one -]
  226. [ECSQ 14:21 I created a hyperlink that pointed directly to that line - this one -]
  227. [ECSQ 14:30 and I also found an explanation for what this function does]
  228. [ECSQ 14:35 and the explanation says that this function either scrolls up by some pixels]
  229. [ECSQ 14:41 or it moves to the previous page - which means PageUp.]
  230. [ECSQ 14:46 So the _quickest_ way to change xpdf - because I was in a hurry -]
  231. [ECSQ 14:51 was by downloading and recompiling the Debian source with some changes.]
  232. [ECSQ 14:56 I used this hyperlink here, that uses a template, to generate several links]
  233. [ECSQ 15:01 and several shell commands for downloading and recompiling a debian source package.]
  234. [ECSQ 15:08 I copied these lines to my notes with some small changes,]
  235. [ECSQ 15:15 and this part - here - uses the alternative to M-x eev...]
  236. [ECSQ 15:20 remember that I said that my old way of sending lines to the shell was by using M-x eev,]
  237. [ECSQ 15:27 that was very clumsy: it needed several keystrokes, and it was difficult to install]
  238. [ECSQ 15:34 because we would need to change an rcfile.]
  239. [ECSQ 15:38 So, the new alternative to it uses just <f8>,]
  240. [ECSQ 15:43 that behaves in one way in lines that start with a red star - like these ones -]
  241. [ECSQ 15:49 and in another way in lines that do not start with a red star.]
  242. [ECSQ 15:54 Let me change the font to a smaller one to show how it works.]
  243. [ECSQ 16:00 If I type <f8> in these three lines - here -]
  244. [ECSQ 16:03 this will set up a target buffer - here - running a shell,]
  245. [ECSQ 16:08 and if I type <f8> in these lines - here - this will send these commands to the shell.]
  246. [ECSQ 16:14 This command, in particular, it downloads - sorry, it _makes sure_ that I have]
  247. [ECSQ 16:20 all the Debian packages that I need to be able to compile the source for xpdf,]
  248. [ECSQ 16:27 and this command - here - downloads the source package for xpdf]
  249. [ECSQ 16:34 and unpacks it. It takes a few seconds - here.]
  250. [ECSQ 16:40 I do not want to execute this thing now - this thing would recompile the source.]
  251. [ECSQ 16:49 So, this hyperlink - here - opens this temporary directory,]
  252. [ECSQ 16:54 and it turns out that the source package was unpacked in this subdirectory - here -]
  253. [ECSQ 17:04 so this hyperlink points to the subdirectory,]
  254. [ECSQ 17:07 and this s-expression - here - defines several shorter hyperlinks with "find-xpdf" in their names]
  255. [ECSQ 17:17 that operate in this subdirectory - here.]
  256. [ECSQ 17:22 So, this hyperlink - here - opens that directory,]
  257. [ECSQ 17:30 this one - here - runs these shell commands in that directory]
  258. [ECSQ 17:37 to list all the files - remember that I haven't compiled anything yet,]
  259. [ECSQ 17:41 so all these files belong to the source package,]
  260. [ECSQ 17:46 and this one is much more interesting - it runs a grep in that directory.]
  261. [ECSQ 17:51 Remember that I discovered that the name of the mouse event that was bound to]
  262. [ECSQ 17:57 PageUp, or to the _bad_ PageUp in the bad PageDown,]
  263. [ECSQ 18:02 was MousePress4 (and MousePress5)...]
  264. [ECSQ 18:06 So this grep here searches for all the occurrences of MousePress4]
  265. [ECSQ 18:12 in the source... and it shows that there are only two occurrences,]
  266. [ECSQ 18:18 one of them in the source for the man page and the other one]
  267. [ECSQ 18:22 in the rendered version of that source, which is not good...]
  268. [ECSQ 18:27 Let me change to the bigger font again.]
  269. [ECSQ 18:31 So I decided to search for the function that was associated to that mouse event -]
  270. [ECSQ 18:39 this function here - and I found several occurrences of that string,]
  271. [ECSQ 18:45 and it turned out that _this_ is a relevant occurrence,]
  272. [ECSQ 18:49 so I created a direct link to that source file,]
  273. [ECSQ 18:53 and I discovered that if I commented out these lines by hand]
  274. [ECSQ 19:03 and recompiled everything and installed the new debian binary package]
  275. [ECSQ 19:09 then I would get an xpdf that does not have the annoying behavior. But...]
  276. [ECSQ 19:15 That's it.]
  277. ]
  278.  
  279. [br]
  280.  
  281. [P [BF My longer presentation:]
  282. [R http://angg.twu.net/LATEX/2019emacsconf-long.pdf slides] (work in progress!!!)
  283. ]
  284.  
  285. [P The longer presentation [COLOR red will] [IT complement] the
  286. shorter one, and will be mainly about:
  287.  
  288. [BR] 2) how to create elisp hyperlinks and eepitch blocks with very few keystrokes,
  289.  
  290. [BR] 3) how to use this to do "task"+"notes" with just a few more
  291.   keystrokes than we would use to do just "task",
  292.  
  293. [BR] how to switch between "task" and "notes" without losing focus,
  294.  
  295. [BR] other design decisions - like the sexp-based interface - and why
  296. some people hate them.
  297.  
  298. ]
  299.  
  300. [br]
  301.  
  302. [P [BF On integrating eev and Org]
  303. [BR] After the conference I started to work on this:
  304.      [TT [STOH (find-org-intro)]]
  305. [BR] See [R https://orgmode.org/]
  306.       and these threads: [R
  307.  
  308.      https://lists.gnu.org/archive/html/emacs-orgmode/2013-11/msg00124.html
  309.      2013-11], [R
  310.      https://lists.gnu.org/archive/html/emacs-orgmode/2019-11/msg00113.html
  311.      2019-11].
  312. ]
  313.  
  314.  
  315.  
  316.  
  317. [#
  318. More links:
  319.   (find-es "emacs" "emacsconf-2019")
  320.  
  321. Slides for the 10-minute video (work in progress!):
  322.   http://angg.twu.net/LATEX/2019emacsconf.pdf
  323. Slides for the 20-minute video:
  324.   (I haven't started working on them!)
  325. ]
  326.  
  327.  
  328.  
  329.  
  330.  
  331. ]
  332. [#
  333.  # Local Variables:
  334.  # coding: raw-text-unix
  335.  # modes: (fundamental-mode blogme-mode)
  336.  # End:
  337. #]
  338.  
  339.  
  340.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement