branch: externals/eev
commit 39e6adcb9b17d6edc35ec12cadcb0ddcf99a9678
Author: Eduardo Ochs <eduardoo...@gmail.com>
Commit: Eduardo Ochs <eduardoo...@gmail.com>

    Added `ee-copy-rest-3'.
---
 ChangeLog         |  10 ++++++
 VERSION           |   4 +--
 eev-intro.el      |  11 +++++-
 eev-tlinks.el     | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
 eev-videolinks.el |   4 ++-
 5 files changed, 126 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d3f7a04d2d..0db2293ffe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-05-17  Eduardo Ochs  <eduardoo...@gmail.com>
+
+       * eev-videolinks.el (ee-1stclassvideos-info): indicate that the
+       video "2021ffll" now has subtitles.
+
+       * eev-tlinks.el (ee-copy-rest-skip0, ee-copy-rest-gotoend0)
+       (ee-copy-rest-showtarget0, ee-copy-rest-3): new functions.
+
+       * eev-intro.el (find-eev-quick-intro): mention `ee-copy-rest-3'.
+
 2024-05-13  Eduardo Ochs  <eduardoo...@gmail.com>
 
        * eev-intro.el: add variants - that end in "hsubs", and that point
diff --git a/VERSION b/VERSION
index 75cc400dbb..4f999ba89f 100644
--- a/VERSION
+++ b/VERSION
@@ -1,2 +1,2 @@
-Mon May 13 14:57:00 GMT 2024
-Mon May 13 11:57:00 -03 2024
+Fri May 17 13:39:48 GMT 2024
+Fri May 17 10:39:48 -03 2024
diff --git a/eev-intro.el b/eev-intro.el
index ef87d95ef1..afb0a5e643 100644
--- a/eev-intro.el
+++ b/eev-intro.el
@@ -1391,9 +1391,18 @@ the other ones are similar.
   execute the three defuns for `c', `d', and `e', and jump to
   \"/tmp/foo.tex\" from anywhere with `M-x e'.
 
-  A detailed explanation of `ee-copy-rest' can be found here:
+  For more on `ee-copy-rest', and on its successor, `ee-copy-rest-3', see:
 
     (find-eev \"eev-tlinks.el\" \"ee-copy-rest\")
+    (find-eev \"eev-tlinks.el\" \"ee-copy-rest-3-intro\")
+    (find-eev \"eev-tlinks.el\" \"ee-copy-rest-3-tests\")
+
+[Video links:]
+  (find-2021ffllhsubs \"10:59\" \"Pay attention to all these {stem}s here\")
+  (find-2021ffllvideo \"10:59\" \"Pay attention to all these {stem}s here\")
+  (find-2024luasohsubs \"06:31\" \"ee-copy-rest copies the rest to\")
+  (find-2024luasovideo \"06:31\" \"ee-copy-rest copies the rest to\")
+
 
 
 
diff --git a/eev-tlinks.el b/eev-tlinks.el
index a5ebf17c01..92c3ba6361 100644
--- a/eev-tlinks.el
+++ b/eev-tlinks.el
@@ -19,7 +19,7 @@
 ;;
 ;; Author:     Eduardo Ochs <eduardoo...@gmail.com>
 ;; Maintainer: Eduardo Ochs <eduardoo...@gmail.com>
-;; Version:    20240512
+;; Version:    20240517
 ;; Keywords:   e-scripts
 ;;
 ;; Latest version: <http://anggtwu.net/eev-current/eev-tlinks.el>
@@ -80,6 +80,9 @@
 
 
 ;; «.ee-copy-rest»                     (to "ee-copy-rest")
+;; «.ee-copy-rest-3-intro»             (to "ee-copy-rest-3-intro")
+;; «.ee-copy-rest-3-tests»             (to "ee-copy-rest-3-tests")
+;; «.ee-copy-rest-3»                   (to "ee-copy-rest-3")
 ;;
 ;; «.find-find-links-links»            (to "find-find-links-links")
 ;; «.find-find-links-links-new»                (to "find-find-links-links-new")
@@ -259,7 +262,7 @@
 ;;
 ;; TO DO: update the decumentation here:
 ;;   (find-eev-quick-intro "7.5. `find-latex-links'")
-;;   (find-links-intro "10. The rest of the buffer")
+;;   (find-links-intro "7. The rest of the buffer")
 
 (defvar eeflash-copy '(highlight 0.5))
 
@@ -333,6 +336,102 @@ notion of \"the rest of this buffer\": it will be 
everything from
 
 
 
+;;;                                                            _       _____ 
+;;;   ___  ___        ___ ___  _ __  _   _       _ __ ___  ___| |_    |___ / 
+;;;  / _ \/ _ \_____ / __/ _ \| '_ \| | | |_____| '__/ _ \/ __| __|____ |_ \ 
+;;; |  __/  __/_____| (_| (_) | |_) | |_| |_____| | |  __/\__ \ ||_____|__) |
+;;;  \___|\___|      \___\___/| .__/ \__, |     |_|  \___||___/\__|   |____/ 
+;;;                           |_|    |___/                                   
+;;
+;; «ee-copy-rest-3-intro»  (to ".ee-copy-rest-3-intro")
+;; `ee-copy-rest-3' is a variant of `ee-copy-rest' that receives three
+;; arguments: where the region starts, where the region ends, and
+;; where it should be copied to. Its code is be much easier to
+;; understand than the code of `ee-copy-rest', and it is very
+;; flexible:
+;;
+;;   1a) "where the region starts" is usually a number of lines to skip,
+;;   1b) "where the region ends" is usually a string to search for,
+;;   1c) "where it should be copied to" is usually a sexp, like:
+;;         (find-fline "/tmp/foo.tex")
+;;
+;; The three arguments are called `skip', `gotoend', and `target',
+;; and they are expanded by the functions `ee-copy-rest-skip0',
+;; `ee-copy-rest-gotoend0', and `ee-copy-rest-showtarget0' into
+;; code that can be `eval'ed. These functions support some
+;; shorthands:
+;;
+;;   2a) when `skip' is nil this means "start on the next line",
+;;   2b) when `gotoend' is nil this means "until the end of the buffer",
+;;   2c) when `target' is a string this means a file with that name.
+;;
+;; «ee-copy-rest-3-tests»  (to ".ee-copy-rest-3-tests")
+;; Try these low-level tests:
+;;
+;;                (ee-copy-rest-skip0 nil)
+;;          (eval (ee-copy-rest-skip0 nil))
+;;                (ee-copy-rest-skip0 1)
+;;                (ee-copy-rest-skip0 2)
+;;          (eval (ee-copy-rest-skip0 2))
+;;                (ee-copy-rest-gotoend0 nil)
+;;                (ee-copy-rest-gotoend0 "find-2a")
+;;          (eval (ee-copy-rest-gotoend0 "find-2a"))
+;;                (ee-copy-rest-showtarget0 '(find-ebuffer "buf"))
+;;                (ee-copy-rest-showtarget0 "/tmp/o")
+;;   (find-2a nil (ee-copy-rest-showtarget0 "/tmp/o"))
+;;
+;; and these high-level tests:
+;;
+;;   (ee-copy-rest-3 3   ";; \ END" '(find-ebuffer "b"))
+;;   (ee-copy-rest-3 2   ";; \ END" "/tmp/o")
+;;   (ee-copy-rest-3 1   ";; \ END" "/tmp/o")
+;;   (ee-copy-rest-3 nil ";; \ END" "/tmp/o")
+;;     foo
+;;     bar
+;; END
+
+;; «ee-copy-rest-3»  (to ".ee-copy-rest-3")
+;;
+(defun ee-copy-rest-skip0 (&optional skip)
+  "An internal function used by `ee-copy-rest-3'."
+  (cond ((null    skip) '(move-beginning-of-line 2))
+        ((numberp skip) `(move-beginning-of-line (+ 2 ,skip)))
+       (t              skip)))
+
+(defun ee-copy-rest-gotoend0 (&optional end)
+  "An internal function used by `ee-copy-rest-3'."
+  (cond ((null end)    '(end-of-buffer))
+       ((stringp end) `(progn (search-forward ,end) (search-backward ,end)))
+       t              end))
+
+(defun ee-copy-rest-showtarget0 (target)
+  "An internal function used by `ee-copy-rest-3'."
+  (cond ((stringp target) `(find-fline ,target))
+       (t                target)))
+
+(defun ee-copy-rest-3 (skip gotoend target)
+  "Copy the region between SKIP and GOTOEND to the kill ring and SHOWTARGET.
+SKIP       is either nil, a number of lines to skip, or a sexp.
+GOTOEND    is either nil, a string to search for, or a sexp.
+SHOWTARGET is either a filename or a sexp to be used in a `find-2a'.\n
+See the tests in the comments to understand the details."
+  (save-excursion
+    (let* ((start (progn (eval (ee-copy-rest-skip0    skip))    (point)))
+          (end   (progn (eval (ee-copy-rest-gotoend0 gotoend)) (point)))
+          (show  (ee-copy-rest-showtarget0 target))
+          (str   (buffer-substring start end))
+          (len   (ee-count-lines str))
+          (msg   `(Copied ,len lines to the kill ring - use C-y to paste)))
+    (eeflash+ start end eeflash-copy)
+    (kill-new str)
+    (find-2a nil show)
+    msg)))
+
+
+
+
+
+
 
 ;;;   __ _           _       _ _       _       /\ ____  
 ;;;  / _(_)_ __   __| |     | (_)_ __ | | ____|/\|___ \ 
diff --git a/eev-videolinks.el b/eev-videolinks.el
index 4de851e74b..b10d7eab72 100644
--- a/eev-videolinks.el
+++ b/eev-videolinks.el
@@ -19,7 +19,7 @@
 ;;
 ;; Author:     Eduardo Ochs <eduardoo...@gmail.com>
 ;; Maintainer: Eduardo Ochs <eduardoo...@gmail.com>
-;; Version:    20240513
+;; Version:    20240517
 ;; Keywords:   e-scripts
 ;;
 ;; Latest version: <http://anggtwu.net/eev-current/eev-videolinks.el>
@@ -607,8 +607,10 @@ of the videos and play them with mpv. Compare with
      :mp4   "http://anggtwu.net/eev-videos/2021-ffll.mp4";
      :yt    "http://www.youtube.com/watch?v=h1CEL2fmkyc";
      :page  "http://anggtwu.net/2021-ffll.html";
+     :hsubs "http://anggtwu.net/2021-ffll.html#00:00";
      :date    "2021dec25"
      :length  "1:15:46"
+     :subs    ".vtt"
      :index   t
      :comment "A tutorial on a very advanced feature.")
     ;;

Reply via email to