emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/eev 7a2f5d42bc: New intro: (find-edit-index-intro).


From: ELPA Syncer
Subject: [elpa] externals/eev 7a2f5d42bc: New intro: (find-edit-index-intro).
Date: Sun, 20 Nov 2022 13:57:34 -0500 (EST)

branch: externals/eev
commit 7a2f5d42bcf70e0f27a645be6a2b21072543e688
Author: Eduardo Ochs <eduardoochs@gmail.com>
Commit: Eduardo Ochs <eduardoochs@gmail.com>

    New intro: (find-edit-index-intro).
---
 ChangeLog     |  11 +++
 VERSION       |   4 +-
 eepitch.el    |   5 +-
 eev-hydras.el | 196 +++++++++++++---------------------------------
 eev-intro.el  | 244 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 5 files changed, 307 insertions(+), 153 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index db4721f0bc..50194c617b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2022-11-20  Eduardo Ochs  <eduardoochs@gmail.com>
+
+       * eev-hydras.el (eev-index-edit): renamed to `ee-edit-index'.
+       (eev-index-replace): renamed to `ee-edit-index-replace'.
+       (hydra-eev-index-edit): renamed to `ee-edit-index-hydra'.
+       (find-eev-index-edit-intro): deleted.
+
+       * eev-intro.el (find-edit-index-intro): new function.
+
+       * eepitch.el (eepitch-gnuplot): use `ee-with-pager-cat'.
+
 2022-11-19  Eduardo Ochs  <eduardoochs@gmail.com>
 
        * eev-intro.el (find-kla-intro): several new sections.
diff --git a/VERSION b/VERSION
index 2bef090546..0cb121e4cd 100644
--- a/VERSION
+++ b/VERSION
@@ -1,2 +1,2 @@
-Sat Nov 19 03:58:17 GMT 2022
-Sat Nov 19 00:58:17 -03 2022
+Sun Nov 20 18:26:26 GMT 2022
+Sun Nov 20 15:26:26 -03 2022
diff --git a/eepitch.el b/eepitch.el
index 00b1d63512..102e725715 100644
--- a/eepitch.el
+++ b/eepitch.el
@@ -19,7 +19,7 @@
 ;;
 ;; Author:     Eduardo Ochs <eduardoochs@gmail.com>
 ;; Maintainer: Eduardo Ochs <eduardoochs@gmail.com>
-;; Version:    20221101
+;; Version:    20221120
 ;; Keywords:   e-scripts
 ;;
 ;; Latest version: <http://angg.twu.net/eev-current/eepitch.el>
@@ -1014,7 +1014,8 @@ The arguments are explained here:
 ;; We force GhostScript's resolution to make its window fit on the screen.
 (defun eepitch-gs () (interactive) (eepitch-comint "gs" "gs -r45"))
 (defun eepitch-gs () (interactive) (eepitch-comint "gs" "gs -r60"))
-(defun eepitch-gnuplot () (interactive) (eepitch-comint "gnuplot" "gnuplot"))
+(defun eepitch-gnuplot () (interactive)
+  (eepitch '(ee-with-pager-cat '(find-comintprocess "gnuplot" "gnuplot"))))
 
 ;; Java-based languages:
 (defun eepitch-bsh () (interactive)
diff --git a/eev-hydras.el b/eev-hydras.el
index da9151fe91..479d018ad6 100644
--- a/eev-hydras.el
+++ b/eev-hydras.el
@@ -47,7 +47,7 @@
 ;; run its tutorial - i.e., execute these two sexps:
 ;;
 ;;   (require 'eev-hydras)
-;;   (find-eev-index-edit-intro)
+;;   (find-edit-index-intro)
 ;;
 ;; This code will probably change a LOT in the next months.
 ;; Update: I recorded a video, it's here:
@@ -57,10 +57,8 @@
 
 
 
-;; «.hydra-eev-index-edit»             (to "hydra-eev-index-edit")
-;; «.find-eev-index-edit-intro»                (to "find-eev-index-edit-intro")
-
-
+;; «.ei»                               (to "ei")
+;; «.ee-edit-index-hydra»              (to "ee-edit-index-hydra")
 
 ;; See: https://github.com/abo-abo/hydra
 ;;      (find-epackage-links 'hydra "hydra" t)
@@ -68,28 +66,50 @@
 ;;
 (require 'hydra)
 
-
-
-(defalias 'ei 'eev-index-edit)
-
-(defun eev-index-edit ()
-  "Call `eev-index-edit/body' to edit the index."
-  (interactive)
-  (hydra-eev-index-edit/body))
-
-(defun eev-index-replace (from-string to-string)
+(defun ee-edit-index-replace (from-string to-string)
   "Replace FROM-STRING to TO-STRING in the current line."
+  (eek "C-a")
   (search-forward from-string (ee-eol))
   (replace-match to-string)
   (eek "C-a"))
 
 
 
-;; «hydra-eev-index-edit»  (to ".hydra-eev-index-edit")
-;; Try: (find-eapropos    "hydra-eev-index-edit")
-;;      (find-ekeymapdescr hydra-eev-index-edit/keymap)
+;;;  __  __                  _ 
+;;; |  \/  |    __  __   ___(_)
+;;; | |\/| |____\ \/ /  / _ \ |
+;;; | |  | |_____>  <  |  __/ |
+;;; |_|  |_|    /_/\_\  \___|_|
+;;;                            
+;; «ei»  (to ".ei")
+;; This file is not loaded by default, but if you run
+;;   (require 'eev-hydras)
+;; this will define `M-x ei' as an alias for `M-x ee-edit-index'.
+(defalias 'ei 'ee-edit-index)
+
+(defun ee-edit-index ()
+  "Call `ee-edit-index-hydra/body' to edit the index."
+  (interactive)
+  (ee-edit-index-hydra/body))
+
+
+
+;;;  _   _           _           
+;;; | | | |_   _  __| |_ __ __ _ 
+;;; | |_| | | | |/ _` | '__/ _` |
+;;; |  _  | |_| | (_| | | | (_| |
+;;; |_| |_|\__, |\__,_|_|  \__,_|
+;;;        |___/                 
 ;;
-(defhydra hydra-eev-index-edit (:color green :hint nil)
+;; «ee-edit-index-hydra»  (to ".ee-edit-index-hydra")
+;; Running a `defhydra' defines many functions.
+;; You can inspect them with:
+;;   (find-eapropos       "ee-edit-index-hydra")
+;;   (find-ekeymapdescr    ee-edit-index-hydra/keymap)
+;;   (find-efunctiondescr 'ee-edit-index-hydra/body)
+;;   (find-efunctionpp    'ee-edit-index-hydra/body)
+;;
+(defhydra ee-edit-index-hydra (:color green :hint nil)
   "
 _q_:quit    ^^^^                                    _0_: delthiswindow
  werty:  _u_:prev    _i_:insert  _o_:second window  _p_:prev
@@ -98,143 +118,35 @@ asdfgh:  _j_:next    _k_:kill    _l_:eval
 Standard usage: _k__o__p__l__i__0_q
 Use `_,_'s and `_._'s between the `_i_' and the `_0_' to adjust the `(to 
...)'.\n"
   ;;
-  ;; Left column: movement by anchors
-  ("u" (re-search-backward (ee-tag-re)))
-  ("j" (re-search-forward  (ee-tag-re)))
-  ;; Kill/Otherwindow/Prev/evaL/Insert/adj<-/adj->/delthiswindow:
+  ;; <k>ill, <o>ther window, <p>rev anchor, eva<l>, <i>nsert, C-x <0>:
   ("k" (eek "C-a C-SPC <down> C-w"))
   ("o" (eek "C-x 1 C-x 3 C-x o"))
   ("p" (re-search-backward (ee-tag-re)))
   ("l" (eek "M-e"))
   ("i" (eek "C-a <down> C-y <up>"))
-  ("," (eev-index-replace "\t(to "   "(to "))
-  ("." (eev-index-replace   "(to " "\t(to "))
   ("0" (eek "C-x 0"))
+  ("q" nil)
+  ;;
+  ;; Reindent:
+  ("," (ee-edit-index-replace "\t(to "   "(to "))
+  ("." (ee-edit-index-replace   "(to " "\t(to "))
+  ;;
+  ;; Next anchor and previous anchor:
+  ("n" (re-search-forward  (ee-tag-re)))
+  ("u" (re-search-backward (ee-tag-re)))
+  ("j" (re-search-forward  (ee-tag-re)))
+  ;;
   ;; Other keys:
   ("<down>" (eek "<down>"))
   ("<up>"   (eek "<up>"))
-  ("1"      (eek "C-x 1"))
-  ("2"      (eek "M-2 M-e"))
   ("<"      (eek "M-<"))
   ("M-<"    (eek "M-<"))
-  ("q"      nil))
-
-
-
-
-
-;; «find-eev-index-edit-intro»  (to ".find-eev-index-edit-intro")
-;; Skel: (find-intro-links "eev-index-edit")
-
-(defun find-eev-index-edit-intro (&rest pos-spec-list) (interactive)
-  (let ((ee-buffer-name "*(find-eev-index-edit-intro)*"))
-    (apply 'find-eintro "\
-\(Re)generate: (find-eev-index-edit-intro)
-Source code:  (find-efunction 'find-eev-index-edit-intro)
-More intros:  (find-eev-quick-intro)
-              (find-eev-intro)
-              (find-eepitch-intro)
-This buffer is _temporary_ and _editable_.
-It is meant as both a tutorial and a sandbox.
-
-
-
-This \"intro\" is a sandboxed tutorial for:
-
-  (find-eev \"eev-hydras.el\")
-  (find-refining-intro \"5. Pointing to anchors\")
-  (find-refining-intro \"5. Pointing to anchors\" \"but I don't touch-type\")
-
-In these sections about anchors in the main tutorial - see:
-
-  (find-eev-quick-intro \"8.3. Creating index/section anchor pairs\")
-  (find-eev-quick-intro \"8.4. Creating e-script blocks\")
-
-I said that I organize the indexes of my e-script files - like:
-
-  (find-wget \"http://angg.twu.net/e/youtube.e\";)
-              http://angg.twu.net/e/youtube.e.html
-
-by hand. This was true until april 2021, when I wrote a hydra for
-that and started to play with it.
-
-Remember that many functions in eev create temporary buffers that
-have many lines, or blocks of lines, that can be used to perform
-different actions; they act as visual interfaces in which the
-actions are spread vertically, with at most one action per line.
-Hydra.el lets us create interfaces in which each action is bound
-to a key, and the minibuffer/echo area is used to display a
-reminder of what each key does.
-
-This is an index, followed by two e-script blocks, and by a
-\"plic\" and a \"bletch\" that you will use to create new
-e-script blocks.
-
-
-
-# «.foo»       (to \"foo\")
-# «.bar»       (to \"bar\")
-
-
-
-#####
-#
-# foo
-# 2021may20
-#
-#####
-
-# «foo»  (to \".foo\")
-
-
-
-#####
-#
-# bar
-# 2021may20
-#
-#####
-
-# «bar»  (to \".bar\")
-
-
-plic
-bletch
-
-
-
-
-Here is the exercise.
-1) Use `M-B' to convert the line with \"plic\" above into an
-   e-script block, as explained here:
-
-     (find-eev-quick-intro \"8.4. Creating e-script blocks\")
-
-2) Put the point on the line that should be moved to the index -
-   the one whose anchor is <.plic> with double angle brackets -
-   and type:
-
-     C-l M-x ei RET kopli0q
-
-   The actions associated to \"kopli0q\" are:
-
-     (k)ill the current line
-     switch to the sec(o)nd window
-     move backwards to the line of the (p)revious anchor
-     eva(l) the current line - that has a `to' pointing to the index
-     (i)nsert, i.e., yank, the last kill after this line
-     (0): run `C-x 0' to delete the window that shows the index
-     (q)uit the `hydra-eev-index-edit' mode
-
-3) Do the same for the \"bletch\".
+  ("1"      (eek "C-x 1"))
+  ("2"      (eek "M-2 M-e"))
+  )
 
-4) Take a look at the source code and figure out how to use the
-   keys `1', ',', '.', <up>, and <down> in `hydra-eev-index-edit'
-   mode.
 
-" pos-spec-list)))
 
-;; (find-eev-index-edit-intro)
 
 
 
diff --git a/eev-intro.el b/eev-intro.el
index 979a4f8c69..ae13e173b3 100644
--- a/eev-intro.el
+++ b/eev-intro.el
@@ -19,7 +19,7 @@
 ;;
 ;; Author:     Eduardo Ochs <eduardoochs@gmail.com>
 ;; Maintainer: Eduardo Ochs <eduardoochs@gmail.com>
-;; Version:    20221119
+;; Version:    20221120
 ;; Keywords:   e-scripts
 ;;
 ;; Latest version: <http://angg.twu.net/eev-current/eev-intro.el>
@@ -95,6 +95,7 @@
 ;; «.find-windows-beginner-intro»      (to "find-windows-beginner-intro")
 ;; «.find-eev-exercises-intro»         (to "find-eev-exercises-intro")
 ;; «.find-kla-intro»                   (to "find-kla-intro")
+;; «.find-edit-index-intro»            (to "find-edit-index-intro")
 
 ;; Videos:
 ;; «.find-three-main-keys-intro»       (to "find-three-main-keys-intro")
@@ -2756,18 +2757,19 @@ These are etcs:
 These ones explain advanced features that require extra setup:
 
   31. (find-kla-intro)
-  32. (find-prepared-intro)
-  33. (find-bounded-intro)
-  34. (find-channels-intro)
+  32. (find-edit-index-intro)
+  33. (find-prepared-intro)
+  34. (find-bounded-intro)
+  35. (find-channels-intro)
 
 This one was used in a video:
 
-  35. (find-three-main-keys-intro)
+  36. (find-three-main-keys-intro)
 
 These ones are obsolete:
 
-  36. (find-emacs-intro)
-  37. (find-defun-intro)
+  37. (find-emacs-intro)
+  38. (find-defun-intro)
 
 For an index of the videos, run:
 
@@ -14883,6 +14885,234 @@ See: (find-eev \"eev-kla.el\" \"aliases\")
 
 
 
+;;;           _ _ _        _           _           
+;;;   ___  __| (_) |_     (_)_ __   __| | _____  __
+;;;  / _ \/ _` | | __|____| | '_ \ / _` |/ _ \ \/ /
+;;; |  __/ (_| | | ||_____| | | | | (_| |  __/>  < 
+;;;  \___|\__,_|_|\__|    |_|_| |_|\__,_|\___/_/\_\
+;;;                                                
+;; «find-edit-index-intro»  (to ".find-edit-index-intro")
+;; Skel: (find-intro-links "edit-index")
+;; Test: (find-edit-index-intro)
+
+(defun find-edit-index-intro (&rest pos-spec-list) (interactive)
+  (let ((ee-buffer-name "*(find-edit-index-intro)*"))
+    (apply 'find-eintro "\
+\(Re)generate: (find-edit-index-intro)
+Source code:  (find-efunction 'find-edit-index-intro)
+More intros:  (find-eev-quick-intro)
+              (find-eev-intro)
+              (find-eepitch-intro)
+This buffer is _temporary_ and _editable_.
+It is meant as both a tutorial and a sandbox.
+
+
+
+This is a tutorial for:
+  (find-eev \"eev-hydras.el\")
+that is a module of eev that is not loaded by default.
+To test it you will need the package \"hydra\", from ELPA,
+  https://github.com/abo-abo/hydra
+and this `require':
+  (require 'eev-hydras)
+This will define `M-x ei' as an alias. See:
+  (find-eev \"eev-hydras.el\" \"ei\")
+
+
+
+
+0. Introduction
+===============
+These sections of the basic tutorial
+
+  (find-eev-quick-intro \"8.3. Creating index/section anchor pairs\")
+  (find-eev-quick-intro \"8.4. Creating e-script blocks\")
+
+explain how to create \"index/section anchor pairs\", but they
+say that the \"index\" line should be moved to the index at the
+top of the file _by hand_. \"Moving the index line to the index\"
+is a process that takes many steps, and even after years of
+practice I would still commit mistakes very often when doing it.
+Here we will see a way to perform it very quickly, with a
+sequence of keys like this one:
+
+  M-x ei RET kopli0q
+
+The obvious way of implementing \"moving the index line to the
+index\" would be by defining a function that would perform the
+many steps involved in this process, and that would check for
+many possible kinds of errors, and handle them correctly... but
+that turned out to be too hard.
+
+When we run `M-x ei', that is defined as an alias - see:
+
+  (find-eev \"eev-hydras.el\" \"ei\")
+
+it actives a hydra that interprets the letters in
+
+  kopli0q
+
+as these \"commands\":
+
+     <k>ill line
+     <o>ther window
+     <p>revious anchor
+  eva<l>
+     <i>insert
+     <0> `C-x 0'
+     <q>uit
+
+In my QWERTY keyboard I can type the letters in `kopli0' very
+quickly with my right hand, as its keys are arranged like this:
+
+          0
+    i   o   p
+      k   l
+
+I can do that without taking my eyes off the screen - yes, I am a
+VERY bad typist! But read this:
+
+  (find-refining-intro \"5. Pointing to anchors\")
+  (find-refining-intro \"5. Pointing to anchors\" \"but I don't touch-type\")
+
+and if anything fails I can recognize it immediately, and I can
+fix it with \"undo\"s in the right way. Also, after the <i> I
+sometimes type some <,>s and <.>s to adjust the indentation; this
+will be explained in the next section.
+
+
+
+
+1. Testing the hydra
+====================
+In this tutorial \"the hydra\" will mean `ee-edit-index-hydra'.
+Typing `M-x ei' will activate the hydra. When it is active you
+will see a message in the echo area showing its main keys. `q'
+will \"quit\" that hydra, and deactivate it. Some keys that the
+hydra don't understand will also quit it.
+
+The hydra understands the keys <up>, <down>, <,>, and <.>, among
+others. It interprets <up> and <down> in the obvious way, and it
+interprets <,> and <.> as commands that reindent a `(to ...)' by
+adding or deleting tabs before the \"(\". Test this here,
+
+  aaa\t(to \"bbb\")
+  cccc\t\t(to \"dddd\")
+  ee\t\t\t(to \"fffff\")
+
+and use the hydra to align the three `(to ...)'s.
+
+
+
+
+2. An index
+===========
+This is an index,
+
+# «.foo»\t\t(to \"foo\")
+# «.bar»\t\t(to \"bar\")
+
+followed by two \"e-script blocks\" created with `M-B'. See:
+
+  (find-eev-quick-intro \"8. Anchors\")
+  (find-eev-quick-intro \"8. Anchors\" \"`M-B'\")
+  (find-eev-quick-intro \"8.4. Creating e-script blocks\")
+
+#####
+#
+# foo
+# 2021may20
+#
+#####
+
+# «foo»  (to \".foo\")
+
+
+#####
+#
+# bar
+# 2021may20
+#
+#####
+
+# «bar»  (to \".bar\")
+
+
+
+3. An exercise
+==============
+Here is an exercise.
+
+  1. Use `M-B' to convert the line with \"plic\" below into an
+     e-script block, as explained here:
+
+       (find-eev-quick-intro \"8.4. Creating e-script blocks\")
+
+     plic
+
+  2. Put the point on the \"index line\" above - that is the one
+     that looks like this,
+
+       # <.plic>  (to \"plic\")
+
+     but with green double angle brackets instead of \"<>\"s -
+     and type this, and watch what happens in each step:
+
+       C-l M-x ei RET kopli0q
+
+     The actions associated to \"kopli0q\" are:
+
+       <k>ill the current line
+       switch to the sec<o>nd window
+       move backwards to the line of the <p>revious anchor
+       eva<l> the current line - that has a `to' pointing to the index
+       <i>nsert, i.e., yank, the last kill after this line
+       <0>: run `C-x 0' to delete the window that shows the index
+       <q>uit the hydra.
+
+   3. Do the same for the \"bletch\" below:
+
+        bletch
+
+      but now also use <,>s, <.>s, and <up>s and <down>s between
+      the <i> and the <0> to align all the `(to ...)'s in the index.
+
+
+
+
+4. `M-x ei' is fragile
+======================
+Look at the source code of the hydra that `M-x ei' calls:
+
+  (find-eev \"eev-hydras.el\" \"ee-edit-index-hydra\")
+
+Several of the actions are defined with `eek'. For example, the
+action of \"o\" is:
+
+  (\"o\" (eek \"C-x 1 C-x 3 C-x o\"))
+
+This is considered fragile - because it won't work if any of
+these key sequences has been redefined - and a bad programming
+style. I could have used this instead:
+
+  ;; (find-estring (format-kbd-macro (kbd \"C-x 1 C-x 3 C-x o\") 'verbose))
+  (\"o\" (delete-other-windows)
+         (split-window-right)
+         (other-window 1))
+
+but the \"fragile\" style above is usually good enough for quick
+hacks - `M-x ei' is a quick hack -, and it gives the readers the
+feeling that they can write their own hydras as quick hacks, too.
+
+" pos-spec-list)))
+
+;; (find-edit-index-intro)
+
+
+
+
+
+
 
 ;;;  _   _                                     _         _
 ;;; | |_| |__  _ __ ___  ___   _ __ ___   __ _(_)_ __   | | _____ _   _ ___



reply via email to

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