[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eev c8cd18f: Added `eepitch-ansiterm' and `eepitch-pwsh
From: |
ELPA Syncer |
Subject: |
[elpa] externals/eev c8cd18f: Added `eepitch-ansiterm' and `eepitch-pwsh'. |
Date: |
Tue, 5 Oct 2021 01:57:15 -0400 (EDT) |
branch: externals/eev
commit c8cd18f1a8fb31c5ac7f471fa840c65ffc8c3a89
Author: Eduardo Ochs <eduardoochs@gmail.com>
Commit: Eduardo Ochs <eduardoochs@gmail.com>
Added `eepitch-ansiterm' and `eepitch-pwsh'.
---
ChangeLog | 33 +++++++++++++++
VERSION | 4 +-
eepitch.el | 128 ++++++++++++++++++++++++++++++++++++++++++---------------
eev-elinks.el | 7 +++-
eev-hlinks.el | 2 +-
eev-intro.el | 92 ++++++++++++++++++++++++++++++++++++++++-
eev-pdflike.el | 21 ++++++----
eev-plinks.el | 67 +++++++++++++++---------------
eev.el | 2 +-
9 files changed, 279 insertions(+), 77 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 9d241c4..f2aacad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,38 @@
+2021-10-05 Eduardo Ochs <eduardoochs@gmail.com>
+
+ * eepitch.el (find-vtermprocess, eepitch-vterm): rewritten.
+ Beware: their arguments are different now!
+ (eepitch-ansiterm, eepitch-line-ansiterm)
+ (find-ansitermprocess, eepitch-pwsh)
+ (eepitch-pwsh2): new functions.
+
+2021-10-04 Eduardo Ochs <eduardoochs@gmail.com>
+
+ * eev-plinks.el (find-urlretrieve00): rewritten.
+ (ee-urlretrieve-3, find-urlretrieve0, find-urlretrieve): deleted.
+ (ee-urlretrieve-headers): new variable.
+ (find-urlretrieve00, ee-urlretrieve0): new functions.
+
+2021-10-03 Eduardo Ochs <eduardoochs@gmail.com>
+
+ * eev-pdflike.el (ee-fname-page-to-url): if the argument FNAME is
+ already a URL then don't try to convert it to a URL again.
+
2021-10-02 Eduardo Ochs <eduardoochs@gmail.com>
+ * eev-elinks.el (ee-find-epackage-pkg-to-c): new function.
+ (ee-find-epackage-links0): use `ee-find-epackage-pkg-to-c'.
+ (find-epackage-links): use `ee-find-epackage-pkg-to-c'.
+
+ * eev-hlinks.el (ee-find-epackage-links): small fixes.
+
+ * eev-elinks.el (find-color-links): renamed to
+ `find-ecolor-links'. There were some references to
+ `find-color-links' and some to `find-ecolor-links' in the code; I
+ think that the `find-color-links's were typos.
+ (ee-color-choose-tk): use the file /tmp/ee.tcl instead of
+ ~/.eev/ee.tcl.
+
* eev-tlinks.el (find-angg-es-links): new function.
2021-10-01 Eduardo Ochs <eduardoochs@gmail.com>
diff --git a/VERSION b/VERSION
index 83f5c45..954fb8f 100644
--- a/VERSION
+++ b/VERSION
@@ -1,2 +1,2 @@
-Sat Oct 2 07:01:10 GMT 2021
-Sat Oct 2 04:01:10 -03 2021
+Tue Oct 5 05:12:21 GMT 2021
+Tue Oct 5 02:12:21 -03 2021
diff --git a/eepitch.el b/eepitch.el
index 6ada652..ca9fa8b 100644
--- a/eepitch.el
+++ b/eepitch.el
@@ -19,7 +19,7 @@
;;
;; Author: Eduardo Ochs <eduardoochs@gmail.com>
;; Maintainer: Eduardo Ochs <eduardoochs@gmail.com>
-;; Version: 20210913
+;; Version: 20211005
;; Keywords: e-scripts
;;
;; Latest version: <http://angg.twu.net/eev-current/eepitch.el>
@@ -44,7 +44,10 @@
;; «.set-glyphs» (to "set-glyphs")
;; «.set-keys» (to "set-keys")
;;
-;; «.eepitch-vterm» (to "eepitch-vterm")
+;; «.other-terms» (to "other-terms")
+;; «.eepitch-ansiterm» (to "eepitch-ansiterm")
+;; «.eepitch-vterm» (to "eepitch-vterm")
+;;
;; «.eepitch-langs» (to "eepitch-langs")
;;; Commentary:
@@ -770,56 +773,115 @@ This is useful for for running processes that use pagers
like
+
;;; ___ _ _ _
;;; / _ \| |_| |__ ___ _ __ | |_ ___ _ __ _ __ ___ ___
;;; | | | | __| '_ \ / _ \ '__| | __/ _ \ '__| '_ ` _ \/ __|
;;; | |_| | |_| | | | __/ | | || __/ | | | | | | \__ \
;;; \___/ \__|_| |_|\___|_| \__\___|_| |_| |_| |_|___/
;;;
-;; «eepitch-vterm» (to ".eepitch-vterm")
+;; «other-terms» (to ".other-terms")
+;; All these functions use the same convention on their arguments:
+;;
+;; 1. the argument PROGRAM comes first, and when it is omitted it
+;; means that we should run the default shell;
+;;
+;; 2. the argument NAME0 comes second;
+;;
+;; 3. when the argument NAME0 is present the term buffer receives a
+;; name like "*vterm: NAME0*";
+;;
+;; 4. when PROGRAM is present but NAME is omitted the term buffer
+;; receives a name like "*vterm: PROGRAM*";
+;;
+;; 5. when both arguments are omitted the term buffer receives a
+;; name like "*vterm*" or "*ansi-term*".
+;;
+;; Note that these conventions are different from the ones that
+;; `find-comintprocess' uses.
-(defun find-vtermprocess (&optional name program)
- "This is like `find-comintprocess', but uses vterm.
-If NAME is given then the buffer name is \"*vterm: NAME*\"; if
-not, then it is just \"*vterm*\". If a buffer with that name
-already exists, then just visit it; if it doesn't exist then run
-vterm, asking it to create a buffer with that name and to run a
-vterm on it. If PROGRAM is given then ask vterm to run PROGRAM
-there instead of the default shell.\n
-This function is a prototype and will probably change."
+;; Tests:
+;; (find-ansitermprocess nil "DASH")
+;; (find-ansitermprocess "/bin/dash" "DASH")
+;; (find-ansitermprocess "/bin/dash")
+;; (find-ansitermprocess)
+;;
+(defun find-ansitermprocess (&optional program name0)
+ "See: (find-eev \"eepitch.el\" \"other-terms\")"
+ (let* ((name1 (or name0 program))
+ (name2 (if name1 (format "ansi-term: %s" name1) "ansi-term"))
+ (buffername (format "*%s*" name2)))
+ (if (get-buffer buffername)
+ (find-ebuffer buffername)
+ (ansi-term (or program shell-file-name) name2))))
+
+;; Tests:
+;; (find-vtermprocess nil "DASH")
+;; (find-vtermprocess "/bin/dash" "DASH")
+;; (find-vtermprocess "/bin/dash")
+;; (find-vtermprocess)
+;;
+(defun find-vtermprocess (&optional program name0)
+ "See: (find-eev \"eepitch.el\" \"other-terms\")"
(require 'vterm)
- (let ((buffername (if name (format "*vterm: %s*" name) "*vterm*"))
- (vterm-shell (or program vterm-shell)))
- (if (get-buffer buffername)
+ (let* ((name1 (or name0 program))
+ (name2 (if name1 (format "vterm: %s" name1) "vterm"))
+ (buffername (format "*%s*" name2))
+ (vterm-shell (or program vterm-shell)))
+ (if (get-buffer buffername)
(find-ebuffer buffername)
(vterm buffername))))
-(defun eepitch-vterm (&optional name program)
- "This is like `eepitch-comint', but using vterm instead of comint."
- (interactive)
- (prog1 (eepitch `(find-vtermprocess ,name ,program))
- (setq eepitch-line 'eepitch-line-vterm)))
-;; Thanks to Gabriele Bozzola for helping me with this.
+;; `eepitch-ansiterm' and `eepitch-vterm' use these variants of the
+;; original `eepitch-line'.
+;;
+(defun eepitch-line-ansiterm (line)
+ "Send LINE to the ansi-term buffer and run the key binding for RET there."
+ (eepitch-eval-at-target-window
+ '(progn (term-send-raw-string line) ; "type" the line
+ (term-send-raw-string "\r")))) ; then do a RET
+
(defun eepitch-line-vterm (line)
"Send LINE to the vterm buffer and run the key binding for RET there."
(eepitch-eval-at-target-window
'(progn (vterm-send-string line) ; "type" the line
(vterm-send-return)))) ; then do a RET
+
+;; «eepitch-ansiterm» (to ".eepitch-ansiterm")
;; Tests:
-;; (find-vterm-name-program)
-;; (find-vterm-name-program "shell 2")
-;; (find-vterm-name-program "julia" "julia")
-;; (find-vterm-name-program "julia 2" "julia")
-;; (eepitch-vterm)
-;; (eepitch-vterm "shell 2")
-;; (eepitch-vterm "julia" "julia")
-;; (eepitch-vterm "julia 2" "julia")
-;; (eepitch-vterm "top" "top")
-;; (defun eepitch-julia () (interactive) (eepitch-vterm "julia" "julia"))
-;; (defun eepitch-julia2 () (interactive) (eepitch-vterm "julia 2" "julia"))
+;; (eepitch-ansiterm nil "DASH")
+;; (eepitch-ansiterm "/bin/dash" "DASH")
+;; (eepitch-ansiterm "/bin/dash")
+;; (eepitch-ansiterm)
+;; (eepitch-line "echo $(tput setaf 1)Hello$(tput setaf 0)")
+;;
+(defun eepitch-ansiterm (&optional program name0)
+ "This is like `eepitch-comint', but using ansi-term instead of comint.
+It uses `eepitch-line-ansiterm' instead of `eepitch-line'.
+The arguments are explained here:
+ (find-eev \"eepitch.el\" \"other-terms\")"
+ (interactive)
+ (prog1 (eepitch `(find-vtermprocess ,program ,name0))
+ (setq eepitch-line 'eepitch-line-vterm)))
+;; «eepitch-vterm» (to ".eepitch-vterm")
+;; Tests:
+;; (eepitch-vterm nil "DASH")
+;; (eepitch-vterm "/bin/dash" "DASH")
+;; (eepitch-vterm "/bin/dash")
+;; (eepitch-vterm)
+;; (eepitch-line "echo $(tput setaf 1)Hello$(tput setaf 0)")
+;;
+(defun eepitch-vterm (&optional program name0)
+ "This is like `eepitch-comint', but using vterm instead of comint.
+It uses `eepitch-line-vterm' instead of `eepitch-line'.
+The arguments are explained here:
+ (find-eev \"eepitch.el\" \"other-terms\")"
+ (interactive)
+ (prog1 (eepitch `(find-vtermprocess ,program ,name0))
+ (setq eepitch-line 'eepitch-line-vterm)))
@@ -845,6 +907,8 @@ This function is a prototype and will probably change."
(defun eepitch-tcsh () (interactive) (eepitch-comint "tcsh" "tcsh"))
(defun eepitch-zsh () (interactive) (eepitch-comint-de "zsh" "zsh"))
(defun eepitch-scsh () (interactive) (eepitch-comint "scsh" "scsh"))
+(defun eepitch-pwsh () (interactive) (eepitch-ansiterm "pwsh" "pwsh"))
+(defun eepitch-pwsh2 () (interactive) (eepitch-ansiterm "pwsh" "pwsh 2"))
;; Main interpreted languages:
(defun eepitch-lua51 () (interactive) (eepitch-comint "lua51" "lua5.1"))
diff --git a/eev-elinks.el b/eev-elinks.el
index feaa7b4..b0360ae 100644
--- a/eev-elinks.el
+++ b/eev-elinks.el
@@ -1210,7 +1210,7 @@ PKG must be a symbol; C and D are arguments for
`code-c-d'.
If D is t then try to use `ee-package-dir' to get the directory."
(interactive (list (symbol-at-point)))
(setq pkg (or pkg '{pkg}))
- (setq c (or c (replace-regexp-in-string "[-]" "" (symbol-name pkg))))
+ (setq c (or c (ee-find-epackage-pkg-to-c pkg)))
(setq d (cond ((eq d t) (ee-package-dir pkg))
((eq d nil) "{d}")
(t d)))
@@ -1228,6 +1228,7 @@ If D is t then try to use `ee-package-dir' to get the
directory."
(defun ee-find-epackage-links0 (pkg c d)
"This is an internal function used by `find-epackage-links'."
+ (setq c (or c (ee-find-epackage-pkg-to-c pkg)))
(let* ((spkg (format "\n %s " pkg))
(findelpafiles0 (ee-package-findelpafiles pkg))
(findelpafiles1 (reverse findelpafiles0))
@@ -1252,6 +1253,10 @@ If D is t then try to use `ee-package-dir' to get the
directory."
# http://melpa.org/#/{pkg}
")))
+(defun ee-find-epackage-pkg-to-c (pkg)
+ "Convert PKG (a symbol) to a \"c\" for a `code-c-d'."
+ (replace-regexp-in-string "[-]" "" (symbol-name pkg)))
+
;; Tests: (find-fline ee-elpadir)
diff --git a/eev-hlinks.el b/eev-hlinks.el
index 4b3ddd4..916b3c2 100644
--- a/eev-hlinks.el
+++ b/eev-hlinks.el
@@ -276,7 +276,7 @@
(ee-buffer-help ee-epackage-re-27 1)))
(defun ee-find-epackage-links ()
(let ((p (ee-epackage-bufferp)))
- (list (ee-find-epackage-links0 p "{c}" "{d}"))))
+ (list (ee-find-epackage-links0 p nil "{d}"))))
;; By buffer name (when the mode is man)
(defvar ee-man-re "^\\*Man \\(.*\\)\\*$")
diff --git a/eev-intro.el b/eev-intro.el
index 622c96d..656ed5a 100644
--- a/eev-intro.el
+++ b/eev-intro.el
@@ -12722,7 +12722,97 @@ As an exercise, try to give these commands to the
Windows shell:
-6. Lua
+
+
+
+
+6. Eepitch on Windows
+=====================
+The main tutorial of eev explains the best way to use shells from
+Emacs in this section:
+
+ (find-eev-quick-intro \"6. Controlling shell-like programs\")
+
+The default shell on Windows is a very bad one - cmd.exe, that we
+saw in section 5.5 - and by default `eepitch-shell' uses cmd.exe.
+One alternative is to use Eshell:
+
+ (find-node \"(eshell)Top\")
+
+Most people who use Windows have very little experience with
+shells, and I am trying to use eev to create tutorials to save
+them...
+
+ This is a project that is still in a VERY early stage!!!
+ I will describe its current state, and I will end this
+ section with a \"please test this and get in touch!\".
+
+I am preparing a one-session workshop for Windows users that
+should happen in the middle of oct/2021. Most of my material
+about it is in Portuguese, but In 2021oct03 I sent these two
+e-mails to the help-gnu-emacs mailing list, in which I explained
+it in English and asked for help:
+
+ https://lists.gnu.org/archive/html/help-gnu-emacs/2021-10/msg00037.html
+ https://lists.gnu.org/archive/html/help-gnu-emacs/2021-10/msg00045.html
+
+Many features in eev require a program called wget, and I need to
+prepare instructions for installing wget that can be executed by
+people who have never used a terminal or a shell in their lives.
+I _have the impression_ that it will be better to use PowerShell
+for that. The Wikipedia page about PowerShell is here:
+
+ https://en.wikipedia.org/wiki/PowerShell
+
+It seems that every recent version of Windows comes with
+PowerShell, and it seems that one of the ways of running
+PowerShell is to open a terminal and run the command \"pwsh\" in
+it... [please, people, can you test this and tell me if it works?]
+
+In 2021oct04 I added support for PowerShell to eev, but I was
+only able to test it on Linux, using a version of PowerShell that
+runs on Linux...
+
+
+
+6.1. `eepitch-pwsh': a test
+---------------------------
+Please, people, can you test the eepitch block below with <f8>s
+and tell me if you get something similar to what I got in this
+screenshot?
+
+Link to the screenshot:
+
+ http://angg.twu.net/2021.1-projeto/eepitch-pwsh.png
+
+Here is the eepitch block:
+
+ (eepitch-pwsh)
+ (eepitch-kill)
+ (eepitch-pwsh)
+mkdir -p ~/bin/
+cd ~/bin/
+rm -fv ~/bin/wget.exe
+wget http://angg.twu.net/2021.1-projeto/wget.exe
+ls -l wget.exe
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+7. Lua
======
Lua is a programming language that many people - like me - find
much better and much simpler than Python. The examples of
diff --git a/eev-pdflike.el b/eev-pdflike.el
index 4945aac..8b2c1d5 100644
--- a/eev-pdflike.el
+++ b/eev-pdflike.el
@@ -19,7 +19,7 @@
;;
;; Author: Eduardo Ochs <eduardoochs@gmail.com>
;; Maintainer: Eduardo Ochs <eduardoochs@gmail.com>
-;; Version: 20210925
+;; Version: 20211003
;; Keywords: e-scripts
;;
;; Latest version: <http://angg.twu.net/eev-current/eev-pdflike.el>
@@ -947,14 +947,21 @@ may want to put here code that cleans up that page
information.")
;; See: (find-efunction 'ee-fname-to-url)
;; Tests: (ee-fname-page-to-url "~/Coetzee99.pdf")
-;; (ee-fname-page-to-url "~/Coetzee99.pdf" 3)
+;; (ee-fname-page-to-url "~/Coetzee99.pdf" 4)
+;; (ee-fname-page-to-url "$S/http/foo/bar/Coetzee99.pdf" 4)
+;; (ee-fname-page-to-url "file:///home/edrx/Coetzee99.pdf" 4)
+;; (ee-fname-page-to-url "https://foo/bar/Coetzee99.pdf" 4)
+;; (ee-fname-page-to-url "http://foo/bar/Coetzee99.pdf" 4)
;;
(defun ee-fname-page-to-url (fname &optional page)
- "Convert a filename to a \"file://\" url (after running `ee-expand' on it).
-If the argument PAGE is non-nil append a \"#page=nnn\" to the result."
- (format "file://%s%s"
- (expand-file-name (ee-expand fname))
- (if page (format "#page=%s" page) "")))
+ "Convert FNAME to a \"file://\" url (after running `ee-expand' on it).
+If FNAME is already a url then don't convert it.
+If PAGE is non-nil append a \"#page=nnn\" to the result."
+ (let ((baseurl (if (string-match "^\\(https?\\|file\\)://" fname)
+ fname
+ (format "file://%s" (ee-expand fname))))
+ (pagestr (if page (format "#page=%s" page) "")))
+ (concat baseurl pagestr)))
(defun ee-find-firefox-page (fname &optional page)
`("firefox" ,(ee-fname-page-to-url fname page)))
diff --git a/eev-plinks.el b/eev-plinks.el
index 5cc56d1..0c1a4dc 100644
--- a/eev-plinks.el
+++ b/eev-plinks.el
@@ -19,7 +19,7 @@
;;
;; Author: Eduardo Ochs <eduardoochs@gmail.com>
;; Maintainer: Eduardo Ochs <eduardoochs@gmail.com>
-;; Version: 20210807
+;; Version: 20211004
;; Keywords: e-scripts
;;
;; Latest version: <http://angg.twu.net/eev-current/eev-plinks.el>
@@ -256,37 +256,40 @@
;;; \__,_|_| |_| |_| \___|\__|_| |_|\___| \_/ \___|
;;;
;; «find-urlretrieve» (to ".find-urlretrieve")
-;; See: (find-node "(url)Retrieving URLs" "url-retrieve-synchronously")
-;; Tests: http://angg.twu.net/e/emacs.e.html#find-urlretrieve
-;; (find-es "emacs" "find-urlretrieve")
-;;
-(defun find-urlretrieve00 (url &rest pos-spec-list)
- "Download URL with `url-retrieve-synchronously'. Show the full response."
- (apply 'find-ebuffer (url-retrieve-synchronously url) pos-spec-list))
-
-(defun ee-urlretrieve-3 (url)
- "Download URL with `url-retrieve-synchronously'. Return status, headers,
body."
- (find-urlretrieve00 url 1 "\n\n")
- (let* ((header (buffer-substring 1 (- (point) 1)))
- (body (buffer-substring (point) (point-max)))
- (status (replace-regexp-in-string "\n.*" "" header)))
- (ee-kill-this-buffer)
- (list status header body)))
-
-(defun find-urlretrieve0 (url)
- "Download URL with `url-retrieve-synchronously'. Return body as a raw
string."
- (let* ((shb (ee-urlretrieve-3 url))
- (status (nth 0 shb))
- (body (nth 2 shb)))
- (if (equal status "HTTP/1.1 200 OK")
- body
- (error "%s -> %s" url status))))
-
-(defun find-urlretrieve (url &rest pos-spec-list)
- "Download URL with `url-retrieve-synchronously'.
-TODO: detect the encoding!!!"
- (let ((ee-buffer-name url))
- (apply 'find-estring (find-urlretrieve0 url) pos-spec-list)))
+;; See: http://angg.twu.net/elisp/url-retrieve-test.el
+;; (find-angg "elisp/url-retrieve-test.el")
+;; Tests:
+;; (find-urlretrieve00 "http://foo/bar")
+;; (find-urlretrieve00 "http://angg.twu.net/")
+;; (find-urlretrieve00 "http://angg.twu.net/doesnotexist")
+;; (find-estring (ee-urlretrieve0 "http://angg.twu.net/"))
+;; (find-estring (ee-urlretrieve0 "http://angg.twu.net/doesnotexist"))
+;;
+(defvar ee-urlretrieve-headers ""
+ "The HTTP headers returned by the last call to `find-urlretrieve'.")
+
+(defun find-urlretrieve00 (url)
+ "An internal function used by `find-urlretrieve'."
+ (find-ebuffer
+ (url-retrieve-synchronously url 'silent 'inhibit-cookies)
+ "\n\n"))
+
+(defun ee-urlretrieve0 (url)
+ "Use `url-retrieve-synchronously' to download URL.
+When `url-retrieve-synchronously' is used for http or http it
+returns a buffer containing the response headers, then a blank
+line, then the contents (the \"message body\"). This function
+saves the response headers in the variable
+`ee-urlretrieve-headers', returns the message body, and deletes
+the buffer.\n
+This function doesn't perform any error checking and is as
+simplistic as possible. Use it only to experiment with
+`url-retrieve-synchronously'."
+ (find-urlretrieve00 url)
+ (setq ee-urlretrieve-headers
+ (buffer-substring (point-min) (- (point) 2)))
+ (prog1 (buffer-substring (point) (point-max))
+ (kill-buffer (current-buffer))))
diff --git a/eev.el b/eev.el
index 4a2f67b..d90c840 100644
--- a/eev.el
+++ b/eev.el
@@ -6,7 +6,7 @@
;; Package-Requires: ((emacs "24.4"))
;; Keywords: lisp e-scripts
;; URL: http://angg.twu.net/#eev
-;; Version: 20211002
+;; Version: 20211005
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/eev c8cd18f: Added `eepitch-ansiterm' and `eepitch-pwsh'.,
ELPA Syncer <=