branch: externals/eev commit 09d732986e3589d114579d7c643eafdb5017378d Author: Eduardo Ochs <eduardoo...@gmail.com> Commit: Eduardo Ochs <eduardoo...@gmail.com>
Added `(find-git-intro)' and `(find-texlive-links)'. --- ChangeLog | 17 ++++ VERSION | 4 +- eev-brxxx.el | 112 ++++++++++++++++-------- eev-elinks.el | 146 ++++++++++++++++++------------- eev-hlinks.el | 2 +- eev-intro.el | 256 +++++++++++++++++++++++++++++++++++++++++++++++++----- eev-testblocks.el | 2 +- eev-tlinks.el | 227 ++++++++++++++++++++++++----------------------- eev.el | 2 +- 9 files changed, 529 insertions(+), 239 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7ab38bf..7d8ee38 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2020-10-13 Eduardo Ochs <eduardoo...@gmail.com> + + * eev-intro.el (find-git-intro): new function. + + * eev-tlinks.el (find-texlive-links): new function. + (find-pdflikedef-links): deleted. + (find-find-links-links): marked (informally) as obsolete. + (find-find-links-links-old): new alias. + (find-psne-links): use "wget -nc" by default. + + * eev-brxxx.el: rewrote the comments in the beginning of the file. + +2020-10-12 Eduardo Ochs <eduardoo...@gmail.com> + + * eev-elinks.el (find-pdflike-page-links): rewrote using + `find-find-links-links-new'. + 2020-10-10 Eduardo Ochs <eduardoo...@gmail.com> * eev-testblocks.el (ee-insert-test-tuareg-mode): new function. diff --git a/VERSION b/VERSION index 2d27046..7a09630 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -Sat Oct 10 07:04:21 GMT 2020 -Sat Oct 10 04:04:21 -03 2020 +Tue Oct 13 08:14:43 GMT 2020 +Tue Oct 13 05:14:43 -03 2020 diff --git a/eev-brxxx.el b/eev-brxxx.el index b091731..7d72d6a 100644 --- a/eev-brxxx.el +++ b/eev-brxxx.el @@ -19,7 +19,7 @@ ;; ;; Author: Eduardo Ochs <eduardoo...@gmail.com> ;; Maintainer: Eduardo Ochs <eduardoo...@gmail.com> -;; Version: 2019oct27 +;; Version: 2020oct12 ;; Keywords: e-scripts ;; ;; Latest version: <http://angg.twu.net/eev-current/eev-brxxx.el> @@ -34,47 +34,90 @@ ;;; Commentary: -;; See: (find-eev-quick-intro "3.1. Non-elisp hyperlinks") -;; (find-psne-intro "Local copies") -;; (find-brxxx-intro) +;; The section +;; +;; (find-eev-quick-intro "3.1. Non-elisp hyperlinks") +;; +;; of the main tutorial mentions the functions `brff' and `brg', that +;; are eev-ish variants of `browse-url'. They are explained in more +;; details here: +;; +;; (find-brxxx-intro) +;; +;; These `brxxx's are "mass-produced" by the functions `code-brurl' +;; and `code-brfile', that work similarly to `code-c-d'. Try these +;; tests to see the code that they generate: +;; +;; (find-code-brfile 'find-FOO :local 'brFOOL :dired 'brFOOD) +;; (find-code-brurl 'find-QUX :remote 'brQUX :local 'brQUXL :dired 'brQUXD) +;; +;; The first argument of `code-brurl' and `find-code-brurl' is the +;; name of a function that expects a URL; the first argument of +;; `code-brfile' and `find-code-brfile' is the name of a function that +;; expects a filename. The other arguments are pairs made of a keyword +;; and a name of a function to define. ;; -;; The main functions here are `code-brurl' and `code-brfile', that -;; lets us mass-define "brxxx functions" based on a given function -;; that expects urls - in the case of `code-brurl' - or on a function -;; that expects file names - in the case of `code-brfile'. +;; Here is a simple test. Let's define `find-FOO' as function that +;; expects a filename and displays it in the right window, and +;; `find-QUX' as a function that expects a URL and displays it in the +;; right window: ;; -;; Try these tests to see the kind of code that is generated: +;; (defun find-FOO (url) (find-2a nil '(find-estring url))) +;; (defun find-QUX (fname) (find-2a nil '(find-estring fname))) +;; (find-FOO "/tmp/a-filename") +;; (find-QUX "http://some/url") ;; -;; (find-code-brurl 'find-foo :remote 'brfoo :local 'brfool :dired 'brfood) -;; (find-code-brfile 'find-bar :local 'brbarl :dired 'brbard) +;; Now let's define the `brFOO*' and `brQUX*' functions: ;; -;; The functions `brfoo', `brfool' and `brbarl' operate on the -;; url-at-point, and the functions `brfood' and `brbard' operate on -;; the file at the current line and only work in dired mode. The -;; functions `brfool' and `brbarl' call `find-foo' and `find-bar' on -;; the _local copy_ of the url that they receive, like this: +;; (find-code-brfile 'find-FOO :local 'brFOOL :dired 'brFOOD) +;; (code-brfile 'find-FOO :local 'brFOOL :dired 'brFOOD) +;; (find-code-brurl 'find-QUX :remote 'brQUX :local 'brQUXL :dired 'brQUXD) +;; (code-brurl 'find-QUX :remote 'brQUX :local 'brQUXL :dired 'brQUXD) ;; -;; (brfool "http://some/url") -;; --> (find-foo (ee-url-to-local-url "http://some/url")) -;; --> (find-foo (concat "file://" (ee-expand "$S/http/some/url"))) +;; The function `brQUX', that was defined with `:remote', acts like +;; `browse-url', but using `find-QUX' as its "browser": it calls +;; `find-QUX' on a "remote" URL. ;; -;; (brbarl "http://some/url") -;; --> (find-bar (ee-url-to-fname "http://some/url")) -;; --> (find-bar (ee-expand "$S/http/some/url")) +;; The functions `brFOOL' and `brQUXL', that were defined with +;; `:local', act on a "local copy" of the URL, in the sense of: ;; -;; Try the sexps above with: +;; (find-psne-intro "1. Local copies of files from the internet") ;; -;; (defun find-foo (url) (find-2a nil '(find-estring url))) -;; (defun find-bar (fname) (find-2a nil '(find-estring fname))) -;; (code-brurl 'find-foo :remote 'brfoo :local 'brfool :dired 'brfood) -;; (code-brfile 'find-bar :local 'brbarl :dired 'brbard) +;; You can try them either by typing `M-x brFOOL' and `M-x brQUXL' on +;; the URLs below or by running the sexps with `M-e'. Their action is +;; to show on the right window the argument that was passed to +;; `find-FOO' and `find-QUX': ;; -;; The idea of local copies is explained here: +;; (brFOOL "http://some/url") +;; (brQUXL "http://some/url") +;; +;; that are that URL converted to a local file name in the first case, +;; and that URL converted to a "file:///" URL corresponding that local +;; file name in the second case. More precisely, what happens is: ;; -;; (find-psne-intro "Local copies") +;; (brFOOL "http://some/url") +;; --> (find-FOO (ee-url-to-fname "http://some/url")) +;; --> (find-FOO (ee-expand "$S/http/some/url")) ;; +;; (brQUXL "http://some/url") +;; --> (find-QUX (ee-url-to-local-url "http://some/url")) +;; --> (find-QUX (concat "file://" (ee-expand "$S/http/some/url"))) ;; +;; The functions `brFOOD' and `brQUXD' are intended to be called +;; interactively from dired mode. If you call them on a dired buffer +;; showing "/tmp/" and with the point on the line that shows a file +;; called "a-filename" their actions would be the same as the sexps +;; below: ;; +;; (brFOOL "/tmp/a-filename") +;; --> (find-FOO "/tmp/a-filename") +;; +;; (brQUXL "/tmp/a-filename") +;; --> (find-QUX (ee-fname-to-url "/tmp/a-filename")) +;; --> (find-QUX (concat "file://" "/tmp/a-filename")) +;; + + ;; This file, i.e.: (find-eev "eev-brxxx.el") ;; supersedes: (find-eev "eev-browse-url.el") ;; but eev-browse-url.el still has some nice comments that I would @@ -180,7 +223,7 @@ This should be made smarter - file:// urls should be returned unchanged." ;;; | (_| (_) | (_| | __/_____| |_) | | | |_| | | | | ;;; \___\___/ \__,_|\___| |_.__/|_| \__,_|_| |_| ;;; -;; (find-tail-call-links "brurl" "f") +;; Skel (broken): (find-tail-call-links "brurl" "f") ;; «code-brurl» (to ".code-brurl") ;; Test: (find-code-brurl 'find-foo :remote 'brfoo :local 'brfool :dired 'brfood) @@ -254,12 +297,11 @@ This should be made smarter - file:// urls should be returned unchanged." ;;; | (_| (_) | (_| | __/_____| |_) | | | _| | | __/ ;;; \___\___/ \__,_|\___| |_.__/|_| |_| |_|_|\___| ;;; -;; (find-tail-call-links "brfile" "f") - ;; «code-brfile» (to ".code-brfile") -;; code-brfile: top-level functions +;; `code-brfile': top-level functions. ;; -;; Test: (find-code-brfile 'find-bar :local 'brbarl :dired 'brbard) +;; Skel (broken): (find-tail-call-links "brfile" "f") +;; 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" @@ -273,7 +315,7 @@ This should be made smarter - file:// urls should be returned unchanged." ") (ee-code-brfile-rest f rest))) ;; «ee-code-brfile-rest» (to ".ee-code-brfile-rest") -;; Support for extra arguments +;; `code-brfile': support for extra arguments. (defun ee-code-brfile-rest (f rest) (cond ((null rest) "") diff --git a/eev-elinks.el b/eev-elinks.el index e8e4c78..0f6dc06 100644 --- a/eev-elinks.el +++ b/eev-elinks.el @@ -19,7 +19,7 @@ ;; ;; Author: Eduardo Ochs <eduardoo...@gmail.com> ;; Maintainer: Eduardo Ochs <eduardoo...@gmail.com> -;; Version: 2020jul22 +;; Version: 2020oct11 ;; Keywords: e-scripts ;; ;; Latest version: <http://angg.twu.net/eev-current/eev-elinks.el> @@ -894,39 +894,36 @@ when this is true remove the prefix D from FNAME, and put the sexp ;;; | |_) | (_| | _| | | < __/_____| |_) | (_| | (_| | __/ ;;; | .__/ \__,_|_| |_|_|_|\_\___| | .__/ \__,_|\__, |\___| ;;; |_| |_| |___/ - +;; ;; «find-pdflike-page-links» (to ".find-pdflike-page-links") -;; (find-efunction 'count-lines) +;; The function `find-pdflike-page-links' is called from +;; `find-pdf-links' (`M-h M-p') when you call it in a buffer that is +;; not in dired mode. See: +;; (to "find-pdf-links") +;; (find-pdf-like-intro "10. Generating a pair with the page number") +;; (find-pdf-like-intro "11. How `M-h M-p' guesses everything") ;; -(defun ee-count-formfeeds (start end) - (save-excursion - (save-restriction - (narrow-to-region start end) - (goto-char (point-min)) - (save-match-data - (let ((done 0)) - (while (re-search-forward "[\f]" nil t 1) - (setq done (+ 1 done))) - done))))) - -(defun ee-current-page () - (+ 1 (ee-count-formfeeds (point-min) (point)))) - -(defun ee-last-kill () - (if (stringp (car kill-ring)) - (ee-no-properties (car kill-ring)))) - -(defun ee-region () - (if (region-active-p) - (buffer-substring-no-properties (point) (mark)))) - -(defun ee-region-or-last-kill () - (or (ee-region) (ee-last-kill))) - -;; Skel: (find-find-links-links-old "\\M-p" "pdflike-page" "page bufname offset") - -;; Moved to eev-mode.el: -;; (define-key eev-mode-map "\M-h\M-p" 'find-pdflike-page-links) +;; Skel: (find-find-links-links-new "pdflike-page" "page bufname offset" "") +;; +(defun find-pdflike-page-links (&optional page bufname offset &rest pos-spec-list) +"Visit a temporary buffer containing hyperlinks to a pdf-like document. +See: (find-pdf-like-intro) + (find-pdf-like-intro \"refining hyperlinks to pages\")" + (interactive) + (setq page (or page (ee-current-page))) + (setq bufname (or bufname (buffer-name))) + (setq offset (or offset ee-page-offset)) + (apply + 'find-elinks + `((find-pdflike-page-links ,page ,bufname ,offset ,@pos-spec-list) + ;; Convention: the first sexp always regenerates the buffer. + (find-pdf-like-intro "10. Generating a pair with the page number") + (find-pdf-like-intro "11. How `M-h M-p' guesses everything") + ;; (find-efunction 'find-pdflike-page-links) + "" + ,@(ee-pdflike-page-links page bufname offset) + ) + pos-spec-list)) (defun ee-pdflike-page-links (&optional page bufname offset) (setq page (or page (ee-current-page))) @@ -954,33 +951,37 @@ when this is true remove the prefix D from FNAME, and put the sexp ,(ee-HS bufname) ))) -(defun find-pdflike-page-links (&optional page bufname offset &rest rest) -"Visit a temporary buffer containing hyperlinks to a pdf-like document. -See: (find-pdf-like-intro) - (find-pdf-like-intro \"refining hyperlinks to pages\")" - (interactive) - (setq page (or page (ee-current-page))) - (setq bufname (or bufname (buffer-name))) - (setq offset (or offset ee-page-offset)) - (apply 'find-elinks `( - (find-pdflike-page-links ,page ,bufname ,offset ,@rest) - ;; (find-efunction 'find-pdflike-page-links) - ;; (find-eev-quick-intro "10.4. Generating short hyperlinks to PDFs") - ;; (find-eev-quick-intro "11.1. `find-pdf-links'") - (find-pdf-like-intro "10. Generating a pair with the page number") - (find-pdf-like-intro "11. How `M-h M-p' guesses everything") - "" - ,@(ee-pdflike-page-links page bufname offset) - ) rest)) +;; These are internal functions used by `find-pdflike-page-links' and +;; `ee-pdflike-page-links'. + +;; Based on: (find-efunction 'count-lines) +;; +(defun ee-count-formfeeds (start end) + (save-excursion + (save-restriction + (narrow-to-region start end) + (goto-char (point-min)) + (save-match-data + (let ((done 0)) + (while (re-search-forward "[\f]" nil t 1) + (setq done (+ 1 done))) + done))))) + +(defun ee-current-page () + (+ 1 (ee-count-formfeeds (point-min) (point)))) + +(defun ee-last-kill () + (if (stringp (car kill-ring)) + (ee-no-properties (car kill-ring)))) + +(defun ee-region () + (if (region-active-p) + (buffer-substring-no-properties (point) (mark)))) + +(defun ee-region-or-last-kill () + (or (ee-region) (ee-last-kill))) + -;; (find-pdflike-page-links) -;; (find-angg ".emacs.papers" "kopkadaly") -;; (code-pdftotext "kopkadaly4" "~/books/__comp/kopka_daly__a_guide_to_latex_4th_ed.pdf" 12) -;; (find-code-pdftotext "kopkadaly4" "~/books/__comp/kopka_daly__a_guide_to_latex_4th_ed.pdf" 12) -;; (ee-page-parameters "kopkadaly4" 12) -;; (find-kopkadaly4page (+ 12 287) "13.1 The picture environment") -;; (find-kopkadaly4text "13.1 The picture environment") -;; (find-kopkadaly4text) @@ -1252,10 +1253,8 @@ Convert PKG - a symbol - to a package-desc structure (or to nil)." ;;; |_| |_|_| |_|\__,_| \___\___/ \__,_|\___| \/ |_|_|_| |_|_|\_\___/ ;;; ;; «find-code-pdf-links» (to ".find-code-pdf-links") -;; Tests: -;; (find-fline "/usr/local/texlive/2018/texmf-dist/doc/latex/base/") -;; (find-code-pdf-links "/usr/local/texlive/2018/texmf-dist/doc/latex/base/source2e.pdf") -;; (find-code-pdf-links "/usr/local/texlive/2018/texmf-dist/doc/latex/base/source2e.pdf" "foo") +;; See: (to "find-pdf-links") +;; (find-pdf-like-intro "9. Generating three pairs" "find-code-pdf-links") ;; See: (find-efunction 'ee-if-prefixp) (defun ee-shorten-file-name (fname) @@ -1297,7 +1296,30 @@ Convert PKG - a symbol - to a package-desc structure (or to nil)." ) pos-spec-list))) + + ;; «find-pdf-links» (to ".find-pdf-links") +;; This function - usually bound to `M-h M-p' - behaves in one way +;; when invoked from dired buffers and in a totally different way when +;; invoked from other buffers. In a dired buffer it supposes that the +;; current line contains the name of a PDF, and it generates a buffer +;; whose main part is a pair `code-pdf-page'/`code-pdf-text' that lets +;; you define short hyperlinks to that PDF. See: +;; +;; (find-pdf-like-intro "7. Shorter hyperlinks to PDF files") +;; (find-pdf-like-intro "9. Generating three pairs" "`M-h M-p' in Dired mode") +;; +;; When the current buffer is not in dired mode this function supposes +;; that the buffer contains the "text" of a PDF, as explained here: +;; +;; (find-pdf-like-intro "3. Hyperlinks to PDF files" "find-pdf-text") +;; +;; and it tries to generate short hyperlinks to the current page of +;; it, making lots of guesses, and often guessing everything wrong. +;; See: +;; +;; (find-pdf-like-intro "10. Generating a pair with the page number") +;; (find-pdf-like-intro "11. How `M-h M-p' guesses everything") ;; (defun find-pdf-links () "Run either `find-code-pdf-links' or `find-pdflike-page-links'." diff --git a/eev-hlinks.el b/eev-hlinks.el index 30abc4a..cbe303a 100644 --- a/eev-hlinks.el +++ b/eev-hlinks.el @@ -275,7 +275,7 @@ (defun ee-epackage-bufferp () (ee-buffer-help ee-epackage-re 1)) (defun ee-find-epackage-links () (let ((p (ee-epackage-bufferp))) - (list (ee-find-epackage-links0 p)))) + (list (ee-find-epackage-links0 p "{c}" "{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 4aaf50f..08225fe 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: 2020oct04 +;; Version: 2020oct13 ;; Keywords: e-scripts ;; ;; Latest version: <http://angg.twu.net/eev-current/eev-intro.el> @@ -91,6 +91,7 @@ ;; «.find-emacs-intro» (to "find-emacs-intro") ;; «.find-org-intro» (to "find-org-intro") ;; «.find-escripts-intro» (to "find-escripts-intro") +;; «.find-git-intro» (to "find-git-intro") ;; «.find-windows-beginner-intro» (to "find-windows-beginner-intro") @@ -2149,9 +2150,9 @@ These are the current ways to download and install eev: links like these ones, http://elpa.gnu.org/packages/eev.html - http://elpa.gnu.org/packages/eev-20191003.tar + http://elpa.gnu.org/packages/eev-20201013.tar http://angg.twu.net/eev-current/ - http://angg.twu.net/eev-current/eev-20191003.tar + http://angg.twu.net/eev-current/eev-20201013.tar and then running `M-x package-install-file'; @@ -2461,31 +2462,31 @@ recommended reading order. These are the basic ones: 5. (find-pdf-like-intro) 6. (find-eepitch-intro) 7. (find-audiovideo-intro) - 8. (find-rcirc-intro) - 9. (find-elisp-intro) - 10. (find-eev-install-intro) + 8. (find-psne-intro) + 9. (find-rcirc-intro) + 10. (find-elisp-intro) + 11. (find-eev-install-intro) This is a very basic tutorial intended mainly for M$ Windows users: - 11. (find-windows-beginner-intro) + 12. (find-windows-beginner-intro) These ones explain ideas, conventions, and usage patterns: - 12. (find-escripts-intro) - 13. (find-links-conv-intro) + 13. (find-escripts-intro) + 14. (find-links-conv-intro) These are older and more technical versions of sections of the eev-quick-intro: - 14. (find-eval-intro) - 15. (find-links-intro) - 16. (find-brxxx-intro) - 17. (find-wrap-intro) - 18. (find-eejump-intro) - 19. (find-anchors-intro) - 20. (find-code-c-d-intro) - 21. (find-psne-intro) + 15. (find-eval-intro) + 16. (find-links-intro) + 17. (find-brxxx-intro) + 18. (find-wrap-intro) + 19. (find-eejump-intro) + 20. (find-anchors-intro) + 21. (find-code-c-d-intro) These are etcs: @@ -2493,21 +2494,22 @@ These are etcs: 23. (find-templates-intro) 24. (find-org-intro) 25. (find-videos-intro) + 26. (find-git-intro) These ones explain advanced features that require extra setup: - 26. (find-prepared-intro) - 27. (find-bounded-intro) - 28. (find-channels-intro) + 27. (find-prepared-intro) + 28. (find-bounded-intro) + 29. (find-channels-intro) This one is used in a video: - 29. (find-three-main-keys-intro) + 30. (find-three-main-keys-intro) These ones are obsolete: - 30. (find-emacs-intro) - 31. (find-defun-intro) + 31. (find-emacs-intro) + 32. (find-defun-intro) Item 25 is an index of old video tutorials, with scripts for downloading local copies of them and links to important positions @@ -6408,6 +6410,15 @@ short `find-pdf'-pair. To see what it produces, try: (find-code-pdf-links \"~/Coetzee99.pdf\") (find-code-pdf-links \"~/Coetzee99.pdf\" \"livesofanimals\") +The second link above produces a temporary buffer containing this: + + ;; (find-pdf-page \"~/Coetzee99.pdf\") + ;; (find-pdf-text \"~/Coetzee99.pdf\") + (code-pdf-page \"livesofanimals\" \"~/Coetzee99.pdf\") + (code-pdf-text \"livesofanimals\" \"~/Coetzee99.pdf\") + ;; (find-livesofanimalspage) + ;; (find-livesofanimalstext) + `find-code-pdf-links' is somewhat similar to `find-latex-links', in this aspect: @@ -6556,6 +6567,11 @@ and combines it with the idea of \"local copies\" from: (find-psne-intro \"1. Local copies of files from the internet\") (find-psne-intro \"5. `browse-url' and friends\") +At this moment the best explanation of these ideas in here: + (find-eev \"eev-brxxx.el\" \";;; Commentary:\") +in the source code. I need to rewrite this intro! + + @@ -9543,6 +9559,12 @@ This buffer is _temporary_ and _editable_. It is meant as both a tutorial and a sandbox. +This intro is being rewritten. +Prerequisites: + (find-psne-intro) + (find-audiovideo-intro) + + 1. What we have now =================== @@ -11108,6 +11130,194 @@ This can also be used to generate links to info nodes. +;;; ____ _ _ +;;; / ___(_) |_ +;;; | | _| | __| +;;; | |_| | | |_ +;;; \____|_|\__| +;;; +;; «find-git-intro» (to ".find-git-intro") +;; Skel: (find-intro-links "git") + +(defun find-git-intro (&rest pos-spec-list) (interactive) + (let ((ee-buffer-name "*(find-git-intro)*")) + (apply 'find-eintro "\ +\(Re)generate: (find-git-intro) +Source code: (find-efunction 'find-git-intro) +More intros: (find-eev-quick-intro) + (find-eev-intro) + (find-eepitch-intro) +This buffer is _temporary_ and _editable_. +It is meant as both a tutorial and a sandbox. + + + +At this moment this is a call for help - +not an intro. + + + + +0. Introduction +=============== +Git is extremely popular, and I've heard that the two packages +that attract most new users to Emacs are Org and Magit: + + https://github.com/magit/magit + https://melpa.org/#/magit + (find-epackage 'magit) + +At this moment eev offers only a trivial hack to help people +download git repositories. If you put the point on the github url +above and type `M-h g' or `M-x find-git-links' you will get the +same effect as running the sexp below: + + (find-git-links \"https://github.com/magit/magit\" \"magit\") + +You will get a temporary buffer with an e-script for downloading +(\"cloning\") that git repository and inspecting it in a handful +of ways. + +I found git VERY hard to learn. To test most concepts you need a +repository with tags and branches and a second repository that +\"pulls\" from it, and no books or tutorials that I know of come +with a sequence of commands that set that up in a way that makes +the tests easy to reproduce. To make things worse, when I was +trying to set up a git repository for eev on github for the first +time I did some things wrong on the github side of the repository +that I did not know how to undo... after spending some days +trying to fix that I gave up, deleted that repository, created a +new one, and decided that I would always do LOTS of local tests +before messing up my public repository again. + +This intro is about doing these local tests - but it is in a VERY +early draft. + + + + +1. Preparation +============== +Download the second URL below with `M-x brep', + + http://peepcode.com/products/git-internals-pdf + https://github.com/pluralsight/git-internals-pdf/releases/download/v2.0/peepcode-git.pdf + +and run this eepitch block, + + (eepitch-shell) + (eepitch-kill) + (eepitch-shell) + rm -Rfv /tmp/git-test/ + mkdir /tmp/git-test/ + cd /tmp/git-test/ + # http://angg.twu.net/bin/git-defs.html + wget http://angg.twu.net/bin/git-defs + cp -v $S/https/github.com/pluralsight/git-internals-pdf/releases/download/v2.0/peepcode-git.pdf . + +and this prog1: + + (prog1 + (code-pdf-page \"gitinternals\" \"/tmp/git-test/peepcode-git.pdf\") + (code-pdf-text \"gitinternals\" \"/tmp/git-test/peepcode-git.pdf\") + (code-c-d \"gitdoc\" \"/usr/share/doc/git-doc/\") + ) + + + + +2. A first repository +===================== +The manpage of git-revisions + + (find-man \"7 git-revisions\") + (find-man \"7 git-revisions\" \"Here is an illustration\") + (find-gitdocfile \"revisions.txt\" \"illustration, by Jon Loeliger\") + +has this example, in which the commits have this structure: + + G H I J + \\ / \\ / + D E F + \\ | / \\ + \\ | / | + \\|/ | + B C + \\ / + \\ / + A + +Here is an e-script that creates it: + + (eepitch-shell) + (eepitch-kill) + (eepitch-shell) + rm -Rfv /tmp/git-test/repo1/ + mkdir /tmp/git-test/repo1/ + cd /tmp/git-test/repo1/ + . /tmp/git-test/git-defs + # (find-fline \"/tmp/git-test/git-defs\") + + git init + Modify file1; Modify file2; git add file1 file2 + Commit A; git branch brAC + Modify file1; Commit B; git branch brBDG + git checkout brAC + Modify file1; Commit C + git checkout brBDG + Modify file1; Commit D + git checkout HEAD^ -b brE + Modify file1; Commit E + git checkout HEAD^ + git merge -s ours brAC -m F + git branch brFI + git checkout brBDG + Modify file1; Commit G + git checkout HEAD^ -b brH + Modify file1; Commit H + git checkout brFI + Modify file1; Commit I + git checkout HEAD^ -b brJ + Modify file1; Commit J + Diagram + + # (find-gitk \"/tmp/git-test/repo1/\") + +Actually it creates the structure below - where, for example, the +node \"G,brBDG\" is a commit with message \"G\" and a branch +called \"brBDG\" pointing to it; I call that branch \"brBDG\" +because when it was created it pointed to the commit with message +\"B\", then it moved to the commit \"D\", then to \"G\". + + I,brFI J,brJ + | / + G,brBDG H,brH | / + \\ / | / + D E,brE F + \\ | / \\ + \\ | / | + \\ | / | + B C,brAC + \\ / + \\ / + A + + (find-man \"git-merge\") + + + + + + + +" pos-spec-list))) + +;; (find-git-intro) + + + + + ;;; __ ___ _ _ ;;; \ \ / / | | |__ ___ __ _(_)_ __ _ __ ___ _ __ diff --git a/eev-testblocks.el b/eev-testblocks.el index 892e6bc..cff3d9c 100644 --- a/eev-testblocks.el +++ b/eev-testblocks.el @@ -19,7 +19,7 @@ ;; ;; Author: Eduardo Ochs <eduardoo...@gmail.com> ;; Maintainer: Eduardo Ochs <eduardoo...@gmail.com> -;; Version: 2020aug05 +;; Version: 2020oct10 ;; Keywords: e-scripts ;; ;; Latest version: <http://angg.twu.net/eev-current/eev-testblocks.el> diff --git a/eev-tlinks.el b/eev-tlinks.el index 7ce02d2..71fc0f0 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: 2020oct06 +;; Version: 2020oct13 ;; Keywords: e-scripts ;; ;; Latest version: <http://angg.twu.net/eev-current/eev-tlinks.el> @@ -58,11 +58,10 @@ ;; «.ee-copy-rest» (to "ee-copy-rest") ;; ;; «.find-find-links-links» (to "find-find-links-links") -;; «.ee-ffll-functions» (to "ee-ffll-functions") ;; «.find-find-links-links-new» (to "find-find-links-links-new") +;; «.ee-ffll-functions» (to "ee-ffll-functions") ;; ;; «.find-intro-links» (to "find-intro-links") -;; «.find-pdflikedef-links» (to "find-pdflikedef-links") ;; «.find-eev-header-links» (to "find-eev-header-links") ;; ;; «.find-debpkg-links» (to "find-debpkg-links") @@ -82,6 +81,7 @@ ;; «.find-extra-file-links» (to "find-extra-file-links") ;; «.find-emacs-tangents-links» (to "find-emacs-tangents-links") ;; «.find-eeit-links» (to "find-eeit-links") +;; «.find-texlive-links» (to "find-texlive-links") (require 'eev-env) @@ -214,8 +214,9 @@ See: (find-eev \"eev-tlinks.el\" \"ee-copy-rest\")" ;;; ;; ;; «find-find-links-links» (to ".find-find-links-links") -;; See: (find-templates-intro "horrible" "kludge") ;; Test: (find-find-links-links "u" "find-links" "k stem args") +;; THIS IS OBSOLETE - DON'T USE THIS! +;; Use `find-find-links-links-new' instead. (defun ee-prepend-commas (str) (save-match-data @@ -225,6 +226,8 @@ See: (find-eev \"eev-tlinks.el\" \"ee-copy-rest\")" (defun ee-if-nil-setqs (vars sep) (mapconcat 'ee-if-nil-setq (save-match-data (ee-split vars)) sep)) +(defalias 'find-find-links-links-old 'find-find-links-links) + (defun find-find-links-links (&optional k stem args &rest pos-spec-list) "Visit a temporary buffer containing hyperlinks for foo." (interactive) @@ -275,6 +278,40 @@ This is an internal function used by `find-{stem}-links'.\" + +;;; __ _ _ _ _ _ /\ ____ +;;; / _(_)_ __ __| | | (_)_ __ | | ____|/\|___ \ _ __ _____ __ +;;; | |_| | '_ \ / _` |_____| | | '_ \| |/ / __| __) |____| '_ \ / _ \ \ /\ / / +;;; | _| | | | | (_| |_____| | | | | | <\__ \ / __/_____| | | | __/\ V V / +;;; |_| |_|_| |_|\__,_| |_|_|_| |_|_|\_\___/ |_____| |_| |_|\___| \_/\_/ +;;; +;; «find-find-links-links-new» (to ".find-find-links-links-new") +;; Test: (find-find-links-links-new) +;; Many of the templated functions of eev were written using this. +;; They all have a line saying ";; Skel:" that generates their "skeleton". +;; See: (find-eevgrep "grep --color -nH --null -e Skel: *.el") +;; +(defun find-find-links-links-new (&optional stem args vars &rest pos-spec-list) +"Visit a temporary buffer containing a skeleton of a find-*-links function." + (interactive) + (setq stem (or stem "{stem}")) + (setq args (or args "{args}")) + (setq vars (or vars "{vars}")) + (apply 'find-elinks-elisp + `((find-find-links-links-new ,stem ,args ,vars ,@pos-spec-list) + (find-find-links-links-new "mytask" "foo bar" "" ,@pos-spec-list) + (find-find-links-links-new "mytask" "foo bar" "plic bletch" ,@pos-spec-list) + ;; Convention: the first sexp always regenerates the buffer. + (find-efunction 'find-find-links-links-new) + "" + ,(ee-template0 ";; <find-{stem}-links>") + ,(concat ";; Skel: " (ee-S `(find-find-links-links-new ,stem ,args ,vars))) + ";;" + ,(ee-ffll-defun stem args vars) + ) + pos-spec-list)) + + ;;; __ __ _ _ _ ;;; ___ ___ / _|/ _| | | | __/\__ ;;; / _ \/ _ \_____| |_| |_| | | |_____\ / @@ -284,15 +321,6 @@ This is an internal function used by `find-{stem}-links'.\" ;; «ee-ffll-functions» (to ".ee-ffll-functions") ;; Low-level functions used by find-find-links-links-new. ;; -;; The original `find-find-links-links' whas a horrible kludge. -;; See: (find-templates-intro "horrible" "kludge") -;; This is an attempt to rewrite it. -;; It was inspired by discussions with Marc Simpson. -;; Version (of the ee-ffll-functions and find-find-links-links-new): -;; 2020jan07. -;; Status: `find-find-links-links-new' doesn't exist yet, but the -;; tests below work. - ;; Tests: ;; (ee-ffll-optional "") ;; (ee-ffll-optional "foo bar") @@ -378,29 +406,6 @@ This is an internal function used by `find-{stem}-links'.\" (ee-ffll-defun-without-lets stem args))) -;; «find-find-links-links-new» (to ".find-find-links-links-new") -;; Test: (find-find-links-links-new) -;; -(defun find-find-links-links-new (&optional stem args vars &rest pos-spec-list) -"Visit a temporary buffer containing a skeleton of a find-*-links function." - (interactive) - (setq stem (or stem "{stem}")) - (setq args (or args "{args}")) - (setq vars (or vars "{vars}")) - (apply 'find-elinks-elisp - `((find-find-links-links-new ,stem ,args ,vars ,@pos-spec-list) - (find-find-links-links-new "mytask" "foo bar" "" ,@pos-spec-list) - (find-find-links-links-new "mytask" "foo bar" "plic bletch" ,@pos-spec-list) - ;; Convention: the first sexp always regenerates the buffer. - (find-efunction 'find-find-links-links-new) - "" - ,(ee-template0 ";; <find-{stem}-links>") - ,(concat ";; Skel: " (ee-S `(find-find-links-links-new ,stem ,args ,vars))) - ";;" - ,(ee-ffll-defun stem args vars) - ) - pos-spec-list)) - @@ -466,82 +471,6 @@ Hello -;;; _ __ _ _ _ _ __ -;;; _ __ __| |/ _| (_) | _____ __| | ___ / _| -;;; | '_ \ / _` | |_| | | |/ / _ \/ _` |/ _ \ |_ -;;; | |_) | (_| | _| | | < __/ (_| | __/ _| -;;; | .__/ \__,_|_| |_|_|_|\_\___|\__,_|\___|_| -;;; |_| -;; -;; «find-pdflikedef-links» (to ".find-pdflikedef-links") -;; Obsolete! Was used in: (find-eev "eev-pdflike-old.el") -;; e.g. (find-eev "eev-pdflike-old.el" "defalias 'find-xdvipage") -;; (find-find-links-links "pdflikedef" "stem firstargs") -;; -(defun find-pdflikedef-links (&optional stem firstargs &rest rest) - "Visit a temporary buffer containing hyperlinks for pdflikedef." - (interactive) - (setq stem (or stem "{stem}")) - (setq firstargs (or firstargs "{firstargs}")) - (apply 'find-elinks-elisp `( - ;; Convention: the first sexp always regenerates the buffer. - (find-pdflikedef-links ,stem ,firstargs ,@rest) - (find-efunction 'find-pdflikedef-links) - (emacs-lisp-mode) - ;; Body: - "" - ,(ee-template0 "\ -;; (find-efunction 'code-{stem}) - -;; find-{stem}page -;; find-{stem}-page -;; code-{stem} -;; -\(defalias 'find-{stem}page - 'find-{stem}-page) -\(defun find-{stem}-page (fname &optional page &rest rest) - (find-bgprocess (ee-find-{stem}-page fname page))) -\(defvar ee-find-{stem}-page-options '()) -\(defun ee-find-{stem}-page (fname &optional page) - `(\"{stem}\" - ,@ee-find-{stem}-page-options - ,@(if page `(,(format \"--page=%d\" page))) - ,fname)) - -\(defun code-{stem} ({firstargs} &rest rest) - (eval (ee-read (apply 'ee-code-{stem} {firstargs} rest)))) -\(defun find-code-{stem} ({firstargs} &rest rest) - (find-estring-elisp (apply 'ee-code-{stem} {firstargs} rest))) -\(defun ee-code-{stem} ({firstargs} &rest rest) - (concat (ee-template0 \"\\ -\\(defun find-{<}c{>}page (&optional page &rest rest) - (find-{stem}-page {<}(ee-pp0 fname){>} page)) -{<}(ee-code-pdftext-rest rest){>} -\") (ee-code-pdftext-rest rest))) - -\(code-brfile 'find-xpdf-page :local 'brxpdfl :dired 'brxpdfl) - - -;; Tests: -;; (find-epp (ee-find-{stem}-page \"/tmp/foo.pdf\")) -;; (find-epp (ee-find-{stem}-page \"/tmp/foo.pdf\" 2)) -;; (find-{stem}-page \"/tmp/foo.pdf\") -;; (find-{stem}-page \"/tmp/foo.pdf\" 2) -;; -;; (find-code-{stem} \"foo\" \"/tmp/foo.pdf\") -;; (code-{stem} \"foo\" \"/tmp/foo.pdf\") -;; (find-foopage) -;; (find-foopage 2) -;; (code-pdftotext \"foo\" \"/tmp/foo.pdf\") -") - ) rest)) - -;; (find-pdflikedef-links "djvu" "c fname") -;; (find-efunctionpp 'find-pdflikedef-links) - - - - ;;; _ _ ;;; ___ _____ __ | |__ ___ __ _ __| | ___ _ __ ;;; / _ \/ _ \ \ / /____| '_ \ / _ \/ _` |/ _` |/ _ \ '__| @@ -1147,10 +1076,11 @@ cd {dir} "See: (find-psne-intro)" (interactive) (setq url (or url "{url}")) - (setq wget-options (or wget-options "")) + (setq wget-options (or wget-options "-nc")) (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) ;; Convention: the first sexp always regenerates the buffer. (find-efunction 'find-psne-links) "" @@ -1458,7 +1388,7 @@ Warning: the last one is in Portuguese..." (eepitch-shell2) mkdir -p $S/http/angg.twu.net/eev-videos/ cd $S/http/angg.twu.net/eev-videos/ -wget -c 'http://angg.twu.net/eev-videos/{anggstem}.mp4' +wget -nc 'http://angg.twu.net/eev-videos/{anggstem}.mp4' echo 'http://angg.twu.net/eev-videos/{anggstem}.mp4' >> ~/.psne.log # Test: @@ -1945,6 +1875,75 @@ dofile \\\"%s\\\" +;;; _____ __ ___ _ +;;; |_ _|__\ \/ / | (_)_ _____ +;;; | |/ _ \\ /| | | \ \ / / _ \ +;;; | | __// \| |___| |\ V / __/ +;;; |_|\___/_/\_\_____|_| \_/ \___| +;;; +;; «find-texlive-links» (to ".find-texlive-links") + +(defun find-texlive-links (&optional date &rest pos-spec-list) +"Visit a temporary buffer containing an e-script for installing texlive from upstream." + (interactive) + (setq date (or date "{date}")) + (apply 'find-elinks + `((find-texlive-links ,date ,@pos-spec-list) + ;; Convention: the first sexp always regenerates the buffer. + (find-texlive-links "20190809") + (find-efunction 'find-texlive-links) + "" + ,(ee-template0 "\ +# https://www.tug.org/texlive/ +# https://www.tug.org/texlive/acquire-netinstall.html +# https://www.tug.org/texlive/quickinstall.html +# http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz +# (find-fline \"$S/http/mirror.ctan.org/systems/texlive/tlnet/\") +# (find-fline \"$S/http/mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz\") +# https://www.tug.org/texlive/doc/install-tl.html +# (find-fline \"~/usrc/\" \"install-tl-\") +# (find-fline \"~/.texlive2018/\") +# (find-fline \"~/.texlive2019/\") +# (find-fline \"/usr/local/texlive/2018/\") +# (find-fline \"/usr/local/texlive/2019/\") +# (find-fline \"/usr/local/texlive/2019/\" \"install-tl.log\") +# (find-fline \"/usr/local/texlive/2019/release-texlive.txt\") + + (eepitch-shell2) + (eepitch-kill) + (eepitch-shell2) +# rm -rfv ~/.texlive2018/ +# sudo rm -rfv /usr/local/texlive/2018/ + +mkdir -p $S/http/mirror.ctan.org/systems/texlive/tlnet/ +cd $S/http/mirror.ctan.org/systems/texlive/tlnet/ +rm -fv $S/http/mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz +wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz +echo http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz >> ~/.psne.log +# (find-fline \"$S/http/mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz\") +# ^ Check the date here and adjust the {<}date{>} parameter of the template + +rm -Rfv ~/usrc/install-tl-{date}/ +mkdir ~/usrc/ +tar -C ~/usrc/ -xvzf \ + $S/http/mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz +cd ~/usrc/install-tl-{date}/ +# sudo ./install-tl +sudo ./install-tl -select-repository + +# (code-c-d \"tlinstall\" \"~/usrc/install-tl-{date}/\") +# (find-tlinstallfile \"\") +# (find-tlinstallfile \"install-tl.log\") +# (find-tlinstallfile \"install-tl\") +# https://www.tug.org/texlive/doc/install-tl.html + +") + ) + pos-spec-list)) + +;; Test: (find-texlive-links) + + diff --git a/eev.el b/eev.el index e1c3314..38f9902 100644 --- a/eev.el +++ b/eev.el @@ -6,7 +6,7 @@ ;; Package-Requires: ((emacs "24.1")) ;; Keywords: lisp e-scripts ;; URL: http://angg.twu.net/#eev -;; Version: 20200928 +;; Version: 20201013 ;; 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