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

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

[elpa] externals/eev 172112a14d 1/2: Added `show2-use'.


From: ELPA Syncer
Subject: [elpa] externals/eev 172112a14d 1/2: Added `show2-use'.
Date: Sun, 17 Dec 2023 21:57:44 -0500 (EST)

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

    Added `show2-use'.
---
 ChangeLog         |   5 +++
 VERSION           |   4 +-
 eev-intro.el      |  33 +++++++++++++---
 eev-tlinks.el     | 110 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 eev-videolinks.el |   2 +-
 5 files changed, 145 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d08b73205f..9ad38b5cff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2023-12-17  Eduardo Ochs  <eduardoochs@gmail.com>
 
+       * eev-tlinks.el (show2-use, find-show2-use)
+       (ee-show2-do-with-fname0, ee-show2-use): new functions.
+
+       * eev-intro.el (find-show2-intro): added more sections.
+
        * eev-videolinks.el (ee-all-cs-with-subs, code-lsubs)
        (find-code-lsubs, ee-code-lsubs, code-all-lsubs)
        (find-code-all-lsubs, ee-code-all-lsubs): new functions.
diff --git a/VERSION b/VERSION
index 1a704bc547..e80e485f0a 100644
--- a/VERSION
+++ b/VERSION
@@ -1,2 +1,2 @@
-Sun Dec 17 06:21:30 GMT 2023
-Sun Dec 17 03:21:30 -03 2023
+Mon Dec 18 02:27:27 GMT 2023
+Sun Dec 17 23:27:27 -03 2023
diff --git a/eev-intro.el b/eev-intro.el
index 6c260023cb..b5f1a5c733 100644
--- a/eev-intro.el
+++ b/eev-intro.el
@@ -16063,6 +16063,7 @@ that are displayed in a format like this one:
  Note: some of the sexps below take a long time - many seconds!
  (find-epackage-links 'pdf-tools)
   (package-initialize)
+  (add-to-list 'package-archives (\"melpa\" . 
\"https://melpa.org/packages/\";))
   (package-refresh-contents)
   (package-install 'pdf-tools)
  (find-epackage   'pdf-tools)
@@ -16071,12 +16072,17 @@ that are displayed in a format like this one:
  (eepitch-shell)
  (eepitch-kill)
  (eepitch-shell)
+sudo apt-get install build-essential
 sudo apt-get install lua5.1 lua5.1-doc lua5.1-dev
 sudo apt-get install lua5.2 lua5.2-doc lua5.2-dev
 sudo apt-get install lua-lpeg lua-lpeg-dev
 sudo apt-get install texlive-latex-extra
 
  Clone the git repository
+ See: https://github.com/edrx/show2-elpeg1#introduction
+ (eepitch-shell)
+ (eepitch-kill)
+ (eepitch-shell)
 rm -Rfv /tmp/show2-elpeg1/
 mkdir   /tmp/show2-elpeg1/
 cd      /tmp/show2-elpeg1/
@@ -16160,6 +16166,23 @@ Remember that Show2.lua uses a 3-window setting like 
this:
   |           | resulting PDF |
   |___________|_______________|
 
+Both Show2.lua and Emacs need to configured to use the same PDF
+file. This is done by running lines like these ones with <f8>s:
+
+ (show2-use \"{dir}/{stem}.{ext}\")
+ (show2-use \"/tmp/show2-elpeg1/LATEX/Show2.tex\")
+ (show2-use \"$SHOW2LATEXDIR/Show2.tex\")
+ (show2-use \"$SHOW2LATEXDIR/\")
+ (show2-use \"/tmp/Show2.tex\")
+ (show2-use \"/tmp/\")
+
+`show2-use' displays all the details of what it does in the
+window at the right, and when we run a `show2-use' in a red star
+line it also displays some information in the echo area. The
+communication with Lua is done by setting two environment
+variables - SHOW2DIR and SHOW2STEM - but the details are not
+important now.
+
 Let's see how that works in practice.
 
 
@@ -16168,7 +16191,7 @@ Let's see how that works in practice.
 ----------------------
 This is a minimal example of how to use Show2.lua:
 
- (code-show2 \"/tmp/Show2.tex\")
+ (show2-use \"/tmp/Show2.tex\")
  (eepitch-lua51)
  (eepitch-kill)
  (eepitch-lua51)
@@ -16177,9 +16200,10 @@ body = [[ HELLO ]]
 = body:show()
  (etv)
 
-The `(code-show2 ...)' in the beginning makes Emacs and Show2.lua
+The `(show2-use ...)' in the beginning makes Show2.lua and Emacs
 use the directory \"/tmp/\" and the files \"/tmp/Show2.tex\" and
-\"/tmp/Show2.pdf\"; the
+\"/tmp/Show2.pdf\"; it also displays some explanations in the
+right window. The
 
   = body:show()
 
@@ -16213,8 +16237,7 @@ section with <f8>s. Don't forget to wait after the 
\":show()\"!
 Try to run the example below with <f8>s - and don't forget to
 wait a bit after the \":show()\":
 
- (find-code-show2 \"/tmp/Show2.tex\")
-       (code-show2 \"/tmp/Show2.tex\")
+ (show2-use \"/tmp/Show2.tex\")
  (eepitch-lua51)
  (eepitch-kill)
  (eepitch-lua51)
diff --git a/eev-tlinks.el b/eev-tlinks.el
index 82d12e1e46..8e1282cd2a 100644
--- a/eev-tlinks.el
+++ b/eev-tlinks.el
@@ -158,6 +158,7 @@
 ;; «.find-show2-links»                 (to "find-show2-links")
 ;;   «.show2»                          (to "show2")
 ;;   «.code-show2»                     (to "code-show2")
+;; «.show2-use»                                (to "show2-use")
 ;;   «.find-luatb»                     (to "find-luatb")
 ;; «.code-brappend»                    (to "code-brappend")
 ;; «.find-maximamsg-links»             (to "find-maximamsg-links")
@@ -3313,7 +3314,8 @@ For more info on this particular video, run:
 ;;        (find-psne-1stclassvideo-links \"{c}\")
 ;;    or: (find-psne-eevvideo-links \"{mp4stem}\" \"{exts}\")
 ;;
-;; LSubs: (find-1stclassvideolsubs \"{c}\")\n"))
+;; LSubs: (find-{c}lsubs \"00:00\")
+;;        (find-1stclassvideolsubs \"{c}\")\n"))
     (if mp4found
        (if hassubs
            (ee-template0 template11)
@@ -4477,6 +4479,112 @@ printmeaning \"@oddfoot\"
 ")))
 
 
+;;;      _                   ____                      
+;;;  ___| |__   _____      _|___ \      _   _ ___  ___ 
+;;; / __| '_ \ / _ \ \ /\ / / __) |____| | | / __|/ _ \
+;;; \__ \ | | | (_) \ V  V / / __/_____| |_| \__ \  __/
+;;; |___/_| |_|\___/ \_/\_/ |_____|     \__,_|___/\___|
+;;;                                                    
+;; «show2-use»  (to ".show2-use")
+;; See: (find-show2-intro "3. Show2.lua")
+;;      (find-show2-intro "3. Show2.lua" "show2-use")
+
+(defun show2-use (&optional fname0)
+  "Run two `setenv's and show explanations in the right window."
+  (interactive)
+  (eval (ee-read (ee-show2-use fname0)))
+  (find-2a nil `(find-show2-use ,fname0))
+  `("SHOW2DIR"  -> ,(getenv "SHOW2DIR")
+    "SHOW2STEM" -> ,(getenv "SHOW2STEM")))
+
+(defun find-show2-use (&optional fname0 &rest pos-spec-list)
+  "An internal function used by `show2-use'."
+  (interactive)
+  (apply 'find-estring-elisp
+        (ee-show2-use fname0)
+        pos-spec-list))
+
+(defmacro ee-show2-do-with-fname0 (fname0 &rest code)
+  "An internal function used by `show2-use'."
+  `(let* ((fname0 ,fname0)
+         (fname (ee-expand (or fname0 "/tmp/Show2.tex")))
+         (dir   (file-name-directory fname))
+         (stem0 (file-name-nondirectory
+                 (file-name-sans-extension fname)))
+         (stem  (if (equal stem0 "") "Show2" stem0))
+         (tex   (concat stem ".tex"))
+         (pdf   (concat stem ".pdf"))
+         (cmd   (format "cd %s && lualatex %s.tex < /dev/null" dir stem)))
+     ,@code))
+
+(defun ee-show2-use (&optional fname0)
+  "An internal function used by `show2-use'."
+  (ee-show2-do-with-fname0
+   fname0
+   (ee-template0 "\
+;; (find-show2-use {(ee-S fname0)})
+;;      (show2-use {(ee-S fname0)})
+;; (find-efunction 'show2-use)
+
+;; Part 1: Lua
+;; ===========
+;; With the argument above `show2-use' will set its local
+;; variables to:
+;;
+;;   Arg1:  fname0 -> {(ee-S fname0)}
+;;   Vars:   fname -> {(ee-S fname)}
+;;             dir -> {(ee-S dir)}
+;;           stem0 -> {(ee-S stem0)}
+;;            stem -> {(ee-S stem)}
+;;             tex -> {(ee-S tex)}
+;;             pdf -> {(ee-S pdf)}
+;;             cmd -> {(ee-S cmd)}
+;;
+;; and it will set the environment variables SHOW2DIR and
+;; SHOW2STEM to:
+;;
+(setenv \"SHOW2DIR\"  \"{dir}\")
+(setenv \"SHOW2STEM\" \"{stem}\")
+;;
+;; These variables will be used by Show2.lua to determine which
+;; directory and which file to work on. The values above mean
+;; that Show2.lua will save the TeX code in this file,
+;;
+;;                {dir}{stem}.tex
+;;   (find-fline \"{dir}{stem}.tex\")
+;;
+;; and will run this command to compile that .tex:
+;;
+;;   {cmd}
+
+
+;; Part 2: Emacs
+;; =============
+;; Eepitch-ing a line like this one
+;;
+;;    (etv)
+;;
+;; should create a 3-window setting like this:
+;;   _________________
+;;  |        |        |
+;;  |        | target |
+;;  |  edit  |________|
+;;  |        |        |
+;;  |        |  view  |
+;;  |________|________|
+;;
+;; The defuns below configure `v', `D' and `etv' to make them
+;; display the PDF produced by Show2.lua, that will be here:
+;;   {dir}{stem}.pdf
+;;
+(defun tb  () (interactive) (find-ebuffer (eepitch-target-buffer)))
+(defun v   () (interactive) (find-pdftools-page \"{dir}{stem}.pdf\"))
+(defun D   () (interactive) (find-pdf-page \"{dir}{stem}.pdf\"))
+(defun etv () (interactive) (find-wset \"13o2_o_o\" '(tb) '(v)))
+")))
+
+
+
 
 ;;;   __ _           _       _             _   _     
 ;;;  / _(_)_ __   __| |     | |_   _  __ _| |_| |__  
diff --git a/eev-videolinks.el b/eev-videolinks.el
index 5d6b054c20..e8822b7c7e 100644
--- a/eev-videolinks.el
+++ b/eev-videolinks.el
@@ -1130,7 +1130,7 @@ For more info on this particular video, run:
      :date    "2023dec02"
      :subs    ".vtt"
      :length  "59:11"
-     :comment "My presentation at the EmacsConf2023.")
+     :comment "My presentation at the EmacsConf2023. See: (find-show2-intro)")
     ))
 
 



reply via email to

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