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

    Now psne-ing uses "echo -N" in eshell by default (or sort of).
---
 ChangeLog     |  9 +++++++
 VERSION       |  4 +--
 eev-intro.el  | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 eev-tlinks.el | 46 +++++++++++++++++++-------------
 4 files changed, 119 insertions(+), 24 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 744225a574..e0c7ae2261 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2022-04-13  Eduardo Ochs  <eduardoo...@gmail.com>
+
+       * eev-tlinks.el (ee-find-psne-echo-options): new function.
+       (find-psne-links, ee-find-psne-core): added the argument
+       `echo-options'.
+
+       * eev-intro.el (find-windows-beginner-intro): added the section
+       "5.6.1. Echo in Eshell".
+
 2022-04-12  Eduardo Ochs  <eduardoo...@gmail.com>
 
        * eev-code.el (ee-code-c-d-base): added some links to the
diff --git a/VERSION b/VERSION
index a4c5a0740f..64cba9fa6d 100644
--- a/VERSION
+++ b/VERSION
@@ -1,2 +1,2 @@
-Wed Apr 13 00:49:20 GMT 2022
-Tue Apr 12 21:49:20 -03 2022
+Thu Apr 14 03:00:14 GMT 2022
+Thu Apr 14 00:00:14 -03 2022
diff --git a/eev-intro.el b/eev-intro.el
index fa84be27bc..afee1620df 100644
--- a/eev-intro.el
+++ b/eev-intro.el
@@ -19,7 +19,7 @@
 ;;
 ;; Author:     Eduardo Ochs <eduardoo...@gmail.com>
 ;; Maintainer: Eduardo Ochs <eduardoo...@gmail.com>
-;; Version:    20220313
+;; Version:    20220413
 ;; Keywords:   e-scripts
 ;;
 ;; Latest version: <http://angg.twu.net/eev-current/eev-intro.el>
@@ -1225,12 +1225,21 @@ described above.
 For more on `M-x', and on why the defuns above need the
 \"(interactive)\", see:
 
-  (find-node \"(emacs)M-x\")
-  (find-node \"(emacs)Commands\")
-  (find-node \"(elisp)Defining Commands\")
+  (find-enode \"M-x\")
+  (find-enode \"Commands\")
+  (find-elnode \"Defining Commands\")
+
+Remember that you can list all current eejump targets with:
+
+  (find-eejumps)
+
+you can list the current commands with very short names with:
+
+  (find-eeshortdefs)
 
 [Video links:]
   (find-eev2020video \"19:03\" \"commands with very short names\")
+  (find-eev2020video \"21:07\" \"commands with very short numbers\")
 
 
 
@@ -13914,6 +13923,73 @@ tecnhical details, see:
 
 
 
+5.6.1. Echo in Eshell
+---------------------
+Note that the \"echo\" of Eshell has a quirk: if you run these
+lines
+
+  echo http://foo.bar/    >> ~/.psne.log
+  echo http://qux.bletch/ >> ~/.psne.log
+  echo http://plic.ploc/  >> ~/.psne.log
+
+on a \"normal\" unix shell these URLs will be appended to
+~/.psne.log with newlines separating them, but if you run that in
+Eshell they will be appended without newlines. One way to fix
+that is to invoke the (built-in!) echo of Eshell with the \"-N\"
+option, like this:
+
+  echo -N http://foo.bar/    >> ~/.psne.log
+  echo -N http://qux.bletch/ >> ~/.psne.log
+  echo -N http://plic.ploc/  >> ~/.psne.log
+
+The option \"-N\" (\"terminate with a newline\") is only
+explained in the source of eshell:
+
+  (find-efile \"eshell/em-basic.el\" \"defun eshell/echo\" \"?N\")
+
+`find-psne-links' accepts two optional arguments after the URL.
+The first of them is called `wget-options', and when it is not
+given it defaults to \"-nc\" (\"no-clobber\"). The optional
+argument is called `echo-options', and _ideally_ it should
+default to \"\" on \"normal\" unix shells, and to \"-N\" on
+eshell. When it is not given eev runs the function
+`ee-find-psne-echo-options' to decide what to do, and the
+default definition of that function is:
+
+  ;; See: (find-eev \"eev-tlinks.el\" \"ee-find-psne-echo-options\")
+  ;;
+  (defun ee-find-psne-echo-options ()
+    (if (eq system-type 'windows-nt) \"-N\" \"\"))
+
+which means: if a person is \"on Windows\", suppose that she is
+using Eshell, and that she needs \"echo -N\"; is a person is on
+\"non-Windows\", suppose that she is using a \"normal\" unix
+shell, and that she needs just \"echo\", without the \"-N\". The
+exact definition of the term \"on Windows\" can be found here:
+
+  (find-evardescr 'system-type      \"windows-nt\")
+  (find-elnode \"System Environment\" \"windows-nt\")
+
+The suppositions above are often wrong. Here is the easiest way
+to fix them: if you are \"on Windows\" but you use a \"normal\"
+unix shell, you can put these two lines in your ~/.emacs to
+override the definition above:
+
+  ;; See: (find-windows-beginner-intro \"5.6.1. Echo in Eshell\")
+  (defun ee-find-psne-echo-options () \"\")
+
+and if you are \"on non-Windows\" but you use mostly Eshell, you
+can put this in your ~/.emacs instead:
+
+  ;; See: (find-windows-beginner-intro \"5.6.1. Echo in Eshell\")
+  (defun ee-find-psne-echo-options () \"-N\")
+
+If you use both Eshell and \"normal\" unix shells you can try to
+redefine `ee-find-psne-echo-options' in other ways. If you find a
+smarter way that works well, please get in touch!!!
+
+
+
 
 6. Video links
 ==============
diff --git a/eev-tlinks.el b/eev-tlinks.el
index 0129399bd6..a182a578aa 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:    20220412
+;; Version:    20220413
 ;; Keywords:   e-scripts
 ;;
 ;; Latest version: <http://angg.twu.net/eev-current/eev-tlinks.el>
@@ -72,7 +72,7 @@
 ;;
 ;; «.find-find-links-links»            (to "find-find-links-links")
 ;; «.find-find-links-links-new»                (to "find-find-links-links-new")
-;; «.ee-ffll-functions»                        (to "ee-ffll-functions")
+;;   «.ee-ffll-functions»              (to "ee-ffll-functions")
 ;;
 ;; «.find-intro-links»                 (to "find-intro-links")
 ;; «.find-eev-header-links»            (to "find-eev-header-links")
@@ -81,15 +81,16 @@
 ;; «.find-eev-install-links»           (to "find-eev-install-links")
 ;; «.find-eev-update-links»            (to "find-eev-update-links")
 ;; «.find-youtubedl-links»             (to "find-youtubedl-links")
-;; «.ee-youtubedl-command»             (to "ee-youtubedl-command")
+;;   «.ee-youtubedl-command»           (to "ee-youtubedl-command")
 ;; «.find-psne-links»                  (to "find-psne-links")
+;;   «.ee-find-psne-echo-options»      (to "ee-find-psne-echo-options")
 ;; «.find-git-links»                   (to "find-git-links")
 ;; «.find-fossil-links»                        (to "find-fossil-links")
 ;; «.find-apt-get-source-links»                (to "find-apt-get-source-links")
 ;;
 ;; «.find-eevvideo-links»              (to "find-eevvideo-links")
 ;; «.find-psnevideo-links»             (to "find-psnevideo-links")
-;; «.ee-psne-if-needed»                        (to "ee-psne-if-needed")
+;;   «.ee-psne-if-needed»              (to "ee-psne-if-needed")
 ;; «.code-psnevideo»                   (to "code-psnevideo")
 ;; «.code-eevvideo»                    (to "code-eevvideo")
 ;; «.code-eevvideo-local»              (to "code-eevvideo-local")
@@ -1215,52 +1216,61 @@ Files that look like subtitle files are ignored."
 ;;; |_|                   
 ;;
 ;; «find-psne-links» (to ".find-psne-links")
-;; Skel: (find-find-links-links-new "psne" "url wget-options" "")
+;; Skel: (find-find-links-links-new "psne" "url wget-options echo-options" "")
 ;; Test: (find-psne-links "http://foo/bar";)
+;;       (find-psne-links "http://foo/bar"; "-nc" "-N")
 ;;  See: (find-psne-intro "3. The new way: `M-x brep'")
 ;;       (find-psne-intro "3. The new way: `M-x brep'" "find-psne-links")
-
-(defun find-psne-links (&optional url wget-options &rest pos-spec-list)
+;;       (find-windows-beginner-intro "5.6.1. Echo in Eshell")
+;;
+(defun find-psne-links (&optional url wget-options echo-options &rest 
pos-spec-list)
 "See: (find-psne-intro)"
   (interactive)
   (setq url (or url "{url}"))
   (setq wget-options (or wget-options "-nc"))
+  (setq echo-options (or echo-options (ee-find-psne-echo-options)))
   (apply
    'find-elinks
-   `((find-psne-links ,url ,wget-options ,@pos-spec-list)
-     (find-psne-links ,url "-c" ,@pos-spec-list)
-     (find-psne-links ,url "" ,@pos-spec-list)
+   `((find-psne-links ,url ,wget-options ,echo-options ,@pos-spec-list)
+     (find-psne-links ,url "-c" "" ,@pos-spec-list)
+     (find-psne-links ,url "" "" ,@pos-spec-list)
      ;; Convention: the first sexp always regenerates the buffer.
      (find-efunction 'find-psne-links)
      ""
      ,(ee-adjust-red-stars " (eepitch-shell2)")
-     ,(ee-find-psne-core url wget-options)
+     ,(ee-find-psne-core url wget-options echo-options)
      )
    pos-spec-list))
 
-;; Test:
+;; Tests:
 ;; (find-estring (ee-find-psne-core "http://www.lua.org/start.html";))
+;; (find-estring (ee-find-psne-core "http://www.lua.org/start.html"; "-nc" 
"-N"))
 ;;
-(defun ee-find-psne-core (url &optional wget-options)
+(defun ee-find-psne-core (url &optional wget-options echo-options)
   "This is an internal function used by `find-psne-links'."
   (let* ((localurl (ee-url-to-fname0 url))
         (localdir (file-name-directory localurl))
         (fname0 (file-name-nondirectory localurl))
-        (o (format "%3s" (or wget-options ""))))
+        (o (format "%-3s" (or wget-options "")))
+        (e (format "%-3s" (or echo-options
+                              (ee-find-psne-echo-options)))))
     (ee-template0 "\
 mkdir -p {localdir}
 cd       {localdir}
 wget {o} '{url}'
-echo     '{url}' >> ~/.psne.log
+echo {e} '{url}' >> ~/.psne.log
 
 # (find-fline \"{localdir}\")
 # (find-fline \"{localdir}\" \"{fname0}\")
 # (find-fline \"{localurl}\")
 ")))
 
-;; Links to the old version:
-;; (find-eev "eev-browse-url.el" "find-psne-links")
-;; (find-eev "eev-browse-url.el" "brep")
+
+;; «ee-find-psne-echo-options»  (to ".ee-find-psne-echo-options")
+;; See: (find-windows-beginner-intro "5.6.1. Echo in Eshell")
+(defun ee-find-psne-echo-options ()
+  (if (eq system-type 'windows-nt) "-N" ""))
+
 
 
 

Reply via email to