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

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

[elpa] externals/eev 37a6ddc 2/3: New file: "eev-hydras.el".


From: Stefan Monnier
Subject: [elpa] externals/eev 37a6ddc 2/3: New file: "eev-hydras.el".
Date: Wed, 12 May 2021 08:45:27 -0400 (EDT)

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

    New file: "eev-hydras.el".
---
 ChangeLog         |  17 ++++
 VERSION           |   4 +-
 eev-audiovideo.el |   5 +-
 eev-hydras.el     | 111 +++++++++++++++++++++
 eev-intro.el      |  78 +++++++++++++--
 eev-template0.el  |  17 ++--
 eev-tlinks.el     | 285 ++++++++++++++++++++++++++++++++----------------------
 7 files changed, 384 insertions(+), 133 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 30bf224..069837c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2021-05-12  Eduardo Ochs  <eduardoochs@gmail.com>
+
+       * eev-intro.el (find-refining-intro, find-here-links-intro): added
+       several "[Video links:]" blocks.
+
+       * eev-hydras.el: new file.
+
+2021-05-09  Eduardo Ochs  <eduardoochs@gmail.com>
+
+       * eev-tlinks.el (ee-psnevideo-download-if-needed): renamed to
+       `ee-psne-if-needed'.
+       (ee-psnevideo-download): renamed to `ee-psne-download'.
+       (ee-psnevideo-download0): renamed to `ee-psne-download0'.
+       (ee-psnevideo-links): rewritten.
+
+       * eev-template0.el (ee-template00): added a `save-match-data'.
+
 2021-05-06  Eduardo Ochs  <eduardoochs@gmail.com>
 
        * eev-beginner.el: rewrote the comments.
diff --git a/VERSION b/VERSION
index 3154197..66ebd8c 100644
--- a/VERSION
+++ b/VERSION
@@ -1,2 +1,2 @@
-Thu May  6 18:24:24 GMT 2021
-Thu May  6 15:24:24 -03 2021
+Wed May 12 05:06:09 GMT 2021
+Wed May 12 02:06:09 -03 2021
diff --git a/eev-audiovideo.el b/eev-audiovideo.el
index df6f248..abffaad 100644
--- a/eev-audiovideo.el
+++ b/eev-audiovideo.el
@@ -226,8 +226,11 @@
 
 
 ;; «youtube-time»  (to ".youtube-time")
-;; Tests: (ee-time-to-youtube-time "2")
+;; Tests: (ee-time-to-youtube-time "")
+;;        (ee-time-to-youtube-time "!")
+;;        (ee-time-to-youtube-time "2")
 ;;        (ee-time-to-youtube-time "23")
+;;        (ee-time-to-youtube-time "123")
 ;;        (ee-time-to-youtube-time "1:23")
 ;;        (ee-time-to-youtube-time "1:23:43")
 ;;
diff --git a/eev-hydras.el b/eev-hydras.el
new file mode 100644
index 0000000..ef62147
--- /dev/null
+++ b/eev-hydras.el
@@ -0,0 +1,111 @@
+;;; eev-hydras.el --- eev functions that use hydra.el.
+
+;; Copyright (C) 2021 Free Software Foundation, Inc.
+;;
+;; This file is part of GNU eev.
+;;
+;; GNU eev is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GNU eev is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+;;
+;; Author:     Eduardo Ochs <eduardoochs@gmail.com>
+;; Maintainer: Eduardo Ochs <eduardoochs@gmail.com>
+;; Version:    20210511
+;; Keywords:   e-scripts
+;;
+;; Latest version: <http://angg.twu.net/eev-current/eev-hydras.el>
+;;       htmlized: <http://angg.twu.net/eev-current/eev-hydras.el.html>
+;;       See also: <http://angg.twu.net/eev-current/eev-readme.el.html>
+;;                 <http://angg.twu.net/eev-intros/find-eev-intro.html>
+;;                 <http://angg.twu.net/eev-intros/find-here-links-intro.html>
+;;                                                (find-eev-intro)
+;;                                                (find-here-links-intro)
+
+;;; Commentary:
+
+;; This is a new, experimental feature that is not loaded by
+;; default. It is mentioned briefly here:
+;;
+;;   (find-refining-intro "5. Pointing to anchors")
+;;   (find-refining-intro "5. Pointing to anchors" "but I don't touch-type")
+;;
+;; It depends on the package "hydra".
+;; I need to record a short video about this.
+;; This code will probably change a LOT in the next months.
+
+
+;; See: https://github.com/abo-abo/hydra
+;;      (find-epackage-links 'hydra "hydra" t)
+;;      (find-epackage       'hydra)
+;;
+(require 'hydra)
+
+
+
+(defun eev-index-replace (from-string to-string)
+  "Replace FROM-STRING to TO-STRING in the current line."
+  (search-forward from-string (ee-eol))
+  (replace-match to-string)
+  (eek "C-a"))
+
+(defun eev-index-edit ()
+  "Call `eev-index-edit/body' to edit the index."
+  (interactive)
+  ;;
+  ;; Definition of the hydra:
+  ;;
+  (defhydra hydra-eev-index-edit (:color green :hint nil)
+  "
+_q_:quit    ^^^^                                   _0_: delthiswindow
+ werty:  _u_:prev    _i_:insert  _o_:other window  _p_:prev
+asdfgh:  _j_:next    _k_:kill    _l_:eval
+         ^ ^         _,_:adj<-   _._:adj->
+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" (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"))
+  ;; 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))
+  ;;
+  ;; End of the definition of the hydra.
+  ;;
+  ;; Call the hydra:
+  (hydra-eev-index-edit/body)
+  )
+
+(defalias 'ei 'eev-index-edit)
+
+
+(provide 'eev-hydras)
+
+
+;; Local Variables:
+;; coding:            utf-8-unix
+;; no-byte-compile:   t
+;; End:
diff --git a/eev-intro.el b/eev-intro.el
index 8fcf7b9..ea25160 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:    20210506
+;; Version:    20210511
 ;; Keywords:   e-scripts
 ;;
 ;; Latest version: <http://angg.twu.net/eev-current/eev-intro.el>
@@ -680,7 +680,7 @@ Try these links (some of them need the Emacs manuals 
installed):
 This part of the eev tutorials has links to almost all the keys that
 I've learned by heart after using Emacs for 20 years:
 
-  (find-emacs-intro \"Basic keys (Emacs)\")
+  (find-emacs-keys-intro \"2. Key sequences\")
 
 They are not very many, because I use this a lot,
 
@@ -850,6 +850,7 @@ For more details see:
   (find-eev2019video \"15:11\" \"Demo: the eepitch block (in red star lines)\")
   (find-eev2019video \"15:48\" \"Demo: eepitch on non-red star lines\")
   (find-eev2019video \"15:56\" \"Demo: eepitch in action\")
+  (find-testblsvideo \"2:33\" \"if I run f8 here I start a new Lua 
interpreter\")
 
 
 
@@ -3005,6 +3006,13 @@ Note that `M-h M-1' undoes what `M-h M-3' did. In a 
figure:
   |_______________|         |__________|__________|         |________________|
 
 
+[Video links:]
+  (find-eevfherelvideo \"4:40\" \"2.1. The 3-window setting - and going back 
from it\")
+  (find-eevfherelvideo \"6:47\"  \"`M-h M-3': three windows; `M-h M-1' goes 
back\")
+  (find-eevfherelvideo \"7:29\"  \"the original configuration can be 
anything\")
+
+
+
 
 
 6. Copying the hyperlink
@@ -3034,6 +3042,10 @@ the one with the key sequences described here:
 
   (find-eev-quick-intro \"5.2. Cutting and pasting\")
 
+[Video links:]
+  (find-eevfherelvideo \"8:56\" \"2.2. Copying one link\")
+
+
 
 
 
@@ -3160,6 +3172,15 @@ discuss them here. See:
 If you want to add support for more complex pos-spec-lists, just
 replace `ee-goto-rest' with your own extended version.
 
+  [Video links:]
+    (find-eev2019video \"1:08\" \"a string to search for\")
+    (find-eev2020video \"2:25\" \"variants that were better behaved\")
+    (find-eev2020video \"2:36\" \"in the same window\")
+    (find-eev2020video \"2:53\" \"pos-spec-lists\")
+
+
+
+
 
 
 
@@ -3211,6 +3232,10 @@ based on `C-y' (`yank'),
 but `M-h M-y' \"yanks\" the text at the end of the sexp, in
 quotes, as an new argument.
 
+  [Video links:]
+    (find-eevfherelvideo \"10:30\" \"2.3. Duplicating and refining\")
+    (find-eevfherelvideo \"10:53\"  \"as a string at the end of the sexp\")
+
 
 
 
@@ -3270,6 +3295,12 @@ Note: `M-h M-w' (`ee-copy-this-line-to-kill-ring') is a 
key
 sequence intended for beginners. I prefer to use something like
 `C-a shift-<down> M-w'.
 
+  [Video links:]
+    (find-eevfherelvideo \"12:35\" \"3. Using a single window\")
+    (find-eevfherelvideo \"13:19\"  \"go back usually by using\")
+
+
+
 
 
 
@@ -3346,6 +3377,12 @@ The big figure below shows all the key sequences:
   |_________________|_____________________|
 
 
+[Video links:]
+  (find-eevfherelvideo  \"8:56\" \"2.2. Copying one link\")
+  (find-eevfherelvideo \"10:10\"  \"when people know a few more keys... C-w 
and M-w\")
+  (find-eevfherelvideo \"10:21\"  \"that correspond to Cut, Copy, and Paste\")
+
+
 
 
 
@@ -3448,15 +3485,38 @@ but I don't touch-type, and for me it became natural to 
hold the
 meta key down with my left thumb while I type `M-1hwhh' and
 `M-h2hyh-hw' _by moving my hands over the keyboard a lot_...
 
-It would be nice to have a way to do this same series of actions
-using keys that are good for touch typists. One possibilty is to
-use transient-mode:
+It would be nice to have a way to do this same series of actions using
+keys that are good for touch typists. One possibilty is to use a
+hydra; see the experimental code here:
+
+  (find-eev \"eev-hydras.el\")
 
-  https://magit.vc/manual/transient/
-  https://lists.gnu.org/archive/html/emacs-devel/2021-01/msg01120.html
+If you are interested in discussing how to make this more usable,
+please get in touch!
 
-I can try to implement this myself _if I have touch-typists to
-discuss it with_ - so if you're interested, get in touch!
+
+[Video links:]
+  (find-eevfherelvideo \"14:18\" \"4.1. Creating anchors\")
+  (find-eevfherelvideo \"15:22\"  \"an index at the beginning of the file\")
+  (find-eevfherelvideo \"15:47\"  \"the tutorial also explains ... `M-A'\")
+  (find-eevfherelvideo \"16:07\"  \"`M-A' duplicates the line and...\")
+  (find-eevfherelvideo \"16:19\"  \"use `M-B' to create something like this 
block here\")
+  (find-eevfherelvideo \"17:02\" \"4.2. The option :anchor for `code-c-d'\")
+  (find-eevfherelvideo \"17:21\"  \"here I have one of the source files\")
+  (find-eevfherelvideo \"17:30\"  \"here we have an index\")
+  (find-eevfherelvideo \"17:47\"  \"this sexp is equivalent to\")
+  (find-eevfherelvideo \"18:12\"  \"not all functions created by code-c-d 
behave in that way\")
+  (find-eevfherelvideo \"18:36\"  \"let me give the short explanation\")
+  (find-eevfherelvideo \"18:57\"  \"is a button that defines new functions\")
+  (find-eevfherelvideo \"19:04\"  \"and this sexp here shows the code\")
+  (find-eevfherelvideo \"19:24\"  \"this defun that defines find-eev\")
+  (find-eevfherelvideo \"20:04\" \"4.3. Shrinking hyperlinks\")
+  (find-eevfherelvideo \"20:25\"  \"it has a demo here\")
+  (find-eevfherelvideo \"21:07\" \"4.4. The preceding tag\")
+  (find-eevfherelvideo \"21:35\"  \"a variant of `M-h M-w'\")
+  (find-eevfherelvideo \"22:06\"  \"it also explains in the echo area what it 
does\")
+  (find-eevfherelvideo \"22:43\"  \"in this example the refined hyperlink is 
not useful\")
+  (find-eevfherelvideo \"22:48\"  \"but here is a demo that makes more sense\")
 
 
 
diff --git a/eev-template0.el b/eev-template0.el
index ea40697..8d7a38f 100644
--- a/eev-template0.el
+++ b/eev-template0.el
@@ -1,6 +1,6 @@
 ;;; eev-template0.el -- implement functions that eval `{}'s in a string.
 
-;; Copyright (C) 2019 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
 ;;
 ;; This file is part of GNU eev.
 ;;
@@ -19,7 +19,7 @@
 ;;
 ;; Author:     Eduardo Ochs <eduardoochs@gmail.com>
 ;; Maintainer: Eduardo Ochs <eduardoochs@gmail.com>
-;; Version:    20210203
+;; Version:    20210509
 ;; Keywords:   e-scripts
 ;;
 ;; Latest version: <http://angg.twu.net/eev-current/eev-template0.el>
@@ -100,23 +100,24 @@ set this variable temporarily in a `let'.")
 ;; (let ((hi "Here: ") (a 22) (b 33)) (ee-template00 "{hi}{a}+{b}={(+ a b)}"))
 ;; 
 (defun ee-template00 (str)
-"Replace substrings enclosed by `{}'s in STR by the result of evaluating them.
+  "Replace substrings enclosed by `{}'s in STR by the result of evaluating 
them.
 Examples:\n
   (ee-template00 \"a{(+ 2 3)}b\")
     -->  \"a5b\"\n
   (let ((hi \"Here:\") (a 22) (b 33))
     (ee-template00 \"{hi} {a} + {b} = {(+ a b)}\"))  
     -->  \"22 + 33 = 55\""
-  (replace-regexp-in-string
-   ee-template00-re
-   (lambda (_code_) (format "%s" (eval (read (substring _code_ 1 -1)))))
-   str 'fixedcase 'literal))
+  (save-match-data
+    (replace-regexp-in-string
+     ee-template00-re
+     (lambda (_code_) (format "%s" (eval (read (substring _code_ 1 -1)))))
+     str 'fixedcase 'literal)))
 
 ;; Test:
 ;; (ee-template0 "{<} a{(+ 2 3)} {>}")
 ;;
 (defun ee-template0 (str)
-"Replace substrings enclosed by `{}'s in STR by the result of evaluating them.
+  "Replace substrings enclosed by `{}'s in STR by the result of evaluating 
them.
 Substrings of the form `{<}' and `{>}' in STR are replaced by `{'
 and `}' respectively; apart from that, this is the same as
 `ee-template00'.
diff --git a/eev-tlinks.el b/eev-tlinks.el
index 383e71d..2e00497 100644
--- a/eev-tlinks.el
+++ b/eev-tlinks.el
@@ -19,7 +19,7 @@
 ;;
 ;; Author:     Eduardo Ochs <eduardoochs@gmail.com>
 ;; Maintainer: Eduardo Ochs <eduardoochs@gmail.com>
-;; Version:    20210227
+;; Version:    20210509
 ;; Keywords:   e-scripts
 ;;
 ;; Latest version: <http://angg.twu.net/eev-current/eev-tlinks.el>
@@ -72,12 +72,14 @@
 ;; «.find-git-links»                   (to "find-git-links")
 ;; «.find-fossil-links»                        (to "find-fossil-links")
 ;; «.find-apt-get-source-links»                (to "find-apt-get-source-links")
-;; «.find-eev-video-links»             (to "find-eev-video-links")
+;;
+;; «.find-eevvideo-links»              (to "find-eevvideo-links")
 ;; «.find-psnevideo-links»             (to "find-psnevideo-links")
+;; «.ee-psne-if-needed»                        (to "ee-psne-if-needed")
 ;; «.code-psnevideo»                   (to "code-psnevideo")
 ;; «.code-eevvideo»                    (to "code-eevvideo")
-;; «.find-eevvideo-links»              (to "find-eevvideo-links")
 ;; «.hardcoded-paths»                  (to "hardcoded-paths")
+;; «.find-eev-video-links»             (to "find-eev-video-links")
 ;;
 ;; «.find-latex-links»                 (to "find-latex-links")
 ;; «.find-lua-links»                   (to "find-lua-links")
@@ -1368,76 +1370,36 @@ netcat -l -p {tgtport}
 
 
 
-;;;                            _     _            
-;;;   ___  _____   __   __   _(_) __| | ___  ___  
-;;;  / _ \/ _ \ \ / /___\ \ / / |/ _` |/ _ \/ _ \ 
-;;; |  __/  __/\ V /_____\ V /| | (_| |  __/ (_) |
-;;;  \___|\___| \_/       \_/ |_|\__,_|\___|\___/ 
-;;;                                               
-;; «find-eev-video-links» (to ".find-eev-video-links")
-
-;; (find-find-links-links "{k}" "eev-video" "c anggstem youtubehash")
-
-(defun find-eev-video-links (&optional c anggstem youtubehash &rest 
pos-spec-list)
-"Visit a temporary buffer containing a script for downloading an eev video.
-See: (find-videos-intro)
-Examples:
-  (find-eev-video-links \"eepitchvideo\" \"video4-eepitch\" \"Lj_zKC5BR64\")
-  (find-eev-video-links \"eevvideo2\"    \"video2\"         \"doeyn5MOaB8\")
-  (find-eev-video-links \"eevvideo2-pt\" \"video2pt\"       \"yztYD9Y7Iz4\")
-Warning: the last one is in Portuguese..."
+;;;                         _     _            
+;;;   ___  _____   ____   _(_) __| | ___  ___  
+;;;  / _ \/ _ \ \ / /\ \ / / |/ _` |/ _ \/ _ \ 
+;;; |  __/  __/\ V /  \ V /| | (_| |  __/ (_) |
+;;;  \___|\___| \_/    \_/ |_|\__,_|\___|\___/ 
+;;;                                            
+;; «find-eevvideo-links»  (to ".find-eevvideo-links")
+;; Used by: (find-videos-intro "2. Short links to eev video tutorials")
+;;          (find-eev "eev-audiovideo.el" "video-tutorials")
+;;     See: (find-audiovideo-intro "7.2. `find-eevvideo-links'")
+;;    Skel: (find-find-links-links-new "eevvideo" "c stem youtubeid time" 
"url")
+;;    Test: (find-eevvideo-links "eevnav" "M-x-list-packages-eev-nav" "0:00")
+;;
+(defun find-eevvideo-links (&optional c stem youtubeid time &rest 
pos-spec-list)
+"Visit a temporary buffer containing hyperlinks for eevvideo."
   (interactive)
   (setq c (or c "{c}"))
-  (setq anggstem (or anggstem "{anggstem}"))
-  (setq youtubehash (or youtubehash "{youtubehash}"))
-  (let ((s (replace-regexp-in-string "." " " c)))
-    (apply 'find-elinks
-     `((find-eev-video-links ,c ,anggstem ,youtubehash)
+  (setq stem (or stem "{stem}"))
+  (setq youtubeid (or youtubeid "{youtubeid}"))
+  (setq time (or time "{time}"))
+  (let* ((url (format "http://angg.twu.net/eev-videos/%s.mp4"; stem)))
+    (apply
+     'find-elinks
+     `((find-eevvideo-links ,c ,stem ,youtubeid ,time ,@pos-spec-list)
        ;; Convention: the first sexp always regenerates the buffer.
-       (find-efunction 'find-eev-video-links)
-       ""
-       ,(ee-template0 "\
- Download (or make sure we have) a local copy of the video:
- (eepitch-shell2)
- (eepitch-kill)
- (eepitch-shell2)
-mkdir -p $S/http/angg.twu.net/eev-videos/
-cd       $S/http/angg.twu.net/eev-videos/
-wget -nc 'http://angg.twu.net/eev-videos/{anggstem}.mp4'
-echo     'http://angg.twu.net/eev-videos/{anggstem}.mp4' >> ~/.psne.log
-
-# Test:
-# (find-fline  {s}  \"$S/http/angg.twu.net/eev-videos/\")
-# (find-video  {s}  \"$S/http/angg.twu.net/eev-videos/{anggstem}.mp4\")
-# (code-video \"{c}\" \"$S/http/angg.twu.net/eev-videos/{anggstem}.mp4\")
-# (find-{c})
-# Error messages:
-# (find-ebuffer \"*Messages*\")
-
-# See: (find-audiovideo-intro \"eev-avadj-mode\")
-#      (find-audiovideo-intro \"The time-from-bol\")
-# (eev-avadj-mode 1)
-# (find-{c} t)
-# 0:00
-
-# Links to the version at youtube:
-# http://www.youtube.com/watch?v={youtubehash}
-# http://www.youtube.com/watch?v={youtubehash}&t=0m00s
-# http://www.youtube.com/watch?v={youtubehash}&t=0h00m00s
-")
+       ;; (find-efunction 'find-eevvideo-links)
+       ,(ee-psnevideo-links c url youtubeid time)
        )
      pos-spec-list)))
 
-;; Links to all the eev videos (best ones first):
-;;   (find-eev-video-links "eepitchvideo" "video4-eepitch" "Lj_zKC5BR64")
-;;   (find-eev-video-links "eevvideo2"    "video2"         "doeyn5MOaB8")
-;;   (find-eev-video-links "eevvideo2-pt" "video2pt"       "yztYD9Y7Iz4")
-;; The ones with "pt" are in Portuguese, the other ones are in English.
-
-;; (find-eepitchvideo "0:18" "Demonstration (first time, very quickly)")
-
-
-
 
 
 ;;;                             _     _            
@@ -1449,7 +1411,8 @@ echo     'http://angg.twu.net/eev-videos/{anggstem}.mp4' 
>> ~/.psne.log
 ;;
 ;; «find-psnevideo-links»  (to ".find-psnevideo-links")
 ;; Skel: (find-find-links-links-new "psnevideo" "c url youtubeid time" "url")
-;; Test: (find-psnevideo-links "c333" 
"http://angg.twu.net/2020.1-C3/C3_aula_3_video_3.mp4";)
+;; Tests: (find-psnevideo-links "C" "http://foo.org/bar.mp4";)
+;;        (find-psnevideo-links "C" "http://foo.org/bar.mp4"; nil "1:23")
 ;;
 (defun find-psnevideo-links (&optional c url youtubeid time &rest 
pos-spec-list)
 "Visit a temporary buffer containing an e-script for downloading and playing 
URL."
@@ -1465,24 +1428,53 @@ echo     
'http://angg.twu.net/eev-videos/{anggstem}.mp4' >> ~/.psne.log
      )
    pos-spec-list))
 
-(defun ee-psnevideo-links (c url youtubeid time)
-  (let* ((fname (ee-shorten-file-name (ee-url-to-fname url)))
-         (dir (file-name-directory fname))
-        (youtubeurl (format "http://www.youtube.com/watch?v=%s"; youtubeid))
-        (youtubetime (or (ee-time-to-youtube-time time) ""))
-        (argtime (if (ee-time-to-youtube-time time)
-                     (format " \"%s\"" time)
-                   ""))
-        )
+;; Tests:
+;; (find-estring (ee-psnevideo-links "C" "http://foo.org/bar.mp4";))
+;; (find-estring (ee-psnevideo-links "C" "http://foo.org/bar.mp4"; nil "1:23"))
+;; (find-estring (ee-psnevideo-links "C" "http://foo.org/bar.mp4"; "YID" 
"1:23"))
+;;
+(defun ee-psnevideo-links (c url &optional youtubeid time)
+  (setq youtubeid (or youtubeid "{youtubeid}"))
+  (setq time      (or time      "{time}"))
+  (let* ((fname   (ee-shorten-file-name (ee-url-to-fname url)))
+        (argtime (ee-time-to-arg time)))
     (concat
+     ;;
+     ;; See:
+     ;; (find-audiovideo-intro "7. `code-psnevideo'" "second line")
+     ;; (find-audiovideo-intro "7. `code-psnevideo'" "redefine")
+     ;; (find-audiovideo-intro "7. `code-psnevideo'" "last part")
+     ;;
      (ee-template0 "\
 # (find-video \"{fname}\"{argtime})
 
 # (find-audiovideo-intro \"7. `code-psnevideo'\" \"second line\")
 # (find-audiovideo-intro \"7. `code-psnevideo'\" \"redefine\")
-# (code-video \"{c}video\" \"{fname}\")
-# (find-{c}video{argtime})
+#   (code-video \"{c}video\" \"{fname}\")
+#   (find-{c}video{argtime})
+
+")
+     (ee-psnevideo-url-youtube url youtubeid time)
+     "\n\n"
+     "# (find-audiovideo-intro \"7. `code-psnevideo'\" \"last part\")\n"
+     "\n\n"
+     (ee-psne-if-needed url)
+     )))
+
+
 
+;; Tests:
+;; (find-estring (ee-psnevideo-url-youtube "http://foo.org/bar.mp4";))
+;; (find-estring (ee-psnevideo-url-youtube "http://foo.org/bar.mp4"; nil 
"1:23"))
+;;
+(defun ee-psnevideo-url-youtube (url &optional youtubeid time)
+  (setq youtubeid (or youtubeid "{youtubeid}"))
+  (setq time      (or time      "{time}"))
+  (let* ((fname       (ee-shorten-file-name (ee-url-to-fname url)))
+         (dir         (file-name-directory fname))
+        (youtubeurl  (format "http://www.youtube.com/watch?v=%s"; youtubeid))
+        (youtubetime (or (ee-time-to-youtube-time time) "")))
+    (ee-template0 "\
 # URL, local file, and a link to the directory of the local file:
 #               {url}
 #              {fname}
@@ -1490,26 +1482,42 @@ echo     
'http://angg.twu.net/eev-videos/{anggstem}.mp4' >> ~/.psne.log
 
 # Youtube:
 # (kill-new \"{youtubeurl}{youtubetime}\")
-#            {youtubeurl}{youtubetime}
+#            {youtubeurl}{youtubetime}")
+    ))
 
-# (find-audiovideo-intro \"7. `code-psnevideo'\" \"last part\")
 
-") (ee-psnevideo-download-if-needed url))))
+;; Tests: (ee-time-to-arg "")
+;;        (ee-time-to-arg "{time}")
+;;        (ee-time-to-arg "1:23")
+;;        (ee-time-to-arg nil)
+;;   See: (find-efunction 'ee-time-to-youtube-time)
+;;
+(defun ee-time-to-arg (time)
+  (if (ee-time-to-youtube-time time)
+      (format " \"%s\"" time)
+    ""))
 
-(defun ee-psnevideo-download-if-needed (url)
-  (let* ((fname (ee-shorten-file-name (ee-url-to-fname url)))
-         (dir (file-name-directory fname)))
-    (if (file-exists-p (ee-expand fname))
-       "# Local file found. No need to download it again.\n"
-      (ee-psnevideo-download url))))
 
-(defun ee-psnevideo-download (url)
+
+;; «ee-psne-if-needed»  (to ".ee-psne-if-needed")
+;; Tests:
+;; (ee-psne-if-needed "http://www.gnu.org/software/emacs/emacs-paper.html";)
+;; (find-estring (ee-psne-if-needed "http://www.foo.org/bar.html";))
+;; (find-estring (ee-psne-download  "http://www.foo.org/bar.html";))
+;; (find-estring (ee-psne-download0 "http://www.foo.org/bar.html";))
+;;
+(defun ee-psne-if-needed (url)
+  (if (file-exists-p (ee-expand (ee-url-to-fname url)))
+      "# Local file found. No need to download it again.\n"
+    (ee-psne-download url)))
+
+(defun ee-psne-download (url)
   (concat "\
 #  Local file not found! 
 #  You need to run this: \n
-" (ee-psnevideo-download0 url)))
+" (ee-psne-download0 url)))
 
-(defun ee-psnevideo-download0 (url)
+(defun ee-psne-download0 (url)
   (let* ((fname (ee-shorten-file-name (ee-url-to-fname url)))
          (dir (file-name-directory fname)))
     (ee-template0 "\
@@ -1522,10 +1530,15 @@ wget -nc '{url}'
 echo     '{url}' >> ~/.psne.log
 
 # (find-fline \"{dir}\")
+# See: (find-psne-intro)
 ")))
 
 
 
+
+
+
+
 ;;;                _                                       _     _            
 ;;;   ___ ___   __| | ___       _ __  ___ _ __   _____   _(_) __| | ___  ___  
 ;;;  / __/ _ \ / _` |/ _ \_____| '_ \/ __| '_ \ / _ \ \ / / |/ _` |/ _ \/ _ \ 
@@ -1561,28 +1574,6 @@ echo     '{url}' >> ~/.psne.log
 ;;; | (_| (_) | (_| |  __/_____|  __/  __/\ V /  \ V /| | (_| |  __/ (_) |
 ;;;  \___\___/ \__,_|\___|      \___|\___| \_/    \_/ |_|\__,_|\___|\___/ 
 ;;;                                                                       
-;; «find-eevvideo-links»  (to ".find-eevvideo-links")
-;; Test: (find-eevvideo-links "eevnav" "M-x-list-packages-eev-nav" "0:00")
-;; Skel: (find-find-links-links-new "eevvideo" "c stem youtubeid time" "url")
-;;  See: (find-audiovideo-intro "7.2. `find-eevvideo-links'")
-;;
-(defun find-eevvideo-links (&optional c stem youtubeid time &rest 
pos-spec-list)
-"Visit a temporary buffer containing hyperlinks for eevvideo."
-  (interactive)
-  (setq c (or c "{c}"))
-  (setq stem (or stem "{stem}"))
-  (setq youtubeid (or youtubeid "{youtubeid}"))
-  (setq time (or time "{time}"))
-  (let* ((url (format "http://angg.twu.net/eev-videos/%s.mp4"; stem)))
-    (apply
-     'find-elinks
-     `((find-eevvideo-links ,c ,stem ,youtubeid ,time ,@pos-spec-list)
-       ;; Convention: the first sexp always regenerates the buffer.
-       ;; (find-efunction 'find-eevvideo-links)
-       ,(ee-psnevideo-links c url youtubeid time)
-       )
-     pos-spec-list)))
-
 ;; «code-eevvideo»  (to ".code-eevvideo")
 ;; See: (find-audiovideo-intro "7.1. `code-eevvideo'")
 ;; Test: (find-code-eevvideo "eevnav" "M-x-list-packages-eev-nav")
@@ -1620,7 +1611,75 @@ echo     '{url}' >> ~/.psne.log
 ;; download. If you are aware of sites like that, please get in touch
 ;; and I'll create functions pointing to them!
 
+;;;                            _     _            
+;;;   ___  _____   __   __   _(_) __| | ___  ___  
+;;;  / _ \/ _ \ \ / /___\ \ / / |/ _` |/ _ \/ _ \ 
+;;; |  __/  __/\ V /_____\ V /| | (_| |  __/ (_) |
+;;;  \___|\___| \_/       \_/ |_|\__,_|\___|\___/ 
+;;;                                               
+;; «find-eev-video-links» (to ".find-eev-video-links")
+;; Obsolete? See: (find-audiovideo-intro "7.2. `find-eevvideo-links'")
+
+;; Skel: (find-find-links-links "{k}" "eev-video" "c anggstem youtubehash")
+;;       (find-find-links-links-new "eev-video" "c anggstem youtubehash" "")
 
+(defun find-eev-video-links (&optional c anggstem youtubehash &rest 
pos-spec-list)
+"Visit a temporary buffer containing a script for downloading an eev video.
+See: (find-videos-intro)
+Examples:
+  (find-eev-video-links \"eepitchvideo\" \"video4-eepitch\" \"Lj_zKC5BR64\")
+  (find-eev-video-links \"eevvideo2\"    \"video2\"         \"doeyn5MOaB8\")
+  (find-eev-video-links \"eevvideo2-pt\" \"video2pt\"       \"yztYD9Y7Iz4\")
+Warning: the last one is in Portuguese..."
+  (interactive)
+  (setq c (or c "{c}"))
+  (setq anggstem (or anggstem "{anggstem}"))
+  (setq youtubehash (or youtubehash "{youtubehash}"))
+  (let ((s (replace-regexp-in-string "." " " c)))
+    (apply 'find-elinks
+     `((find-eev-video-links ,c ,anggstem ,youtubehash)
+       ;; Convention: the first sexp always regenerates the buffer.
+       (find-efunction 'find-eev-video-links)
+       ""
+       ,(ee-template0 "\
+ Download (or make sure we have) a local copy of the video:
+ (eepitch-shell2)
+ (eepitch-kill)
+ (eepitch-shell2)
+mkdir -p $S/http/angg.twu.net/eev-videos/
+cd       $S/http/angg.twu.net/eev-videos/
+wget -nc 'http://angg.twu.net/eev-videos/{anggstem}.mp4'
+echo     'http://angg.twu.net/eev-videos/{anggstem}.mp4' >> ~/.psne.log
+
+# Test:
+# (find-fline  {s}  \"$S/http/angg.twu.net/eev-videos/\")
+# (find-video  {s}  \"$S/http/angg.twu.net/eev-videos/{anggstem}.mp4\")
+# (code-video \"{c}\" \"$S/http/angg.twu.net/eev-videos/{anggstem}.mp4\")
+# (find-{c})
+# Error messages:
+# (find-ebuffer \"*Messages*\")
+
+# See: (find-audiovideo-intro \"eev-avadj-mode\")
+#      (find-audiovideo-intro \"The time-from-bol\")
+# (eev-avadj-mode 1)
+# (find-{c} t)
+# 0:00
+
+# Links to the version at youtube:
+# http://www.youtube.com/watch?v={youtubehash}
+# http://www.youtube.com/watch?v={youtubehash}&t=0m00s
+# http://www.youtube.com/watch?v={youtubehash}&t=0h00m00s
+")
+       )
+     pos-spec-list)))
+
+;; Links to all the eev videos (best ones first):
+;;   (find-eev-video-links "eepitchvideo" "video4-eepitch" "Lj_zKC5BR64")
+;;   (find-eev-video-links "eevvideo2"    "video2"         "doeyn5MOaB8")
+;;   (find-eev-video-links "eevvideo2-pt" "video2pt"       "yztYD9Y7Iz4")
+;; The ones with "pt" are in Portuguese, the other ones are in English.
+
+;; (find-eepitchvideo "0:18" "Demonstration (first time, very quickly)")
 
 
 



reply via email to

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