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

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

[elpa] externals/eev 28711455e5: Added some sections to (find-lua-tutori


From: ELPA Syncer
Subject: [elpa] externals/eev 28711455e5: Added some sections to (find-lua-tutorial-intro).
Date: Sun, 14 Jan 2024 15:57:46 -0500 (EST)

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

    Added some sections to (find-lua-tutorial-intro).
---
 ChangeLog     | 17 +++++++++++++
 VERSION       |  4 ++--
 eev-blinks.el | 18 +++++++++++++-
 eev-elinks.el | 48 ++++++++++++++++++++++++++++++++++---
 eev-intro.el  | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 eev-tlinks.el | 29 +++++++++++++++++++----
 6 files changed, 180 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0a1795b021..de3aa542bd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2024-01-14  Eduardo Ochs  <eduardoochs@gmail.com>
+
+       * eev-intro.el (find-lua-tutorial-intro): Added two sections about
+       CLua1.lua.
+
+2024-01-13  Eduardo Ochs  <eduardoochs@gmail.com>
+
+       * eev-elinks.el (find-eloadhistory-links): new function.
+
+       * eev-blinks.el (find-eloadhistory-for): new function.
+
+       * eev-elinks.el (ee-find-efunction-links): use `find-eppp' instead
+       of `find-epp' in more places.
+       (ee-shorten-elc, ee-eloadhistory-fors)
+       (ee-eloadhistory-find-flines): new functions.
+       (ee-find-efunction-links): use `ee-eloadhistory-find-flines'.
+
 2024-01-12  Eduardo Ochs  <eduardoochs@gmail.com>
 
        * eev-intro.el (find-lua-tutorial-intro): new function.
diff --git a/VERSION b/VERSION
index 4b809ddbe9..c19c879665 100644
--- a/VERSION
+++ b/VERSION
@@ -1,2 +1,2 @@
-Sat Jan 13 04:46:14 GMT 2024
-Sat Jan 13 01:46:14 -03 2024
+Sun Jan 14 20:08:57 GMT 2024
+Sun Jan 14 17:08:57 -03 2024
diff --git a/eev-blinks.el b/eev-blinks.el
index 94e70739a5..ce304855d3 100644
--- a/eev-blinks.el
+++ b/eev-blinks.el
@@ -21,7 +21,7 @@
 ;;
 ;; Author:     Eduardo Ochs <eduardoochs@gmail.com>
 ;; Maintainer: Eduardo Ochs <eduardoochs@gmail.com>
-;; Version:    20231220
+;; Version:    20240113
 ;; Keywords:   e-scripts
 ;;
 ;; Latest version: <http://anggtwu.net/eev-current/eev-blinks.el>
@@ -1711,6 +1711,22 @@ Hint: install the Debian package \"unicode-data\".")
 
 
 
+;; Tests: (find-eloadhistory-for 'eekla)
+;;        (find-eloadhistory-for (symbol-file 'eekla 'defun))
+;;
+(defun find-eloadhistory-for (f &rest pos-spec-list)
+  "Show the result of `(assoc F load-history)' in a temporary buffer.
+If F is a symbol it is converted to a filename with (symbol-file F 'defun)."
+  (let* ((fname (if (symbolp f) (symbol-file f 'defun) f))
+        (sexp `(find-eloadhistory-for ,(ee-add-quote f)))
+        (ee-buffer-name (format "*%S*" sexp))
+        (body (ee-ppp0 (assoc fname load-history)))
+        (header (format ";; %S\n;; (find-eloadhistory-links)\n\n" sexp)))
+    (apply 'find-estring-elisp (concat header body) pos-spec-list)))
+
+
+
+
 
 
 (provide 'eev-blinks)
diff --git a/eev-elinks.el b/eev-elinks.el
index 2b5d167604..ef5a5dc09e 100644
--- a/eev-elinks.el
+++ b/eev-elinks.el
@@ -19,7 +19,7 @@
 ;;
 ;; Author:     Eduardo Ochs <eduardoochs@gmail.com>
 ;; Maintainer: Eduardo Ochs <eduardoochs@gmail.com>
-;; Version:    20231106
+;; Version:    20240113
 ;; Keywords:   e-scripts
 ;;
 ;; Latest version: <http://anggtwu.net/eev-current/eev-elinks.el>
@@ -60,6 +60,7 @@
 ;; «.around-point»             (to "around-point")
 ;; «.find-elinks»              (to "find-elinks")
 ;; «.find-efunction-links»     (to "find-efunction-links")
+;; «.find-eloadhistory-links»  (to "find-eloadhistory-links")
 ;; «.find-evariable-links»     (to "find-evariable-links")
 ;; «.find-ekey-links»          (to "find-ekey-links")
 ;; «.find-elongkey-links»      (to "find-elongkey-links")
@@ -306,10 +307,11 @@ This is an internal function used by 
`find-efunction-links' and
     (where-is ',f)
     (symbol-file ',f 'defun)
     (find-fline (symbol-file ',f 'defun))
-    (find-epp (assoc (symbol-file ',f 'defun) load-history))
-    (find-epp (assoc ,(symbol-file f 'defun) load-history))
+    (find-eppp (assoc (symbol-file ',f 'defun) load-history))
+    (find-eppp (assoc ,(symbol-file f 'defun) load-history))
     (find-eppp (mapcar 'car load-history))
     (find-estring (mapconcat 'identity (mapcar 'car load-history) "\n"))
+    (find-estring-elisp (ee-eloadhistory-find-flines))
     (find-estring (documentation ',f))
     (find-estring (documentation ',f t))
     (describe-function ',f)
@@ -318,6 +320,46 @@ This is an internal function used by 
`find-efunction-links' and
 
 
 
+;; «find-eloadhistory-links»  (to ".find-eloadhistory-links")
+;; Skel: (find-find-links-links-new "eloadhistory" "" "")
+;; Test: (find-eloadhistory-links)
+;;
+(defun find-eloadhistory-links (&rest pos-spec-list)
+"Visit a temporary buffer containing hyperlinks for eloadhistory."
+  (interactive)
+  (apply
+   'find-elinks
+   `((find-eloadhistory-links ,@pos-spec-list)
+     ;; Convention: the first sexp always regenerates the buffer.
+     (find-efunction 'find-eloadhistory-links)
+     ""
+     (find-estring-elisp (ee-eloadhistory-find-flines))
+     (find-estring-elisp (ee-eloadhistory-fors))
+     )
+   pos-spec-list))
+
+;; Tests: (ee-shorten-elc (symbol-file 'next-line 'defun))
+;;        (find-estring-elisp (ee-eloadhistory-fors))
+;;
+(defun ee-eloadhistory-find-flines ()
+  "An internal function used by `find-eloadhistory-links'."
+  (mapconcat
+   (lambda (fname) (format "%S\n" `(find-fline ,(ee-shorten-elc fname))))
+   (mapcar 'car load-history)))
+
+(defun ee-eloadhistory-fors ()
+  "An internal function used by `find-eloadhistory-links'."
+  (mapconcat
+   (lambda (fname) (format "%S\n" `(find-eloadhistory-for ,fname)))
+   (mapcar 'car load-history)))
+
+(defun ee-shorten-elc (fname)
+  "An internal function used by `ee-eloadhistory-find-flines'."
+  (ee-shorten-file-name (replace-regexp-in-string ".elc$" ".el" fname)))
+
+
+
+
 ;;;   __ _           _                            _       _     _      
 ;;;  / _(_)_ __   __| |       _____   ____ _ _ __(_) __ _| |__ | | ___ 
 ;;; | |_| | '_ \ / _` |_____ / _ \ \ / / _` | '__| |/ _` | '_ \| |/ _ \
diff --git a/eev-intro.el b/eev-intro.el
index 284fb49cf1..899d492935 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:    20240113
+;; Version:    20240114
 ;; Keywords:   e-scripts
 ;;
 ;; Latest version: <http://anggtwu.net/eev-current/eev-intro.el>
@@ -17419,7 +17419,79 @@ test its function `foo'.
 
 
 
-4. TODO
+
+4. CLua1.lua
+============
+This file
+
+  http://anggtwu.net/LUA/CLua1.lua.html
+  http://anggtwu.net/LUA/CLua1.lua
+         (find-angg \"LUA/CLua1.lua\")
+
+implements a way to do something similar to the elisp function
+`find-luaso-links' of the last section, but using Lua to generate
+all strings from templates. Here's how to test it:
+
+ Download it into /tmp/CLua1/:
+ (eepitch-shell)
+ (eepitch-kill)
+ (eepitch-shell)
+  rm -Rfv /tmp/CLua1/
+  mkdir   /tmp/CLua1/
+  cd      /tmp/CLua1/
+  wget http://anggtwu.net/LUA/lua50init.lua
+  wget http://anggtwu.net/LUA/Dang1.lua
+  wget http://anggtwu.net/LUA/CLua1.lua
+
+ Make `find-clua' and LUA_{<}INIT,PATH{>} point to /tmp/CLua1/:
+ (code-c-d \"clua\"    \"/tmp/CLua1/\" :anchor)
+ (setenv \"LUA_INIT\" \"@/tmp/CLua1/lua50init.lua\")
+ (setenv \"LUA_PATH\"  \"/tmp/CLua1/?.lua;;\")
+
+ Now run these test blocks:
+ (find-clua \"CLua1.lua\" \"CLua-tests\")
+ (find-clua \"CLua1.lua\" \"buildandload-tests\")
+
+
+
+
+5. CLua1.lua from the outside
+=============================
+In the previous section you ran the tests in two test blocks that
+were _inside_ CLua1.lua; it is also possible to run the functions
+in CLua1.lua \"from the outside\". Try this:
+
+ (eepitch-lua51)
+ (eepitch-kill)
+ (eepitch-lua51)
+  require \"CLua1\"   -- (find-clua \"CLua1.lua\")
+
+  -- Choose one:
+  CLua.__index.compile = CLua.__index.mac
+  CLua.__index.compile = CLua.__index.debian
+
+  CLua.rm()
+
+  buildandload('minusdiv', [=[
+    lua_pushnumber(L, lua_tonumber(L, 1) - lua_tonumber(L, 2));
+    lua_pushnumber(L, lua_tonumber(L, 1) / lua_tonumber(L, 2));
+    return 2;
+  ]=])
+  print(minusdiv(20, 2))                  --> 18 10
+  print(minusdiv(20, 2, 42, 99, 300, 3))  --> 18 10
+
+  buildandload('minusdiv', [=[
+    lua_pushnumber(L, lua_tonumber(L, -2) - lua_tonumber(L, -1));
+    lua_pushnumber(L, lua_tonumber(L, -3) / lua_tonumber(L, -2));
+    return 2;
+  ]=])
+  print(minusdiv(20, 2))                  --> 18 10
+  print(minusdiv(20, 2, 42, 99, 300, 3))  --> 297 100
+
+
+
+
+6. TODO
 =======
 I have an old eev-based tutorial for Lua here:
 
diff --git a/eev-tlinks.el b/eev-tlinks.el
index 33d0905f1b..63a427e7f5 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:    20240112
+;; Version:    20240113
 ;; Keywords:   e-scripts
 ;;
 ;; Latest version: <http://anggtwu.net/eev-current/eev-tlinks.el>
@@ -4944,6 +4944,18 @@ lua5.1
  (eepitch-kill)
  (eepitch-lua51)
   PP({20,\"30\"})   -- should work
+
+
+ If you want to use an init file that loads my
+ lua50init.lua and then does something else, use this:
+
+ (setenv \"LUA_INIT\" \"@{dir0}lua50init_my.lua\")
+ (ee-copy-rest 2 '(find-fline \"{dir0}lua50init_my.lua\"))
+
+-- See: (find-luainit-links \"{dir0}\")
+--      (find-fline \"{dir}lua50init.lua\")
+dofile \"{dir0}lua50init.lua\"
+-- Put your something elses here
 ")
        )
      pos-spec-list)))
@@ -5011,10 +5023,19 @@ LUALIB_API int luaopen_{stem}(lua_State *L) {<}
 {>}
 
 /*
- (eepitch-shell)
+ (eepitch-bash)
  (eepitch-kill)
- (eepitch-shell)
-gcc -g -Wall -shared -I/usr/include/lua5.1 -o {stem}.so {stem}.c
+ (eepitch-bash)
+# MacOS with MacPorts:
+CFLAGS=\"-g -Wall -shared -undefined dynamic_lookup\"
+LUADIR=/opt/local/include/lua5.1
+
+# Debian:
+CFLAGS=\"-g -Wall -shared\"
+LUADIR=/usr/include/lua5.1
+
+echo gcc $CFLAGS -I$LUADIR -o {stem}.so {stem}.c
+     gcc $CFLAGS -I$LUADIR -o {stem}.so {stem}.c
 ls -lAF {stem}*
 
  (eepitch-lua51)



reply via email to

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