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

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

[elpa] externals/eev 8a09aa4 59/64: Made the files eev-code.el and eev-b


From: Stefan Monnier
Subject: [elpa] externals/eev 8a09aa4 59/64: Made the files eev-code.el and eev-brxxx.el more compatible with lexical binding.
Date: Sun, 7 Apr 2019 16:59:14 -0400 (EDT)

branch: externals/eev
commit 8a09aa4505f539c7ca6ec1f95c497051fc9b3012
Author: Eduardo Ochs <address@hidden>
Commit: Eduardo Ochs <address@hidden>

    Made the files eev-code.el and eev-brxxx.el more compatible with lexical 
binding.
---
 ChangeLog       | 25 ++++++++++++++++++
 VERSION         |  4 +--
 eev-beginner.el |  6 +++--
 eev-brxxx.el    | 63 ++++++++++++++++++++++++++++++++--------------
 eev-code.el     | 78 +++++++++++++++++++++++++++++++--------------------------
 eev-intro.el    |  2 +-
 6 files changed, 118 insertions(+), 60 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2caa635..93bcd72 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2019-03-29  Eduardo Ochs  <address@hidden>
+
+       * eev-brxxx.el: made this file compatible with lexical binding.
+       Made the argument `f' explicit in many functions and moved the
+       functionality of `ee-tail-call' into the functions
+       `ee-code-brurl-rest' and ee-code-brfile-rest'.
+
+       * eev-beginner.el (load-path): uncommented the "(add-to-list
+       'load-path default-directory)"
+
+2019-03-17  Eduardo Ochs  <address@hidden>
+
+       * eev-code.el: made this file compatible with lexical binding.
+       (code-c-d): made the arguments `c' and `d' explicit.
+       (ee-code-c-d): made the arguments `c' and `d' explicit.
+       (ee-tail-call): made the arguments `c' and `d' explicit.
+       (ee-code-c-d-rest): made the arguments `c' and `d' explicit.
+       (find-code-c-d-rest): made the arguments `c' and `d' explicit.
+       (ee-code-c-d-:info): made the arguments `c' and `d' explicit.
+       (ee-code-c-d-:linfo): made the arguments `c' and `d' explicit.
+       (ee-code-c-d-:gz): made the arguments `c' and `d' explicit.
+       (ee-code-c-d-:anchor): made the arguments `c' and `d' explicit.
+       (ee-code-c-d-:wget): made the arguments `c' and `d' explicit.
+       (ee-code-c-d-:grep): made the arguments `c' and `d' explicit.
+
 2019-03-15  Eduardo Ochs  <address@hidden>
 
        * eepitch.el: added pointers to the discussion in the eev mailing
diff --git a/VERSION b/VERSION
index 3b0c3e4..0b044b3 100644
--- a/VERSION
+++ b/VERSION
@@ -1,2 +1,2 @@
-Fri Mar 15 05:05:33 GMT 2019
-Fri Mar 15 02:05:33 -03 2019
+Fri Mar 29 22:04:58 GMT 2019
+Fri Mar 29 19:04:58 -03 2019
diff --git a/eev-beginner.el b/eev-beginner.el
index dfebeff..42e719f 100644
--- a/eev-beginner.el
+++ b/eev-beginner.el
@@ -19,7 +19,7 @@
 ;;
 ;; Author:     Eduardo Ochs <address@hidden>
 ;; Maintainer: Eduardo Ochs <address@hidden>
-;; Version:    2019mar13
+;; Version:    2019mar29
 ;; Keywords:   e-scripts
 ;;
 ;; Latest version: <http://angg.twu.net/eev-current/eev-beginner.el>
@@ -68,7 +68,9 @@
 
 
 ;; 2019mar13: Commented this out.
-;; (add-to-list 'load-path default-directory)
+;; 2019mar29: Uncommented - it seems that emacs25 needs this.
+(add-to-list 'load-path default-directory)
+
 
 
 ;; Load all the main modules of eev.
diff --git a/eev-brxxx.el b/eev-brxxx.el
index bf62417..90fb9f9 100644
--- a/eev-brxxx.el
+++ b/eev-brxxx.el
@@ -19,7 +19,7 @@
 ;;
 ;; Author:     Eduardo Ochs <address@hidden>
 ;; Maintainer: Eduardo Ochs <address@hidden>
-;; Version:    2019mar02
+;; Version:    2019mar29
 ;; Keywords:   e-scripts
 ;;
 ;; Latest version: <http://angg.twu.net/eev-current/eev-brxxx.el>
@@ -160,6 +160,20 @@ This should be made smarter - file:// urls should be 
returned unchanged."
 
 
 
+;; An internal function used by `ee-code-brurl-rest' and
+;; `ee-code-brfile-rest'. Similar to:
+;; (find-eev "eev-code.el" "ee-tail-call2")
+
+(defun ee-tail-call1 (fmt f rest)
+  "An internal function used to support keyword-argument pairs."
+  (cond ((null rest) "")
+       ((keywordp (car rest))
+        (apply (intern (format fmt (car rest)))
+               f (cdr rest)))
+       (t (error "Wrong rest: %S" rest))))
+
+
+
 ;;;                _            _                     _ 
 ;;;   ___ ___   __| | ___      | |__  _ __ _   _ _ __| |
 ;;;  / __/ _ \ / _` |/ _ \_____| '_ \| '__| | | | '__| |
@@ -169,6 +183,7 @@ This should be made smarter - file:// urls should be 
returned unchanged."
 ;; (find-tail-call-links "brurl" "f")
 
 ;; «code-brurl» (to ".code-brurl")
+;; Test: (find-code-brurl  'find-foo :remote 'brfoo :local 'brfool :dired 
'brfood)
 ;;
 (defun      code-brurl (f &rest rest)
   "Define a family of brxxx functions from a function that operates on URLs"
@@ -179,15 +194,19 @@ This should be made smarter - file:// urls should be 
returned unchanged."
 "Generate code for a family of functions from a function that operates on URLs"
   (concat (ee-template0 "\
 ;; {(ee-S `(find-code-brurl ',f ,@(mapcar 'ee-add-quote rest)))}
-")  (ee-code-brurl-rest rest)))
+")  (ee-code-brurl-rest f rest)))
 
 ;; «ee-code-brurl-rest» (to ".ee-code-brurl-rest")
 ;; Support for extra arguments
-;;
-(defun ee-code-brurl-rest (rest)
-  (ee-tail-call "ee-code-brurl-%S" rest))
 
-(defun ee-code-brurl-:remote (brxxx &rest rest)
+(defun ee-code-brurl-rest (f rest)
+  (cond ((null rest) "")
+       ((keywordp (car rest))
+        (apply (intern (format "ee-code-brurl-%S" (car rest)))
+               f (cdr rest)))
+       (t (error "Wrong rest: %S" rest))))
+
+(defun ee-code-brurl-:remote (f brxxx &rest rest)
   (concat (ee-template0 "
 \(defun {brxxx} (url &rest ignore)
   \"Apply `{f}' on URL.\"
@@ -195,9 +214,9 @@ This should be made smarter - file:// urls should be 
returned unchanged."
   (setq browse-url-browser-function '{brxxx})
   (message \"(%S %S) -> %S\" '{f} url
                           ({f} url)))
-")  (ee-code-brurl-rest rest)))
+")  (ee-code-brurl-rest f rest)))
 
-(defun ee-code-brurl-:local (brxxxl &rest rest)
+(defun ee-code-brurl-:local (f brxxxl &rest rest)
   (concat (ee-template0 "
 \(defun {brxxxl} (url &rest ignore)
   \"Apply `{f}' on the local url associated to URL.\"
@@ -206,9 +225,9 @@ This should be made smarter - file:// urls should be 
returned unchanged."
   (setq url (ee-url-to-local-url url))
   (message \"(%S %S) -> %S\" '{f} url
                           ({f} url)))
-")  (ee-code-brurl-rest rest)))
+")  (ee-code-brurl-rest f rest)))
 
-(defun ee-code-brurl-:dired (brxxxd &rest rest)
+(defun ee-code-brurl-:dired (f brxxxd &rest rest)
   (concat (ee-template0 "
 \(defun {brxxxd} (&rest ignore)
   \"Apply `{f}' on the url of the dired file at point.\"
@@ -216,7 +235,7 @@ This should be made smarter - file:// urls should be 
returned unchanged."
   (let ((url (ee-dired-to-url)))
     (message \"(%S %S) -> %S\" '{f} url
                              ({f} url))))
-")  (ee-code-brurl-rest rest)))
+")  (ee-code-brurl-rest f rest)))
 
 ;; Test:
 ;; (find-code-brurl 'pluc :remote 'brpluc :local 'brplucl :dired 'brplucd)
@@ -240,6 +259,8 @@ This should be made smarter - file:// urls should be 
returned unchanged."
 ;; «code-brfile» (to ".code-brfile")
 ;; code-brfile: top-level functions
 ;;
+;; Test: (find-code-brfile 'find-bar :local 'brbarl :dired 'brbard)
+;;
 (defun      code-brfile (f &rest rest)
   "Define a family of brxxx functions from a function that operates on files"
   (eval (ee-read      (apply 'ee-code-brfile f rest))))
@@ -249,15 +270,19 @@ This should be made smarter - file:// urls should be 
returned unchanged."
 "Generate code for a family of functions from a function that operates on 
files"
   (concat (ee-template0 "\
 ;; {(ee-S `(find-code-brfile ',f ,@(mapcar 'ee-add-quote rest)))}
-")  (ee-code-brfile-rest rest)))
+")  (ee-code-brfile-rest f rest)))
 
 ;; «ee-code-brfile-rest» (to ".ee-code-brfile-rest")
 ;; Support for extra arguments
-;;
-(defun ee-code-brfile-rest (rest)
-  (ee-tail-call "ee-code-brfile-%S" rest))
 
-(defun ee-code-brfile-:local (brxxxl &rest rest)
+(defun ee-code-brfile-rest (f rest)
+  (cond ((null rest) "")
+       ((keywordp (car rest))
+        (apply (intern (format "ee-code-brfile-%S" (car rest)))
+               f (cdr rest)))
+       (t (error "Wrong rest: %S" rest))))
+
+(defun ee-code-brfile-:local (f brxxxl &rest rest)
   (concat (ee-template0 "
 \(defun {brxxxl} (url &rest ignore)
   \"Apply `{f}' on the local file name associated to URL.\"
@@ -266,9 +291,9 @@ This should be made smarter - file:// urls should be 
returned unchanged."
   (let ((fname (ee-url-to-fname url)))
     (message \"(%S %S) -> %S\" '{f} fname
                              ({f} fname))))
-")  (ee-code-brfile-rest rest)))
+")  (ee-code-brfile-rest f rest)))
 
-(defun ee-code-brfile-:dired (brxxxd &rest rest)
+(defun ee-code-brfile-:dired (f brxxxd &rest rest)
   (concat (ee-template0 "
 \(defun {brxxxd} (&rest ignore)
   \"Apply `{f}' on the dired file at point.\"
@@ -276,7 +301,7 @@ This should be made smarter - file:// urls should be 
returned unchanged."
   (let ((fname (ee-dired-to-fname)))
     (message \"(%S %S) -> %S\" '{f} fname
                              ({f} fname))))
-")  (ee-code-brfile-rest rest)))
+")  (ee-code-brfile-rest f rest)))
 
 
 
diff --git a/eev-code.el b/eev-code.el
index 8b79f3f..2395426 100644
--- a/eev-code.el
+++ b/eev-code.el
@@ -47,6 +47,7 @@
 
 ;; «.alists»           (to "alists")
 ;; «.code-c-d-pairs»   (to "code-c-d-pairs")
+;; «.ee-tail-call2»    (to "ee-tail-call2")
 ;; «.code-c-d»         (to "code-c-d")
 ;; «.code-c-d-s»       (to "code-c-d-s")
 
@@ -54,19 +55,6 @@
 
 
 
-;; The name "tail call" is misleading - this is recursive,
-;; but not a tail call in the usual sense.
-
-(defun ee-tail-call (fmt rest)
-  "An internal function used to support keyword-argument pairs."
-  (cond ((null rest) "")
-       ((keywordp (car rest))
-        (apply (intern (format fmt (car rest)))
-               (cdr rest)))
-       (t (error "Wrong rest: %S" rest))))
-
-
-
 ;;;        _ _     _       
 ;;;   __ _| (_)___| |_ ___ 
 ;;;  / _` | | / __| __/ __|
@@ -146,6 +134,27 @@ is used by some functions in \"eev-insert.el\".")
 
 
 
+;;;                  _        _ _                 _ _ 
+;;;   ___  ___      | |_ __ _(_) |       ___ __ _| | |
+;;;  / _ \/ _ \_____| __/ _` | | |_____ / __/ _` | | |
+;;; |  __/  __/_____| || (_| | | |_____| (_| (_| | | |
+;;;  \___|\___|      \__\__,_|_|_|      \___\__,_|_|_|
+;;;                                                   
+;; «ee-tail-call2» (to ".ee-tail-call2")
+;; The name "tail call" is misleading - this is recursive,
+;; but not a tail call in the usual sense.
+
+(defun ee-tail-call2 (fmt c d rest)
+  "An internal function used to support keyword-argument pairs."
+  (cond ((null rest) "")
+       ((keywordp (car rest))
+        (apply (intern (format fmt (car rest)))
+               c d (cdr rest)))
+       (t (error "Wrong rest: %S" rest))))
+
+
+
+
 
 ;;;                _                          _ 
 ;;;   ___ ___   __| | ___        ___       __| |
@@ -171,15 +180,14 @@ Try this: (find-code-c-d \"CODE\" \"/DIR/\" :info 
\"INFO\")"
   (if (stringp (car rest))
       (setq rest (cons :info rest)))
   (concat (ee-code-c-d-base c d)
-         (ee-code-c-d-rest rest)))
+         (ee-code-c-d-rest c d rest)))
 
 ;; Support for extra arguments
 ;;
-(defun ee-code-c-d-rest (rest)
-  (ee-tail-call "ee-code-c-d-%S" rest))
-
+(defun   ee-code-c-d-rest (c d rest)
+  (ee-tail-call2 "ee-code-c-d-%S" c d rest))
 (defun find-code-c-d-rest (c d &rest rest)
-  (find-estring-elisp (ee-code-c-d-rest rest)))
+  (find-estring-elisp (ee-code-c-d-rest c d rest)))
 
 (defun ee-code-c-d-base (c d)
   (ee-template0 "\
@@ -198,8 +206,6 @@ Try this: (find-code-c-d \"CODE\" \"/DIR/\" :info \"INFO\")"
    (defun find-{c}tag (str &rest pos-spec-list)
      (ee-use-{c}-tags)
      (apply 'ee-find-tag str pos-spec-list))
-   ;; (defun find-{c}sh (command &rest pos-spec-list)
-   ;;   (apply 'ee-find-xxxsh ee-{c}dir command pos-spec-list))
    (defun find-{c}sh (command &rest pos-spec-list)
      (apply 'find-sh-at-dir ee-{c}dir command pos-spec-list))
    (defun find-{c}sh0 (command)
@@ -212,50 +218,50 @@ Try this: (find-code-c-d \"CODE\" \"/DIR/\" :info 
\"INFO\")"
      (apply 'ee-find-grep ee-{c}dir grep-command-args pos-spec-list))
    "))
 
-(defun ee-code-c-d-:info (info &rest rest)
+(defun ee-code-c-d-:info (c d info &rest rest)
   (concat (ee-template0 "
-   ;; {(ee-S `(ee-code-c-d-:info ,info ,@rest))} 
+   ;; {(ee-S `(ee-code-c-d-:info ,c ,d ,info ,@rest))}
    (defun find-{c}node (page &rest pos-spec-list)
      (interactive (list \"\"))
      (setq ee-info-code \"{c}\")    ;; for M-h M-i
      (setq ee-info-file \"{info}\")    ;; for M-h M-i
      (apply 'find-node (format \"({info})%s\" page) pos-spec-list))
-   ") (ee-code-c-d-rest rest)))
+   ") (ee-code-c-d-rest c d rest)))
 
-(defun ee-code-c-d-:linfo (manual &rest rest)
+(defun ee-code-c-d-:linfo (c d manual &rest rest)
   (concat (ee-template0 "
-   ;; {(ee-S `(ee-code-c-d-:linfo ,manual ,@rest))} 
+   ;; {(ee-S `(ee-code-c-d-:linfo ,c ,d ,manual ,@rest))}
    (defun find-{c}node (section &rest pos-spec-list)
      (interactive (list \"\"))
      (apply 'ee-find-node ee-{c}dir \"{manual}\" section pos-spec-list))
-   ") (ee-code-c-d-rest rest)))
+   ") (ee-code-c-d-rest c d rest)))
 
-(defun ee-code-c-d-:gz (&rest rest)
+(defun ee-code-c-d-:gz (c d &rest rest)
  (concat (ee-template0 "
-   ;; {(ee-S `(ee-code-c-d-:gz ,@rest))} 
+   ;; {(ee-S `(ee-code-c-d-:gz ,c ,d ,@rest))}
    (defun find-{c}file (str &rest pos-spec-list)
      (interactive (list \"\"))
      (ee-use-{c}-tags)
      (apply 'find-fline-gz (ee-{c}file str) pos-spec-list))
-   ") (ee-code-c-d-rest rest)))
+   ") (ee-code-c-d-rest c d rest)))
 
-(defun ee-code-c-d-:anchor (&rest rest)
+(defun ee-code-c-d-:anchor (c d &rest rest)
  (concat (ee-template0 "
-   ;; {(ee-S `(ee-code-c-d-:anchor ,@rest))} 
+   ;; {(ee-S `(ee-code-c-d-:anchor ,c ,d ,@rest))}
    (defun find-{c} (str &rest pos-spec-list)
      (apply 'find-anchor (ee-{c}file str) pos-spec-list))
-   ") (ee-code-c-d-rest rest)))
+   ") (ee-code-c-d-rest c d rest)))
 
-(defun ee-code-c-d-:wget (url &rest rest)
+(defun ee-code-c-d-:wget (c d url &rest rest)
  (concat (ee-template0 "
-   ;; {(ee-S `(ee-code-c-d-:wget ,url ,@rest))} 
+   ;; {(ee-S `(ee-code-c-d-:wget ,c ,d ,url ,@rest))}
    (defun ee-{c}url (semiurl) (concat \"{url}\" semiurl))
    (defun find-{c}wget (semiurl &rest pos-spec-list)
      (interactive (list \"\"))
      (apply 'find-wget (ee-{c}url semiurl) pos-spec-list))
-   ") (ee-code-c-d-rest rest)))
+   ") (ee-code-c-d-rest c d rest)))
 
-(defun ee-code-c-d-:grep (&rest rest) (ee-code-c-d-rest rest))  ; compat
+(defun ee-code-c-d-:grep (c d &rest rest) (ee-code-c-d-rest c d rest))  ; 
compat
 
 ;; Support functions.
 ;; Maybe I should rewrite some of them using `ee-at0'...
diff --git a/eev-intro.el b/eev-intro.el
index 4ab5656..e589563 100644
--- a/eev-intro.el
+++ b/eev-intro.el
@@ -8422,7 +8422,7 @@ an e-script block is \"executable\". But in what sense it 
is a
      would have to decide what to write and how to write it, and
      we would have to alternate between the \"task\" and \"taking
      notes\". After many years of practice _some_ people would
-     learn how to take notes without distract themselves much
+     learn how to take notes without distracting themselves much
      from the task at hand, and they would learn how to make
      their notes at the same time concise and readable enough.
 



reply via email to

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