[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eev 7d40ded857 6/6: Added `ee-template0-lex'.
From: |
ELPA Syncer |
Subject: |
[elpa] externals/eev 7d40ded857 6/6: Added `ee-template0-lex'. |
Date: |
Sun, 13 Mar 2022 07:57:29 -0400 (EDT) |
branch: externals/eev
commit 7d40ded8577fcc67d50dade5a2931f62d7d2a937
Merge: 850b8df763 8b1eed12b1
Author: Eduardo Ochs <eduardoochs@gmail.com>
Commit: Eduardo Ochs <eduardoochs@gmail.com>
Added `ee-template0-lex'.
---
ChangeLog | 12 ++++++
VERSION | 10 +++++
eev-code.el | 24 +++++++++++-
eev-intro.el | 10 ++---
eev-template0.el | 115 ++++++++++++++++++++++++++++++++++++++++++++-----------
5 files changed, 140 insertions(+), 31 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e2c5c223ed..dd3a294fde 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
<<<<<<< HEAD
+<<<<<<< HEAD
+=======
=======
+2022-03-13 Eduardo Ochs <eduardoochs@gmail.com>
+
+ * eev-template0.el (ee-template0-lex, ee-template00-lex)
+ (ee-template000-lex): new functions.
+
+2022-03-10 Eduardo Ochs <eduardoochs@gmail.com>
+
+ * eev-code.el (eev-version): new function.
+
+>>>>>>> UTF-8
2022-03-07 Eduardo Ochs <eduardoochs@gmail.com>
* eev-kla.el: rewritten almost completely.
diff --git a/VERSION b/VERSION
index f8c25ee9b3..70e7bf80bf 100644
--- a/VERSION
+++ b/VERSION
@@ -1,3 +1,5 @@
+<<<<<<< ours
+<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
Mon Feb 28 06:20:20 GMT 2022
@@ -10,3 +12,11 @@ Mon Mar 7 01:36:03 -03 2022
Tue Mar 8 08:46:02 GMT 2022
Tue Mar 8 05:46:02 -03 2022
>>>>>>> UTF-8
+=======
+Sun Mar 13 11:28:31 GMT 2022
+Sun Mar 13 08:28:31 -03 2022
+>>>>>>> UTF-8
+=======
+Sun Mar 13 11:28:31 GMT 2022
+Sun Mar 13 08:28:31 -03 2022
+>>>>>>> theirs
diff --git a/eev-code.el b/eev-code.el
index 3536000942..f034c5758b 100644
--- a/eev-code.el
+++ b/eev-code.el
@@ -1,6 +1,6 @@
;;; eev-code.el -- `code-c-d', that generates and evaluates Lisp defuns. -*-
lexical-binding: nil; -*-
-;; Copyright (C) 2012-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2022 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: 20211006
+;; Version: 20220309
;; Keywords: e-scripts
;;
;; Latest version: <http://angg.twu.net/eev-current/eev-code.el>
@@ -50,6 +50,7 @@
;; «.ee-tail-call2» (to "ee-tail-call2")
;; «.code-c-d» (to "code-c-d")
;; «.code-c-d-s» (to "code-c-d-s")
+;; «.eev-version» (to "eev-version")
@@ -366,6 +367,25 @@ Note: the POS-SPEC-LIST arguments are currently not used."
+;;; _
+;;; ___ _____ __ __ _____ _ __ ___(_) ___ _ __
+;;; / _ \/ _ \ \ / /___\ \ / / _ \ '__/ __| |/ _ \| '_ \
+;;; | __/ __/\ V /_____\ V / __/ | \__ \ | (_) | | | |
+;;; \___|\___| \_/ \_/ \___|_| |___/_|\___/|_| |_|
+;;;
+;; «eev-version» (to ".eev-version")
+;; Test: (eev-version)
+
+(defun eev-version ()
+ "Show the current version of eev (in the file eev.el).
+This function simply opens the file eev.el and jumps to the right
+line in it. Extracting the version as a string would be harder."
+ (interactive)
+ (find-eevfile "eev.el" "Version:"))
+
+
+
+
(provide 'eev-code)
diff --git a/eev-intro.el b/eev-intro.el
index afcd42e0cf..604575a7ca 100644
--- a/eev-intro.el
+++ b/eev-intro.el
@@ -8352,16 +8352,14 @@ environment variable $S is set to ~/snarf/; then
running this
echo 'http://www.gnu.org/software/emacs/emacs-paper.html' >> ~/.psne.log
# (find-fline \"$S/http/www.gnu.org/software/emacs/emacs-paper.html\")
- # (find-w3m \"$S/http/www.gnu.org/software/emacs/emacs-paper.html\")
+ # (find-eww \"$S/http/www.gnu.org/software/emacs/emacs-paper.html\")
creates a local copy of `emacs-paper.html' inside ~/snarf/http/
and appends the URL to the file ~/.psne.log. The two lines in
comments are hyperlinks to the local copy; The `find-fline' opens
-it as a file in the obvious way, and `find-w3m' opens it \"as
-HTML\", using a text-mode web browser called w3m that can be run
-either in standalone mode or inside Emacs; `find-w3m' uses w3m's
-Emacs interface, and it accepts extra arguments, which are
-treated as a pos-spec-list.
+it as a file in the obvious way, and `find-eww' opens it \"as
+HTML\", using a text-mode web browser called eww that runs
+entirely inside Emacs.
diff --git a/eev-template0.el b/eev-template0.el
index 6a05bb0dd9..807786fb51 100644
--- a/eev-template0.el
+++ b/eev-template0.el
@@ -1,6 +1,6 @@
;;; eev-template0.el -- implement functions that eval `{}'s in a string. -*-
lexical-binding: nil; -*-
-;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2022 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: 20211102
+;; Version: 20220313
;; Keywords: e-scripts
;;
;; Latest version: <http://angg.twu.net/eev-current/eev-template0.el>
@@ -27,6 +27,12 @@
;; See also: <http://angg.twu.net/eev-intros/find-eev-quick-intro.html>
;; (find-eev-quick-intro)
+;; «.ee-template0» (to "ee-template0")
+;; «.lexical-binding» (to "lexical-binding")
+;; «.ee-template0-lex» (to "ee-template0-lex")
+
+
+
;;; Commentary:
;;
;; This file implements `ee-template00', a function that receives a
@@ -83,16 +89,35 @@
;;
;; Important: `ee-template0' is _INCOMPATIBLE WITH LEXICAL BINDING_.
;; See the comments at the end of this file.
-;;
-;; «.lexical-binding» (to "lexical-binding")
+
+;;; _ _ _ ___
+;;; ___ ___ | |_ ___ _ __ ___ _ __ | | __ _| |_ ___ / _ \
+;;; / _ \/ _ \_____| __/ _ \ '_ ` _ \| '_ \| |/ _` | __/ _ \ | | |
+;;; | __/ __/_____| || __/ | | | | | |_) | | (_| | || __/ |_| |
+;;; \___|\___| \__\___|_| |_| |_| .__/|_|\__,_|\__\___|\___/
+;;; |_|
+;;
+;; «ee-template0» (to ".ee-template0")
+
(defvar ee-template00-re "{\\([^{}]+\\)}"
"To make `ee-template0' use other delimiters instead of `{}'s
set this variable temporarily in a `let'.")
-
+;; Test:
+;; (ee-template0 "{<} a{(+ 2 3)} {>}")
+;;
+(defun ee-template0 (str)
+ "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'.
+Example: (ee-template0 \"{<} a{(+ 2 3)} {>}\")
+ --> \"{ 5 }\""
+ (let ((< "{") (> "}"))
+ (ee-template00 str)))
;; Tests:
;; (ee-template00 "a{(+ 2 3)}b")
@@ -112,21 +137,6 @@ Examples:\n
(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.
-Substrings of the form `{<}' and `{>}' in STR are replaced by `{'
-and `}' respectively; apart from that, this is the same as
-`ee-template00'.
-Example: (ee-template0 \"{<} a{(+ 2 3)} {>}\")
- --> \"{ 5 }\""
- (let ((< "{") (> "}"))
- (ee-template00 str)))
-
-
-
@@ -138,7 +148,7 @@ Example: (ee-template0 \"{<} a{(+ 2 3)} {>}\")
;;; |___/
;; «lexical-binding» (to ".lexical-binding")
;;
-;; Here is a demo of what fails in lexical binding.
+;; Here is a demo of how `ee-template0' can fail in lexical binding.
;; Note that the defun below is commented out with an initial "'".
'
(defun ee-dynlex-test (a b)
@@ -165,14 +175,73 @@ Example: (ee-template0 \"{<} a{(+ 2 3)} {>}\")
;; (find-lexical-intro "0. How to use this" "`M-1 M-1 M-e'")
;; (find-lexical-intro "5. A thread")
;;
-;; Here are some messages in help-gnu-emacs and in emacs-devel about
-;; dynamic binding being deprecated:
+;; Here are some messages in help-gnu-emacs, emacs-devel and
+;; bug-gnu-emacs about dynamic binding being deprecated:
;; https://lists.gnu.org/archive/html/help-gnu-emacs/2021-06/msg00054.html
;; https://lists.gnu.org/archive/html/help-gnu-emacs/2021-06/msg00085.html
;; https://lists.gnu.org/archive/html/help-gnu-emacs/2021-06/msg00095.html
;; https://lists.gnu.org/archive/html/help-gnu-emacs/2021-06/msg00096.html
;; https://lists.gnu.org/archive/html/emacs-devel/2021-09/msg01854.html
+;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=30078#86 Drew (cites RMS)
+
+
+
+;;; _
+;;; | | _____ __
+;;; _____| |/ _ \ \/ /
+;;; _ _ |_____| | __/> <
+;;; (_|_|_) |_|\___/_/\_\
+;;;
+;; «ee-template0-lex» (to ".ee-template0-lex")
+;; `ee-template0-lex' is a variant of `ee-template0' that doesn't need
+;; dynamic binding and that should work well in lexical binding. It is
+;; implemented as a macro, so beginners would probably find it much
+;; harder to understand than `ee-template0'.
+;;
+;; This is not used by eev. See:
+;; (find-eevgrep "grep --color=auto -nH -e ee-template0 *.el")
+;;
+;; The source code of eev needs to be clear to beginners, so I prefer
+;; to use `ee-template0' everywhere in the source - but in theory it
+;; should be possible to replace all occurrences of `ee-template0' by
+;; `ee-template0-lex'.
+;;
+;; This is based on code sent by Stefan Monnier.
+
+(defmacro ee-template0-lex (str)
+ "A replacement for `ee-template0' that doesn't need dynamic binding.
+This is a macro, and a call to
+ (ee-template0-lex \"ab{(+ c d)}ef\")
+is replaced by something equivalent (but to not exactly equal) to:
+ (concat \"ab\" (format \"%s\" (+ c d)) \"ef\")
+See the source code for examples and tests."
+ (ee-template00-lex str))
+
+(defun ee-template00-lex (str)
+ "An internal function used by `ee-template0-lex'."
+ `(let ((< "{") (> "}"))
+ (ignore < >) ; Silence byte-compiler in case `str' doesn't use those
+ ,(ee-template000-lex str)))
+(defun ee-template000-lex (str)
+ "An internal function used by `ee-template00-lex'."
+ (let ((exprs '())
+ (i 0))
+ (while (string-match "{\\([^{}]+\\)}" str i)
+ (push (substring str i (match-beginning 0)) exprs)
+ (setq i (match-end 0))
+ (push `(format "%s" ,(read (match-string 1 str))) exprs))
+ (push (substring str i) exprs)
+ (cons 'concat (delete "" (nreverse exprs)))))
+
+;; Tests:
+;; (ee-template0-lex "{<} a{(+ 2 3)} {>}")
+;; (macroexpand '(ee-template0-lex "{<} a{(+ 2 3)} {>}"))
+;; (ee-template00-lex "{<} a{(+ 2 3)} {>}")
+;; (ee-template000-lex "{<} a{(+ 2 3)} {>}")
+;;
+' (let ((hi "Here:") (a 22) (b 33))
+ (ee-template0-lex "{hi} {a} + {b} = {(+ a b)}"))
- [elpa] externals/eev updated (7ff63737b5 -> 7d40ded857), ELPA Syncer, 2022/03/13
- [elpa] externals/eev a68aecc0e0 1/6: Added `find-emenubar-links'., ELPA Syncer, 2022/03/13
- [elpa] externals/eev 7d40ded857 6/6: Added `ee-template0-lex'.,
ELPA Syncer <=
- [elpa] externals/eev 47326e0248 4/6: Added `ee-template0-lex'., ELPA Syncer, 2022/03/13
- [elpa] externals/eev 850b8df763 3/6: Merge branch 'UTF-8', ELPA Syncer, 2022/03/13
- [elpa] externals/eev a1ae99c028 2/6: Merge branch 'UTF-8', ELPA Syncer, 2022/03/13
- [elpa] externals/eev 8b1eed12b1 5/6: Added `ee-template0-lex'., ELPA Syncer, 2022/03/13