branch: externals/eev commit facb51dffc5f8a37931db762e308a6ebb68d33a8 Merge: 8bc3bde d4f6082 Author: Stefan Monnier <monn...@iro.umontreal.ca> Commit: Stefan Monnier <monn...@iro.umontreal.ca>
Merge remote-tracking branch 'eev/UTF-8' into externals/eev --- ChangeLog | 100 +++++- README.md | 47 ++- VERSION | 4 +- eejump.el | 3 +- eev-audiovideo.el | 87 ++++- eev-blinks.el | 13 +- eev-bounded.el | 2 +- eev-channels.el | 2 +- eev-code.el | 6 + eev-codings.el | 4 +- eev-elinks.el | 378 ++++++++------------ eev-hlinks.el | 439 +++++++++++++++++++++++ eev-intro.el | 1010 +++++++++++++++++++++++++++++++++++++++++++++++------ eev-load.el | 3 +- eev-mode.el | 3 +- eev-testblocks.el | 10 + eev-tlinks.el | 416 ++++++++++++++++++++-- 17 files changed, 2128 insertions(+), 399 deletions(-) diff --git a/ChangeLog b/ChangeLog index ec98439..a67fb31 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,101 @@ +2020-02-20 Eduardo Ochs <eduardoo...@gmail.com> + + * eev-intro.el (find-windows-beginner-intro): new function. + (find-eev-intro): added `(find-windows-beginner-intro)' to the + list of intros. + (find-emacs-keys-intro): stress that `M-j' is one of the most + basic keys. + + * eejump.el (eejump-3): new function - make `M-3 M-j' jump to + `(find-windows-beginner-intro)'. + + * eev-tlinks.el (find-intro-links): added a "Skel:". + + * eev-elinks.el (find-extra-file-links): new function. + (find-code-audiovideo-links): small changes. + + * eev-mode.el (eev-mode-map-set): bind `M-h M-e' to + `find-extra-file-links'. + +2020-02-16 Eduardo Ochs <eduardoo...@gmail.com> + + * eev-tlinks.el (find-windows-eepitch-lua-links): new function. + +2020-01-08 Eduardo Ochs <eduardoo...@gmail.com> + + * eev-hlinks.el: new file. + (ee-buffer-re, ee-buffer-eq, ee-buffer-help0) + (ee-buffer-help-re0, ee-buffer-help, ee-grep-bufferp) + (ee-man-bufferp, ee-rcirc-bufferp, ee-info-bufferp) + (ee-dired-bufferp, ee-wdired-bufferp, ee-w3m-bufferp) + (ee-custom-bufferp, ee-epackages-bufferp, ee-intro-bufferp) + (ee-freenode-bufferp, ee-ecolors-bufferp, ee-efaces-bufferp) + (ee-pdftext-bufferp, ee-efunctiondescr-bufferp) + (ee-find-efunctiondescr-links, ee-evardescr-bufferp) + (ee-find-evardescr-links, ee-efunctiondescr-re, ee-evardescr-re) + (ee-efacedescr-re, ee-efacedescr-bufferp) + (ee-find-efacedescr-links, ee-epackage-re, ee-epackage-bufferp) + (ee-find-epackage-links, ee-man-re, ee-find-man-links) + (ee-custom-re, ee-find-custom-links, ee-file-bufferp) + (ee-find-efaces-links, ee-find-ecolors-links) + (ee-find-epackages-links, ee-find-pdftext-links) + (ee-find-here-links, find-here-links-test, ee-find-here-links0) + (find-here-links, find-here-links-beginner) + (ee-window-configuration-before-M-h-M-3, find-here-links-3) + (find-here-links-1): all these functions and variables were moved + from eev-elinks.el to eev-hlinks.el. + + * eev-intro.el (find-links-conv-intro): mention eev-hlinks.el in + the classification in the section "3. Classification". + + * eev-tlinks.el (find-find-links-links-new): new function. + (find-fossil-links, ee-fossil-url-stem): new functions. + + * eev-code.el: added a `(code-c-d "cl" ...)', for the Common Lisp + extensions. + +2020-01-07 Eduardo Ochs <eduardoo...@gmail.com> + + * eev-tlinks.el (ee-ffll-optional, ee-ffll-setqs, ee-ffll-lets) + (ee-ffll-comma-args, ee-ffll-defun-without-lets) + (ee-ffll-defun-with-lets, ee-ffll-defun): new functions. + +2020-01-05 Eduardo Ochs <eduardoo...@gmail.com> + + * eev-code.el: added `(code-c-d "elpa" "~/.emacs.d/elpa/")' - + `find-epackage-links' depends on this. + +2020-01-04 Eduardo Ochs <eduardoo...@gmail.com> + + * eev-intro.el (find-templates-intro): rewrote the whole intro. + (find-refining-intro): new section: "5. Pointing to anchors". + +2020-01-03 Eduardo Ochs <eduardoo...@gmail.com> + + * eev-testblocks.el (ee-insert-test-idris): new function. + + * eev-audiovideo.el: rewrote many comments. + + * eev-intro.el (find-audiovideo-intro): new section: "4.4. The + default audio/video file". + + * eev-blinks.el (ee-find-man-pos-spec-list): `defvar'ed. Was + undeclared before. + +2020-01-02 Eduardo Ochs <eduardoo...@gmail.com> + + * eev-tlinks.el (find-git-links): use "export PAGER=cat". + +2019-11-13 Eduardo Ochs <eduardoo...@gmail.com> + + * eev-intro.el (find-eev-quick-intro): rewrote the section 7.2 to + explain how beginners should use `M-j' without a prefix argument. + +2019-11-11 Eduardo Ochs <eduardoo...@gmail.com> + + * eev-intro.el (find-org-intro): use \":results output\" (thx Ken + Mankoff) + 2019-11-04 Eduardo Ochs <eduardoo...@gmail.com> * eev-intro.el (find-org-intro): rewrote everything. @@ -146,7 +244,7 @@ 2019-08-11 Eduardo Ochs <eduardoo...@gmail.com> * eev-audiovideo.el (ee-mpv-video-options): new variable. - (ee-mpv-video-options, ee-find-mpv-video): num funcions. + (ee-mpv-video-options, ee-find-mpv-video): new functions. * eev-tlinks.el (find-apt-get-source-links): new function. diff --git a/README.md b/README.md index 760229a..f00c389 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,36 @@ shell-like programs ("eepitch"), and sandboxed tutorials (the "find-xxx-intro"s) - quite clearly in its first sections. I've been using it to teach Emacs and GNU/Linux to beginners. -Besides that tutorial the best introductions to eev are these videos: +<p><br/></p> + + + + +### EmacsConf 2019 + +Besides that tutorial the best introduction to eev is this video: + + How to record executable notes with eev - and how to play them back + http://angg.twu.net/emacsconf2019.html + http://angg.twu.net/LATEX/2019emacsconf.pdf (slides) + http://www.youtube.com/watch?v=86yiRG8YJD0 + +Its slide 13 shows how beginners can learn eev by starting with just +two keys, M-j and M-e. See: + + https://www.youtube.com/watch?v=86yiRG8YJD0&t=680 + http://angg.twu.net/eev-intros/find-emacs-keys-intro.html#1 + http://angg.twu.net/eev-intros/find-eev-quick-intro.html#7.2 + +<p><br/></p> + + + + + +### Older videos + +These two older videos are also interesting: Eepitch: a way to control shell-like programs from Emacs (2013) http://www.youtube.com/watch?v=Lj_zKC5BR64 @@ -24,13 +53,21 @@ Besides that tutorial the best introductions to eev are these videos: http://www.youtube.com/watch?v=doeyn5MOaB8 The video about eepitch has a very nice demonstration of controlling -two shell-like programs at once - watch its first two minutes. -Note: I made it before implementing the "find-xxx-intro"s, that in the -last few years became a central feature in eev. +two shell-like programs at once - watch its first two minutes. Note: I +made these two videos before implementing the "find-xxx-intro"s, that +in the last few years became a central feature in eev. + + + + + +<p><br/></p> + +### Etc The main URLs for eev are these: - http://angg.twu.net/#eev + http://angg.twu.net/#eev http://angg.twu.net/eev-intros/find-eev-quick-intro.html The "quick intro" has installation instructions. diff --git a/VERSION b/VERSION index 0b5d362..3cfc394 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -Tue Nov 5 20:01:03 GMT 2019 -Tue Nov 5 17:01:03 -03 2019 +Thu Feb 20 21:11:56 GMT 2020 +Thu Feb 20 18:11:56 -03 2020 diff --git a/eejump.el b/eejump.el index 3e91ca9..7d9440e 100644 --- a/eejump.el +++ b/eejump.el @@ -19,7 +19,7 @@ ;; ;; Author: Eduardo Ochs <eduardoo...@gmail.com> ;; Maintainer: Eduardo Ochs <eduardoo...@gmail.com> -;; Version: 2019mar05 +;; Version: 2020feb20 ;; Keywords: e-scripts ;; ;; Latest version: <http://angg.twu.net/eev-current/eejump.el> @@ -101,6 +101,7 @@ See: (find-eejump-intro \"\\neejump\\n\")" (defun eejump-* () (find-efunction 'eejump-*)) (defun eejump-1 () (find-fline "~/TODO")) (defun eejump-2 () (find-emacs-keys-intro)) +(defun eejump-3 () (find-windows-beginner-intro)) (defun eejump-5 () (find-eev-quick-intro)) (defun eejump-6 () (find-escripts-intro)) diff --git a/eev-audiovideo.el b/eev-audiovideo.el index f252ba5..19399d7 100644 --- a/eev-audiovideo.el +++ b/eev-audiovideo.el @@ -19,7 +19,7 @@ ;; ;; Author: Eduardo Ochs <eduardoo...@gmail.com> ;; Maintainer: Eduardo Ochs <eduardoo...@gmail.com> -;; Version: 2019sep29 +;; Version: 2020jan03 ;; Keywords: e-scripts ;; ;; Latest version: <http://angg.twu.net/eev-current/eev-audiovideo.el> @@ -31,12 +31,63 @@ ;;; Commentary: -;; There is an introduction to these features here, +;; This file implements links to audio or video files _at certain time +;; offsets_. Here are two examples, in a long syntax: +;; +;; (find-video "~/eev-videos/Punch_and_Judy_Mark_Poulton-K6LmZ0A1s9U.mp4") +;; (find-video "~/eev-videos/Punch_and_Judy_Mark_Poulton-K6LmZ0A1s9U.mp4" "1:17") +;; +;; There are also the usual shorter hyperlinks, like this, +;; +;; (find-punchandjudyvideo "1:04" "right position") +;; +;; and a very compact syntax, used by `eev-avadj-mode', in which `M-p' +;; plays the default audio or video file at the first time offset that +;; can the parsed in the current line (the "time from BOL"). See: ;; ;; (find-audiovideo-intro) +;; (find-audiovideo-intro "1. Time offsets") +;; (find-audiovideo-intro "4. Short hyperlinks to audio and video files") +;; (find-audiovideo-intro "4.3. A demo") +;; (find-audiovideo-intro "4.4. The default audio/video file") +;; (find-audiovideo-intro "4.4. The default audio/video file" "`M-p'") ;; -;; but that needs to be rewritten... +;; NOTE: I am not aware of other packages - for emacs or not - that +;; implement links that play audio or video files at given time +;; offsets... but in 2020jan03 a guy called stardiviner sent this +;; proposal to the Org mailing list: +;; +;; https://lists.gnu.org/archive/html/emacs-orgmode/2020-01/msg00007.html + + +;; Historical note: +;; +;; I wrote a first version of this in 2011 or 2012, and some time +;; later a friend - Rafael Duarte Pinheiro - helped me to create a way +;; to play my indexed audios in a browser. Here is an example: +;; +;; http://angg.twu.net/audios/2011dec13-ict.html +;; +;; I used these indexed audios to show what was happening in the +;; banana meetings of the Banana Institute of Science and Technology +;; of the banana campus in which I work, that is part of a banana +;; university in a banana republic. +;; +;; My tools for indexed audios later became one third of my "tools for +;; activists", that are documented here: +;; +;; http://angg.twu.net/ferramentas-para-ativistas.html#audios-introducao +;; +;; but everything there is in Portuguese. +;; +;; In 2014 I had a burn-out and stopped working on these tools for +;; activists. + + + + +;; «.ee-time-from-bol» (to "ee-time-from-bol") ;; «.eev-avadj-mode» (to "eev-avadj-mode") ;; «.find-mplayer» (to "find-mplayer") ;; «.find-termplayer» (to "find-termplayer") @@ -68,6 +119,8 @@ ;;; | |_| | | | | | | __/_____| _| | | (_) | | | | | |_____| |_) | (_) | | ;;; \__|_|_| |_| |_|\___| |_| |_| \___/|_| |_| |_| |_.__/ \___/|_| ;;; +;; «ee-time-from-bol» (to ".ee-time-from-bol") + (defvar ee-time-regexp "\\(?:\\([0-9]?[0-9]\\):\\)?\\([0-9]?[0-9]\\):\\([0-9][0-9]\\)") @@ -77,10 +130,14 @@ (if (re-search-forward regexp limit t repeat) (match-string-no-properties 0)))) +;; Test: 98:76:54 3:21 (ee-time-from-bol) +;; (defun ee-time-from-bol () "Try this: 98:76:54 3:21 (ee-time-from-bol)" (ee-re-search-from (ee-bol) ee-time-regexp (ee-eol))) +;; Test: 98:76:54 3:21 (ee-time-from-bol-flash) +;; (defun ee-time-from-bol-flash () (interactive) "Try this: 98:76:54 3:21 (ee-time-from-bol-flash)" (if (ee-time-from-bol) @@ -97,6 +154,12 @@ ;;; | |_| | | | | | | __/_____\__ \ | | | | _| |_ ;;; \__|_|_| |_| |_|\___| |___/_| |_|_|_| \__| ;;; +;; Tests: +;; (ee-time-to-seconds "1:00:00") +;; (ee-seconds-to-time 5) +;; (ee-seconds-to-time 300) +;; (ee-time+ -20 "0:05") + (defun ee-time-to-seconds (time) (save-match-data (if (string-match ee-time-regexp time) @@ -127,20 +190,21 @@ (ee-time-from-bol-shift (- (or seconds 1)))) + ;;; _ _ _ _ __ _ _ ;;; | | __ _ ___| |_ __ _ _ _ __| (_) ___ / /_ _(_) __| | ___ ___ ;;; | |/ _` / __| __| / _` | | | |/ _` | |/ _ \ / /\ \ / / |/ _` |/ _ \/ _ \ ;;; | | (_| \__ \ |_ | (_| | |_| | (_| | | (_) / / \ V /| | (_| | __/ (_) | ;;; |_|\__,_|___/\__| \__,_|\__,_|\__,_|_|\___/_/ \_/ |_|\__,_|\___|\___/ ;;; -;; +;; See: (find-audiovideo-intro "4.4. The default audio/video file") + (defvar ee-audiovideo-last nil "See: (find-audiovideo-intro \"The current audio or video\")") (defun ee-audiovideo-sexp (time) (list ee-audiovideo-last time)) - (defun ee-time-from-bol-rerun (&optional arg) "Play the current audio or video starting at '(ee-time-from-bol)'. With a prefix of 0 just display what would be done. See: @@ -418,7 +482,10 @@ See: (find-audiovideo-intro \"`eev-avadj-mode'\")" ;;; ;; Convert between a number of seconds (a number) -;; and a "minutes:seconds" thing (a string) +;; and a "minutes:seconds" thing (a string). +;; OBSOLETE. +;; TODO: convert all calls to `ee-secs-to-mm:ss' to `ee-seconds-to-time' and +;; all calls to `ee-mm:ss-to-secs' to `ee-time-to-seconds'. ;; (defun ee-secs-to-mm:ss (n) "Force N - a number of seconds or an \"mm:ss\" string - to the mm:ss format" @@ -433,13 +500,7 @@ See: (find-audiovideo-intro \"`eev-avadj-mode'\")" (+ (* 60 (car ms)) (cadr ms))))) -;;; _ _ -;;; | |_(_)_ __ ___ ___ _ __ ___ __ _ _____ ___ __ -;;; | __| | '_ ` _ \ / _ \_____| '__/ _ \/ _` |/ _ \ \/ / '_ \ -;;; | |_| | | | | | | __/_____| | | __/ (_| | __/> <| |_) | -;;; \__|_|_| |_| |_|\___| |_| \___|\__, |\___/_/\_\ .__/ -;;; |___/ |_| -;; +;; Old notes on time regexps: ;; (find-elnode "Time Parsing") ;; (seconds-to-time 4000) ;; (float-time '(0 4000 0)) diff --git a/eev-blinks.el b/eev-blinks.el index ad1e66b..92770cd 100644 --- a/eev-blinks.el +++ b/eev-blinks.el @@ -522,8 +522,8 @@ CODE argument, and process the POS-SPEC-LIST." (defun find-estring (string &rest pos-spec-list) "Visit a temporary buffer whose contents are given by STR. The default name for the buffer is \"*string*\", but this can be -overriden by setting `ee-buffer-name' to another name with a `let'. -If the buffer already exists its contents are destroyed. +overridden by setting `ee-buffer-name' to another name with a +`let'. If the buffer already exists its contents are destroyed. The buffer is not made read-only." (apply 'find-eoutput-rerun (or ee-buffer-name "*string*") `(insert ,string) pos-spec-list)) @@ -552,7 +552,7 @@ See: (find-anchors-intro \"WARNING: some glyphs need raw-text-unix\")" (defun find-estring-lv (string &rest pos-spec-list) "Visit a temporary buffer whose contents are given by STR. The default name for the buffer is \"*string*\", but this can be -overriden by setting `ee-buffer-name' to another name with a `let'. +overridden by setting `ee-buffer-name' to another name with a `let'. If the buffer already exists its contents are destroyed. The buffer is not made read-only. The \"Local variables:\" section in the buffer is processed." @@ -637,10 +637,11 @@ This is like `find-sh' but sets the buffer's default-directory to DIR." ;; Tests: ;; (find-man "1 cat") -(defvar ee-find-man-flag nil "See `find-man'.") +(defvar ee-find-man-flag nil "See `find-man'.") +(defvar ee-find-man-pos-spec-list nil "See `find-man'.") ;; See: (find-elnode "Advising Functions") -;; (find-elnode "Porting old advices") +;; (find-elnode "Porting old advice") ;; (find-efunctiondescr 'defadvice) (defadvice Man-notify-when-ready (around find-man (man-buffer) activate) "After rendering a manpage jump to `ee-find-man-pos-spec-list'." @@ -723,7 +724,7 @@ it doesn't convert relative filenames into urls. See ;; (find-fline "/var/lib/dpkg/status" "\nPackage: bash\n") (defun find-Package (fname &optional packagename &rest pos-spec-list) - "Hyperlink to \"Package: \" achors in Debian package control files. + "Hyperlink to \"Package: \" anchors in Debian package control files. See: `find-status', `find-available', (find-man \"grep-dctrl\")" (find-fline fname) (apply 'ee-goto-position diff --git a/eev-bounded.el b/eev-bounded.el index 3501a97..e6b369f 100644 --- a/eev-bounded.el +++ b/eev-bounded.el @@ -35,7 +35,7 @@ ;; This file adds support for "bounded functions" to eev. For example: ;; `M-x eev' saves the region between point and mark into the ;; temporary script file; `M-x eev-bounded' saves the region around -;; point, up to the first occurences of a certain delimiters before +;; point, up to the first occurrences of a certain delimiters before ;; and after point, into the temporary script file. ;; ;; Big letters courtesy of Figlet. diff --git a/eev-channels.el b/eev-channels.el index 0ebcd11..6b4844a 100644 --- a/eev-channels.el +++ b/eev-channels.el @@ -1,4 +1,4 @@ -;;; eev-channels.el -- control external processes usign signals, +;;; eev-channels.el -- control external processes using signals, ;;; temporary files, and Expect scripts. ;; Copyright (C) 2012-2019 Free Software Foundation, Inc. diff --git a/eev-code.el b/eev-code.el index 072531d..ef9b638 100644 --- a/eev-code.el +++ b/eev-code.el @@ -328,6 +328,7 @@ Note: the POS-SPEC-LIST arguments are currently not used." (code-c-d "e" ee-emacs-lisp-directory "emacs" :gz) ; (find-enode "Top") (code-c-d "el" ee-emacs-lisp-directory "elisp" :gz) ; (find-elnode "Top") (code-c-d "eli" ee-emacs-lisp-directory "eintr" :gz) ; (find-elinode "Top") +(code-c-d "cl" (ee-efile "emacs-lisp/") "cl" :gz) ; (find-clnode "Top") (code-c-d "eleim" ee-emacs-leim-directory :gz) (code-c-d "equail" (ee-eleimfile "quail/") :gz) (code-c-d "eetc" data-directory :gz) @@ -338,9 +339,14 @@ Note: the POS-SPEC-LIST arguments are currently not used." ;; (find-equailfile "") ;; (find-equailfile "latin-ltx.el") +;; Debian: (code-c-d "ud" "/usr/share/doc/" :gz) ; (find-udfile "bash/") (code-c-d "vldi" "/var/lib/dpkg/info/") ; (find-vldifile "bash.list") +;; Used by `find-epackage-links': +(code-c-d "elpa" "~/.emacs.d/elpa/") +;; (find-elpafile "") + (provide 'eev-code) diff --git a/eev-codings.el b/eev-codings.el index 5561fd9..958f664 100644 --- a/eev-codings.el +++ b/eev-codings.el @@ -35,8 +35,8 @@ ;; ;; in the local variables section at the end of (at least some) of his ;; files; the functions defined here make the local variables section -;; trick unneccessary - `ee-format-as-anchor' now uses `ee-tolatin1' -;; to produce a search string that works both unibyte, on UTF-8, on +;; trick unnecessary - `ee-format-as-anchor' now uses `ee-tolatin1' to +;; produce a search string that works both unibyte, on UTF-8, on ;; latin-1 files and some (most of?) other encodings. ;; ;; NOTE: `ee-tolatin1' a hack! Conversion to latin-1 seems to work in diff --git a/eev-elinks.el b/eev-elinks.el index 5852631..bcbc374 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: 2019oct04 +;; Version: 2020feb20 ;; Keywords: e-scripts ;; ;; Latest version: <http://angg.twu.net/eev-current/eev-elinks.el> @@ -35,7 +35,9 @@ ;; See this for a (rough) classification of eev's hyperlink functions ;; into several classes: ;; -;; (find-links-intro "6. Basic and non-basic hyperlinks") +;; (find-links-conv-intro "3. Classification") +;; (find-links-conv-intro "3. Classification" "`find-elinks'") +;; (find-links-conv-intro "3. Classification" "`find-elinks'+") ;; ;; In this file we define `find-elinks' and several functions based on ;; it that generate relatively simple elisp hyperlinks buffers - @@ -75,13 +77,24 @@ ;; «.find-color-links» (to "find-color-links") ;; «.find-epackage-links» (to "find-epackage-links") +;; «.find-code-pdf-links» (to "find-code-pdf-links") +;; «.find-pdf-links» (to "find-pdf-links") +;; «.find-extra-file-links» (to "find-extra-file-links") +;; «.find-code-audiovideo-links» (to "find-code-audiovideo-links") + + + +;; The functions in these sections were moved to: +;; (find-eev "eev-hlinks.el") +;; ;; «.find-here-links» (to "find-here-links") ;; «.find-here-links-beginner» (to "find-here-links-beginner") ;; «.find-here-links-3» (to "find-here-links-3") +;; «find-here-links» (to ".find-here-links") +;; «find-here-links-beginner» (to ".find-here-links-beginner") +;; «find-here-links-3» (to ".find-here-links-3") + -;; «.find-code-pdf-links» (to "find-code-pdf-links") -;; «.find-pdf-links» (to "find-pdf-links") -;; «.find-code-audiovideo-links» (to "find-code-audiovideo-links") @@ -277,7 +290,7 @@ This is an internal function used by `find-efunction-links' and ;;; |_| |_|_| |_|\__,_| \___| \_/ \__,_|_| |_|\__,_|_.__/|_|\___| ;;; ;; «find-evariable-links» (to ".find-evariable-links") -;; (find-find-links-links "\\M-v" "evariable" "var") +;; Skel: (find-find-links-links-old "\\M-v" "evariable" "var") ;; A test: (find-evariable-links 'line-move-visual) ;; (eek "M-h M-v line-move-visual") @@ -312,7 +325,7 @@ This is an internal function used by `find-efunction-links' and ;;; |___/ ;; ;; «find-ekey-links» (to ".find-ekey-links") -;; (find-find-links-links "\\M-k" "ekey" "key") +;; Skel: (find-find-links-links-old "\\M-k" "ekey" "key") ;; ;; The functions in this section generate buffers with hyperlinks ;; about a key sequence. Like this, @@ -743,7 +756,7 @@ when this is true remove the prefix D from FNAME, and put the sexp ;;; |_| |_|_| |_|\__,_| |_| |_|_|\___| |_|_|_| |_|_|\_\___/ ;;; ;; «find-file-links» (to ".find-file-links") -;; (find-find-links-links "f" "file" "fname") +;; Skel: (find-find-links-links-old "f" "file" "fname") ;; A test: (find-file-links "~/tmp/foo") ;; Moved to eev-mode.el: @@ -762,6 +775,7 @@ when this is true remove the prefix D from FNAME, and put the sexp (setq fname (or fname (or (buffer-file-name) default-directory))) `(,(ee-if-prefixp "~/" "~/" fname '`(find-fline ,fname+)) ,(ee-if-prefixp "$S/http/" "http://" fname '(ee-H fname+)) + ,(ee-if-prefixp "$S/https/" "https://" fname '(ee-H fname+)) ,(ee-if-prefixp "$S/shttp/" "shttp://" fname '(ee-H fname+)) "" (find-file ,fname) ; non-refinable @@ -791,7 +805,7 @@ when this is true remove the prefix D from FNAME, and put the sexp ;;; |___/ |_| ;; ;; «find-grep-links» (to ".find-grep-links") -;; (find-find-links-links "\\M-g" "grep" "") +;; Skel: (find-find-links-links-old "\\M-g" "grep" "") ;; Tests: ;; (ee-find-grep-commands) ;; (ee-find-grep-functions "~/eev-current/") @@ -851,7 +865,7 @@ when this is true remove the prefix D from FNAME, and put the sexp ;;; |_| |_|_| |_|\__,_| |_| |_| |_|\__,_|\___|_| \___/ ;;; ;; «find-ekbmacro-links» (to ".find-ekbmacro-links") -;; (find-find-links-links "M" "macro" "") +;; Skel: (find-find-links-links-old "M" "macro" "") ;; (find-efunction 'find-ekbmacro-links) ;; Moved to eev-mode.el: @@ -909,7 +923,7 @@ when this is true remove the prefix D from FNAME, and put the sexp (defun ee-region-or-last-kill () (or (ee-region) (ee-last-kill))) -;; (find-find-links-links "\\M-p" "pdflike-page" "page bufname offset") +;; 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) @@ -1011,7 +1025,7 @@ See the comments in the source code." ;; (find-templates-intro) ;; «find-eface-links» (to ".find-eface-links") -;; (find-find-links-links "\\M-s" "eface" "face-symbol") +;; Skel: (find-find-links-links-old "\\M-s" "eface" "face-symbol") ;; A test: (find-eface-links 'bold) ;; Moved to eev-mode.el: @@ -1054,7 +1068,7 @@ See the comments in the source code." ;;; |_| |_|_| |_|\__,_| \___|\___\___/|_|\___/|_| |_|_|_| |_|_|\_\___/ ;;; ;; «find-color-links» (to ".find-color-links") -;; (find-find-links-links "c" "color" "initialcolor") +;; Skel: (find-find-links-links-old "c" "color" "initialcolor") ;; Tests: ;; (find-ecolor-links) ;; (find-ecolor-links "sienna") @@ -1158,220 +1172,6 @@ This is an internal function used by `ee-find-epackage-links'." -;;; __ _ _ _ _ _ _ -;;; / _(_)_ __ __| | | |__ ___ _ __ ___ | (_)_ __ | | _____ -;;; | |_| | '_ \ / _` |_____| '_ \ / _ \ '__/ _ \_____| | | '_ \| |/ / __| -;;; | _| | | | | (_| |_____| | | | __/ | | __/_____| | | | | | <\__ \ -;;; |_| |_|_| |_|\__,_| |_| |_|\___|_| \___| |_|_|_| |_|_|\_\___/ -;;; -;; «find-here-links» (to ".find-here-links") -;; See: (find-eev-quick-intro "`M-h M-h'") - -;; (find-efunction 'find-grep-links) -;; (find-efunction 'find-einfo-links) -;; (find-efunction 'find-file-links) -;; (find-find-links-links "\\M-h" "here" "") -;; (find-efunction 'find-ecolors) - -;; Moved the key binding to: -;; (find-eevfile "eev-mode.el" "\\M-h\\M-h") -;; (define-key eev-mode-map "\M-h\M-h" 'find-here-links) - -;; TODO: support cases like these: -;; (find-efunctiondescr 'condition-case) - -;; Some tools for detecting which kind of buffer we're in. -(defun ee-buffer-re (re) - (if (string-match re (buffer-name)) - (match-string 1 (buffer-name)))) -(defun ee-buffer-eq (str) (string= str (buffer-name))) - -(defun ee-buffer-help0 () (ee-buffer-eq "*Help*")) -(defun ee-buffer-help-re0 (re n) - (if (ee-buffer-help0) - (save-excursion - (goto-char (point-min)) - (if (looking-at re) (match-string n))))) - -(defun ee-buffer-help (re n) (intern (or (ee-buffer-help-re0 re n) "nil"))) - -;; By major mode -(defun ee-grep-bufferp () (eq major-mode 'grep-mode)) -(defun ee-man-bufferp () (eq major-mode 'Man-mode)) -(defun ee-rcirc-bufferp () (eq major-mode 'rcirc-mode)) -(defun ee-info-bufferp () (eq major-mode 'Info-mode)) -(defun ee-dired-bufferp () (eq major-mode 'dired-mode)) -(defun ee-wdired-bufferp () (eq major-mode 'wdired-mode)) -(defun ee-w3m-bufferp () (eq major-mode 'w3m-mode)) -(defun ee-custom-bufferp () (eq major-mode 'Custom-mode)) -(defun ee-epackages-bufferp () (eq major-mode 'package-menu-mode)) - -;; By buffer name -(defun ee-intro-bufferp () (ee-buffer-re "^\\*(find-\\(.*\\)-intro)\\*$")) -(defun ee-freenode-bufferp () (ee-buffer-re "^\\(.*\\).freenode\\.net")) -(defun ee-ecolors-bufferp () (ee-buffer-eq "*Colors*")) -(defun ee-efaces-bufferp () (ee-buffer-eq "*Faces*")) -(defun ee-pdftext-bufferp () (ee-buffer-re "^pdftotext")) - -;; By buffer name (when it is "*Help*") -(defvar ee-efunctiondescr-re - "^\\([^ \t\n]+\\) is a[^\t\n]*\\(function\\|Lisp macro\\|special form\\)") -(defun ee-efunctiondescr-bufferp () (ee-buffer-help ee-efunctiondescr-re 1)) -(defun ee-find-efunctiondescr-links () - (let ((f (ee-efunctiondescr-bufferp))) - `((find-efunction-links ',f) - (find-efunctiondescr ',f)))) - -(defvar ee-evardescr-re "^\\([^ \t\n]+\\) is a variable") -(defun ee-evardescr-bufferp () (ee-buffer-help ee-evardescr-re 1)) -(defun ee-find-evardescr-links () - (let ((v (ee-evardescr-bufferp))) - `((find-evariable-links ',v) - (find-evardescr ',v)))) - -(defvar ee-efacedescr-re "^Face: \\([^ \t\n]+\\)") -(defun ee-efacedescr-bufferp () (ee-buffer-help ee-efacedescr-re 1)) -(defun ee-find-efacedescr-links () - (let ((f (ee-efacedescr-bufferp))) - `((find-eface-links ',f) - (find-efacedescr ',f)))) - -(defvar ee-epackage-re "^\\([^ \t\n]+\\) is a[ -~]+ package") -(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)))) - -;; By buffer name (when the mode is man) -(defvar ee-man-re "^\\*Man \\(.*\\)\\*$") -(defun ee-find-man-links () - (let ((mp (ee-buffer-re ee-man-re))) - `((find-man ,mp)))) - -(defvar ee-custom-re "^\\*Customize Group: \\(.*\\)\\*$") -(defun ee-find-custom-links () - (let* ((name (ee-buffer-re ee-custom-re)) - (symbol (intern (downcase (replace-regexp-in-string " " "-" name))))) - `((find-customizegroup ',symbol)))) - -;; Other cases -(defun ee-file-bufferp () buffer-file-name) - - - -(defun ee-find-efaces-links () `((find-efaces))) -(defun ee-find-ecolors-links () `((find-ecolors))) -(defun ee-find-epackages-links () `((find-epackages))) -(defun ee-find-pdftext-links () (ee-pdflike-page-links)) - -;; to to: -;; ee-find-w3m-links -;; ee-find-ecolor-links -;; - -(defun ee-find-here-links () - (cond ;; by major mode - ((ee-info-bufferp) (cons "" (ee-find-info-links))) ; M-h M-i - ((ee-man-bufferp) (cons "" (ee-find-man-links))) ; ? - ((ee-grep-bufferp) (cons "" (ee-find-grep-links))) ; M-h M-g - ((ee-w3m-bufferp) (cons "" (ee-find-w3m-links))) ; M-h M-w - ((ee-dired-bufferp) (cons "" (ee-find-file-links))) ; M-h f - ((ee-wdired-bufferp) (cons "" (ee-find-file-links))) ; M-h f - ((ee-custom-bufferp) (cons "" (ee-find-custom-links))) ; ? - ((ee-epackages-bufferp) (cons "" (ee-find-epackages-links))) ; ? - ;; by buffer name - ((ee-intro-bufferp) (cons "" (ee-find-intro-links))) ; M-h M-i - ((ee-freenode-bufferp) (cons "" (ee-find-freenode-links))) ; ? - ((ee-ecolors-bufferp) (cons "" (ee-find-ecolors-links))) ; ? - ((ee-efaces-bufferp) (cons "" (ee-find-efaces-links))) ; ? - ((ee-pdftext-bufferp) (cons "" (ee-find-pdftext-links))) ; ? - ;; by buffer name, when it is "*Help*" - ((ee-efunctiondescr-bufferp) (cons "" (ee-find-efunctiondescr-links))) - ((ee-efacedescr-bufferp) (cons "" (ee-find-efacedescr-links))) - ((ee-evardescr-bufferp) (cons "" (ee-find-evardescr-links))) - ((ee-epackage-bufferp) (cons "" (ee-find-epackage-links))) - ;; other cases - ((ee-file-bufferp) (cons "" (ee-find-file-links))) ; M-h f - (t (list "" "Not implemented!" "See:" - '(find-efunction 'ee-find-here-links))) - )) - -(defun find-here-links-test (sexp) -"See: (find-links-intro \"`find-here-links'\")" - (find-wset "13o_2o_o" sexp '(find-here-links))) - -;; (find-man "1 cat") -;; (progn (find-man "1 cat") (buffer-name)) -;; (find-eevfile "eev-rcirc.el") - -(defun ee-find-here-links0 () - `(,(ee-H "See: ") - (find-eev-quick-intro "4.1. `find-here-links'") - (find-emacs-keys-intro "1. Basic keys (eev)" "M-h M-h") - (find-here-links-intro "4. `find-here-links-3'") - )) - -;; (find-find-links-links "\\M-h" "here" "") -;; -(defun find-here-links (&rest pos-spec-list) -"Visit a temporary buffer containing hyperlinks pointing to here." - (interactive) - (apply 'find-elinks - `(;; The first line of a find-here-links buffer DOES NOT - ;; regenerates the buffer - instead the first lines point to - ;; help pages. - ,@(ee-find-here-links0) - ,@(ee-find-here-links) - ) - pos-spec-list)) - -;; Test: (find-here-links) -;; (progn (find-enode "Screen") (find-here-links)) - - - -;; «find-here-links-beginner» (to ".find-here-links-beginner") -;; This is a hack for beginners that is explained in a tutorial. See: -;; (find-refining-intro "4. A tip for beginners") -;; (find-refining-intro "4. A tip for beginners" "find-here-links-beginner") -;; -(defun find-here-links-beginner (&optional arg) - "A variant of `find-here-links' that may create a three-window setting." - (interactive "P") - (if arg (find-here-links-3) (find-here-links))) - -;; «find-here-links-3» (to ".find-here-links-3") -;; See: (find-here-links-intro "4. `find-here-links-3'") -;; (find-here-links-intro "5. `find-here-links-1'") -;; -(defvar ee-window-configuration-before-M-h-M-3 nil) - -(defun find-here-links-3 () - "A variant of `find-here-links' that creates a three-window setting. -Before creating the three windows this function tries to save the -current window configuration to the variable -`ee-window-configuration-before-M-h-M-3', but if that variable is -not nil we abort instead of overwriting it. -See: (find-here-links-intro \"4. `find-here-links-3'\")" - (interactive) - (if ee-window-configuration-before-M-h-M-3 - (let ((overwrite - (yes-or-no-p "Overwrite `ee-window-configuration-before-M-h-M-3'? "))) - (if (not overwrite) - (error)))) - (setq ee-window-configuration-before-M-h-M-3 - (current-window-configuration)) - (find-wset "13_o2_o_coo" nil '(find-here-links) '(eejump-1))) - -(defun find-here-links-1 () - "Restore the window configuration before `find-here-links-3'. -See: (find-here-links-intro \"5. `find-here-links-1'\")" - (interactive) - (set-window-configuration ee-window-configuration-before-M-h-M-3) - (setq ee-window-configuration-before-M-h-M-3 nil)) - - - @@ -1417,14 +1217,14 @@ See: (find-here-links-intro \"5. `find-here-links-1'\")" ;; (find-fline {(ee-S (file-name-directory fname))}) \(code-c-d \"{c}\" \"{(file-name-directory fname)}\") -;; \(find-{c}file \"\") +;; (find-{c}file \"\") ;; (find-pdf-page \"{fname}\") ;; (find-pdf-text \"{fname}\") \(code-pdf-page \"{c}\" \"{fname}\") \(code-pdf-text \"{c}\" \"{fname}\") -;; \(find-{c}page) -;; \(find-{c}text) +;; (find-{c}page) +;; (find-{c}text) ") ) pos-spec-list))) @@ -1440,41 +1240,137 @@ See: (find-here-links-intro \"5. `find-here-links-1'\")" +;; «find-extra-file-links» (to ".find-extra-file-links") +;; Skel: (find-find-links-links-new "extra-file" "fname c" "dir") +;; +(defun find-extra-file-links (&optional fname c &rest pos-spec-list) +"Visit a temporary buffer containing hyperlinks for extra-file." + (interactive (list (and (eq major-mode 'dired-mode) (ee-dired-to-fname)))) + (if fname (setq fname (ee-shorten-file-name fname))) + (setq fname (or fname "{fname}")) + (setq c (or c "{c}")) + (let* ((dir (file-name-directory fname))) + (apply + 'find-elinks-elisp + `((find-extra-file-links ,fname ,c ,@pos-spec-list) + ;; Convention: the first sexp always regenerates the buffer. + ;; (find-efunction 'find-extra-file-links) + ;; "" + ,(ee-template0 "\ +;; See: (find-eev-quick-intro \"9.1. `code-c-d'\") +;; (find-pdf-like-intro \"9. Generating three pairs\" \"`M-h M-p'\") +;; (find-audiovideo-intro \"2.1. `find-extra-file-links'\") + +;; Links to this directory: +;; (find-fline {(ee-S (file-name-directory fname))}) +\(code-c-d \"{c}\" \"{(file-name-directory fname)}\") +;; (find-{c}file \"\") + +;; Links to a PDF file: +;; (find-pdf-page \"{fname}\") +;; (find-pdf-text \"{fname}\") +\(code-pdf-page \"{c}\" \"{fname}\") +\(code-pdf-text \"{c}\" \"{fname}\") +;; (find-{c}page) +;; (find-{c}text) + +;; Links to an audio file: +;; (find-audio \"{fname}\") +\(code-audio \"{c}audio\" \"{fname}\") +;; (find-{c}audio) +;; (find-{c}audio \"0:00\") + +;; Links to a video file: +;; (find-video \"{fname}\") +\(code-video \"{c}video\" \"{fname}\") +;; (find-{c}video) +;; (find-{c}video \"0:00\") +;; +;; (eev-avadj-mode 0) +;; (eev-avadj-mode) + +;; Links to an shell-like program (for eepitch): +;; (eepitch-comint \"{c}\" \"{fname}\") + +(defun eepitch-{c} () (interactive) + (eepitch-comint \"{c}\" + \"{fname}\")) + +;; Test: + + (eepitch-{c}) + (eepitch-kill) + (eepitch-{c}) +") + ) + pos-spec-list))) + +;; Tests: +;; (find-extra-file-links "~/eev-videos/three-keys-2.mp4") + + + ;; «find-code-audiovideo-links» (to ".find-code-audiovideo-links") +;; Skel: (find-find-links-links-new "code-audiovideo" "fname c" "dir") ;; (defun find-code-audiovideo-links (&optional fname c &rest pos-spec-list) -"Visit a temporary buffer containing hyperlinks and..." +"Visit a temporary buffer containing hyperlinks for code-audiovideo." (interactive (list (and (eq major-mode 'dired-mode) (ee-dired-to-fname)))) (if fname (setq fname (ee-shorten-file-name fname))) (setq fname (or fname "{fname}")) (setq c (or c "{c}")) - (let ((dir (file-name-directory fname))) - (apply 'find-elinks-elisp + (let* ((dir (file-name-directory fname))) + (apply + 'find-elinks-elisp `((find-code-audiovideo-links ,fname ,c ,@pos-spec-list) ;; Convention: the first sexp always regenerates the buffer. - ;; - ;; (find-efunction 'find-code-pdf-links) + ;; (find-efunction 'find-code-audiovideo-links) + ;; "" ,(ee-template0 "\ ;; See: (find-eev-quick-intro \"9.1. `code-c-d'\") ;; (find-pdf-like-intro \"9. Generating three pairs\" \"`M-h M-p'\") ;; (find-audiovideo-intro \"2.1. `find-code-audiovideo-links'\") +;; Links to this directory: ;; (find-fline {(ee-S (file-name-directory fname))}) \(code-c-d \"{c}\" \"{(file-name-directory fname)}\") -;; \(find-{c}file \"\") +;; (find-{c}file \"\") +;; Links to a PDF file: +;; (find-pdf-page \"{fname}\") +;; (find-pdf-text \"{fname}\") +\(code-pdf-page \"{c}\" \"{fname}\") +\(code-pdf-text \"{c}\" \"{fname}\") +;; (find-{c}page) +;; (find-{c}text) + +;; Links to an audio file: ;; (find-audio \"{fname}\") \(code-audio \"{c}audio\" \"{fname}\") -;; \(find-{c}audio) -;; \(find-{c}audio \"0:00\") +;; (find-{c}audio) +;; (find-{c}audio \"0:00\") +;; Links to a video file: ;; (find-video \"{fname}\") \(code-video \"{c}video\" \"{fname}\") -;; \(find-{c}video) -;; \(find-{c}video \"0:00\") - +;; (find-{c}video) +;; (find-{c}video \"0:00\") +;; ;; (eev-avadj-mode 0) ;; (eev-avadj-mode) + +;; Links to an shell-like program (for eepitch): +;; (eepitch-comint \"{c}\" \"{fname}\") + +(defun eepitch-{c} () (interactive) + (eepitch-comint \"{c}\" + \"{fname}\")) + +;; Test: + + (eepitch-{c}) + (eepitch-kill) + (eepitch-{c}) ") ) pos-spec-list))) diff --git a/eev-hlinks.el b/eev-hlinks.el new file mode 100644 index 0000000..30abc4a --- /dev/null +++ b/eev-hlinks.el @@ -0,0 +1,439 @@ +;;; eev-hlinks.el --- `find-here-links' and variants. + +;; Copyright (C) 2020 Free Software Foundation, Inc. +;; +;; This file is part of GNU eev. +;; +;; GNU eev is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. +;; +;; GNU eev is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. +;; +;; Author: Eduardo Ochs <eduardoo...@gmail.com> +;; Maintainer: Eduardo Ochs <eduardoo...@gmail.com> +;; Version: 2020jan09 +;; Keywords: e-scripts +;; +;; Latest version: <http://angg.twu.net/eev-current/eev-hlinks.el> +;; htmlized: <http://angg.twu.net/eev-current/eev-hlinks.el.html> +;; See also: <http://angg.twu.net/eev-current/eev-readme.el.html> +;; <http://angg.twu.net/eev-intros/find-eev-intro.html> +;; <http://angg.twu.net/eev-intros/find-here-links-intro.html> +;; (find-eev-intro) +;; (find-here-links-intro) + +;;; Commentary: + +;; This file implements `find-here-links', its variants for beginners, +;; and the many low-level functions that are needed to make them work. +;; +;; `find-here-links' generates a temporary buffer with links to +;; "here". There are several kinds of "here"s - see: +;; +;; (find-here-links-intro "3. `find-here-links'") +;; (find-here-links-intro "3. `find-here-links'" "several kinds") +;; +;; The "here" buffer is sometimes called the "target" buffer. See: +;; +;; (find-here-links-intro "4. `find-here-links-3'") +;; (find-here-links-intro "4. `find-here-links-3'" "terminology") +;; +;; For each kind of "here" we have a "test function" that tests if the +;; current buffer is of that kind of here and a "links function" that +;; generates links for that kind of here. Here's the conventions on +;; their names. A sexp like +;; +;; (find-man "1 date") +;; +;; opens a manpage buffer; the test function and the links function +;; for manpage buffers are: +;; +;; (ee-man-bufferp) +;; (ee-find-man-links) +;; +;; They all have the same stem - "man" - but different prefixes and +;; suffixes. + +;; TODO: Some of the `ee-find-*-links' functions are defined in other +;; files. Which ones? Give examples! +;; +;; (find-eapropos "ee-find-.*-links") + + + +;; The main workhorse function in this file is `ee-find-here-links', +;; that _currently_ uses a big `cond' to run these test functions in a +;; certain order until one of them returns true, and then it returns +;; the result of the links function associated to that test (and to +;; that kind of "here"). But I am trying to rewrite it... + + + +;; «.ee-types-of-here» (to "ee-types-of-here") +;; «.tests-and-links» (to "tests-and-links") +;; «.ee-which-here-tests» (to "ee-which-here-tests") +;; +;; «.find-here-links» (to "find-here-links") +;; «.find-here-links-beginner» (to "find-here-links-beginner") +;; «.find-here-links-3» (to "find-here-links-3") + + + + + +;;; __ _ _ _ _ _ _ +;;; / _(_)_ __ __| | | |__ ___ _ __ ___ | (_)_ __ | | _____ +;;; | |_| | '_ \ / _` |_____| '_ \ / _ \ '__/ _ \_____| | | '_ \| |/ / __| +;;; | _| | | | | (_| |_____| | | | __/ | | __/_____| | | | | | <\__ \ +;;; |_| |_|_| |_|\__,_| |_| |_|\___|_| \___| |_|_|_| |_|_|\_\___/ +;;; +;; «find-here-links» (to ".find-here-links") +;; See: (find-eev-quick-intro "`M-h M-h'") + +;; (find-efunction 'find-grep-links) +;; (find-efunction 'find-einfo-links) +;; (find-efunction 'find-file-links) +;; (find-find-links-links "\\M-h" "here" "") +;; (find-efunction 'find-ecolors) + +;; Moved the key binding to: +;; (find-eevfile "eev-mode.el" "\\M-h\\M-h") +;; (define-key eev-mode-map "\M-h\M-h" 'find-here-links) + +;; TODO: support cases like these: +;; (find-efunctiondescr 'condition-case) + + + + + + +;;; _ __ _ +;;; | |_ _ _ _ __ ___ ___ ___ / _| | |__ ___ _ __ ___ +;;; | __| | | | '_ \ / _ \/ __|_____ / _ \| |_ _____| '_ \ / _ \ '__/ _ \ +;;; | |_| |_| | |_) | __/\__ \_____| (_) | _|_____| | | | __/ | | __/ +;;; \__|\__, | .__/ \___||___/ \___/|_| |_| |_|\___|_| \___| +;;; |___/|_| +;; +;; «ee-types-of-here» (to ".ee-types-of-here") +;; New code. Not working yet. Commented out. +;; Ugliness: `ee-add-type-of-here' runs `sort' too often. +;; See: (find-eev "eev-code.el" "alists") +;; (find-elnode "Sequence Functions" "Function: sort ") + +' +(progn + +(setq ee-types-of-here nil) + +(defun ee-sort-types-of-here () + (setq ee-types-of-here + (sort ee-types-of-here + (lambda (a b) (string< (car a) (car b)))))) + +(defun ee-add-type-of-here (priority testcode linkscode) + (let* ((label (format "%s %s" priority (ee-S testcode)))) + (setq ee-types-of-here + (ee-aset ee-types-of-here label (list testcode linkscode))))) + +(defun ee-add-toh-major (testcode linkscode) + (ee-add-type-of-here "20 major" testcode linkscode)) + +(defun ee-add-toh-bname (testcode linkscode) + (ee-add-type-of-here "40 bname" testcode linkscode)) + +(defun ee-add-toh-bhelp (testcode linkscode) + (ee-add-type-of-here "60 help " testcode linkscode)) + +(defun ee-add-toh-other (testcode linkscode) + (ee-add-type-of-here "80 other" testcode linkscode)) + +;; By major mode: +(ee-add-toh-major '(ee-info-bufferp) '(ee-find-info-links)) +(ee-add-toh-major '(ee-man-bufferp) '(ee-find-man-links)) +(ee-add-toh-major '(ee-grep-bufferp) '(ee-find-grep-links)) +(ee-add-toh-major '(ee-w3m-bufferp) '(ee-find-w3m-links)) +(ee-add-toh-major '(ee-dired-bufferp) '(ee-find-file-links)) +(ee-add-toh-major '(ee-wdired-bufferp) '(ee-find-file-links)) +(ee-add-toh-major '(ee-custom-bufferp) '(ee-find-custom-links)) +(ee-add-toh-major '(ee-epackages-bufferp) '(ee-find-epackages-links)) + +;; By buffer name: +(ee-add-toh-bname '(ee-intro-bufferp) '(ee-find-intro-links)) +(ee-add-toh-bname '(ee-ecolors-bufferp) '(ee-find-ecolors-links)) +(ee-add-toh-bname '(ee-efaces-bufferp) '(ee-find-efaces-links)) +;; (ee-add-toh-bname '(ee-freenode-bufferp) '(ee-find-freenode-links)) +;; (ee-add-toh-bname '(ee-pdftext-bufferp) '(ee-find-pdftext-links)) + +;; When the buffer name is "*Help*" we parse the first line: +(ee-add-toh-bhelp '(ee-efunctiondescr-bufferp) '(ee-find-efunctiondescr-links)) +(ee-add-toh-bhelp '(ee-efacedescr-bufferp) '(ee-find-efacedescr-links)) +(ee-add-toh-bhelp '(ee-evardescr-bufferp) '(ee-find-evardescr-links)) +(ee-add-toh-bhelp '(ee-epackage-bufferp) '(ee-find-epackage-links)) + +;; Other cases: +(ee-add-toh-other '(ee-file-bufferp) '(ee-find-file-links)) + +(ee-sort-types-of-here) + +;; Inspect the data structures: +;; (find-epp ee-types-of-here) +;; (find-estring (mapconcat 'car ee-types-of-here "\n")) + + +) + + + + + + +;;; _ _ _ _ _ _ +;;; | |_ ___ ___| |_ ___ __ _ _ __ __| | | (_)_ __ | | _____ +;;; | __/ _ \/ __| __/ __| / _` | '_ \ / _` | | | | '_ \| |/ / __| +;;; | || __/\__ \ |_\__ \ | (_| | | | | (_| | | | | | | | <\__ \ +;;; \__\___||___/\__|___/ \__,_|_| |_|\__,_| |_|_|_| |_|_|\_\___/ +;;; +;; «tests-and-links» (to ".tests-and-links") +;; For each kind of here we have: +;; a) a test function that tests if the current buffer is of that kind, +;; b) a function that return hyperlinks for that kind of here. +;; +;; Idea: rename them, and use names like: +;; ee-here-info-p +;; ee-here-info-links + + + +;; Some tools for detecting which kind of buffer we're in. +(defun ee-buffer-re (re) + (if (string-match re (buffer-name)) + (match-string 1 (buffer-name)))) +(defun ee-buffer-eq (str) (string= str (buffer-name))) + +(defun ee-buffer-help0 () (ee-buffer-eq "*Help*")) +(defun ee-buffer-help-re0 (re n) + (if (ee-buffer-help0) + (save-excursion + (goto-char (point-min)) + (if (looking-at re) (match-string n))))) + +(defun ee-buffer-help (re n) (intern (or (ee-buffer-help-re0 re n) "nil"))) + + + +;; By major mode +(defun ee-grep-bufferp () (eq major-mode 'grep-mode)) +(defun ee-man-bufferp () (eq major-mode 'Man-mode)) +(defun ee-rcirc-bufferp () (eq major-mode 'rcirc-mode)) +(defun ee-info-bufferp () (eq major-mode 'Info-mode)) +(defun ee-dired-bufferp () (eq major-mode 'dired-mode)) +(defun ee-wdired-bufferp () (eq major-mode 'wdired-mode)) +(defun ee-w3m-bufferp () (eq major-mode 'w3m-mode)) +(defun ee-custom-bufferp () (eq major-mode 'Custom-mode)) +(defun ee-epackages-bufferp () (eq major-mode 'package-menu-mode)) + +;; By buffer name +(defun ee-intro-bufferp () (ee-buffer-re "^\\*(find-\\(.*\\)-intro)\\*$")) +(defun ee-freenode-bufferp () (ee-buffer-re "^\\(.*\\).freenode\\.net")) +(defun ee-ecolors-bufferp () (ee-buffer-eq "*Colors*")) +(defun ee-efaces-bufferp () (ee-buffer-eq "*Faces*")) +(defun ee-pdftext-bufferp () (ee-buffer-re "^pdftotext")) + +;; By buffer name (when it is "*Help*") +(defvar ee-efunctiondescr-re + "^\\([^ \t\n]+\\) is a[^\t\n]*\\(function\\|Lisp macro\\|special form\\)") +(defun ee-efunctiondescr-bufferp () (ee-buffer-help ee-efunctiondescr-re 1)) +(defun ee-find-efunctiondescr-links () + (let ((f (ee-efunctiondescr-bufferp))) + `((find-efunction-links ',f) + (find-efunctiondescr ',f)))) + +(defvar ee-evardescr-re "^\\([^ \t\n]+\\) is a variable") +(defun ee-evardescr-bufferp () (ee-buffer-help ee-evardescr-re 1)) +(defun ee-find-evardescr-links () + (let ((v (ee-evardescr-bufferp))) + `((find-evariable-links ',v) + (find-evardescr ',v)))) + +(defvar ee-efacedescr-re "^Face: \\([^ \t\n]+\\)") +(defun ee-efacedescr-bufferp () (ee-buffer-help ee-efacedescr-re 1)) +(defun ee-find-efacedescr-links () + (let ((f (ee-efacedescr-bufferp))) + `((find-eface-links ',f) + (find-efacedescr ',f)))) + +(defvar ee-epackage-re "^\\([^ \t\n]+\\) is a[ -~]+ package") +(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)))) + +;; By buffer name (when the mode is man) +(defvar ee-man-re "^\\*Man \\(.*\\)\\*$") +(defun ee-find-man-links () + (let ((mp (ee-buffer-re ee-man-re))) + `((find-man ,mp)))) + +(defvar ee-custom-re "^\\*Customize Group: \\(.*\\)\\*$") +(defun ee-find-custom-links () + (let* ((name (ee-buffer-re ee-custom-re)) + (symbol (intern (downcase (replace-regexp-in-string " " "-" name))))) + `((find-customizegroup ',symbol)))) + +;; Other cases +(defun ee-file-bufferp () buffer-file-name) + + +(defun ee-find-efaces-links () `((find-efaces))) +(defun ee-find-ecolors-links () `((find-ecolors))) +(defun ee-find-epackages-links () `((find-epackages))) +(defun ee-find-pdftext-links () (ee-pdflike-page-links)) + + + +;; to to: +;; ee-find-w3m-links +;; ee-find-ecolor-links +;; + +(defun ee-find-here-links () + (cond ;; by major mode + ((ee-info-bufferp) (cons "" (ee-find-info-links))) ; M-h M-i + ((ee-man-bufferp) (cons "" (ee-find-man-links))) ; ? + ((ee-grep-bufferp) (cons "" (ee-find-grep-links))) ; M-h M-g + ((ee-w3m-bufferp) (cons "" (ee-find-w3m-links))) ; M-h M-w + ((ee-dired-bufferp) (cons "" (ee-find-file-links))) ; M-h f + ((ee-wdired-bufferp) (cons "" (ee-find-file-links))) ; M-h f + ((ee-custom-bufferp) (cons "" (ee-find-custom-links))) ; ? + ((ee-epackages-bufferp) (cons "" (ee-find-epackages-links))) ; ? + ;; by buffer name + ((ee-intro-bufferp) (cons "" (ee-find-intro-links))) ; M-h M-i + ((ee-freenode-bufferp) (cons "" (ee-find-freenode-links))) ; ? + ((ee-ecolors-bufferp) (cons "" (ee-find-ecolors-links))) ; ? + ((ee-efaces-bufferp) (cons "" (ee-find-efaces-links))) ; ? + ((ee-pdftext-bufferp) (cons "" (ee-find-pdftext-links))) ; ? + ;; by buffer name, when it is "*Help*" + ((ee-efunctiondescr-bufferp) (cons "" (ee-find-efunctiondescr-links))) + ((ee-efacedescr-bufferp) (cons "" (ee-find-efacedescr-links))) + ((ee-evardescr-bufferp) (cons "" (ee-find-evardescr-links))) + ((ee-epackage-bufferp) (cons "" (ee-find-epackage-links))) + ;; other cases + ((ee-file-bufferp) (cons "" (ee-find-file-links))) ; M-h f + (t (list "" "Not implemented!" "See:" + '(find-efunction 'ee-find-here-links))) + )) + +(defun find-here-links-test (sexp) +"See: (find-links-intro \"`find-here-links'\")" + (find-wset "13o_2o_o" sexp '(find-here-links))) + +;; (find-man "1 cat") +;; (progn (find-man "1 cat") (buffer-name)) +;; (find-eevfile "eev-rcirc.el") + +(defun ee-find-here-links0 () + `(,(ee-H "See: ") + (find-eev-quick-intro "4.1. `find-here-links'") + (find-emacs-keys-intro "1. Basic keys (eev)" "M-h M-h") + (find-here-links-intro "4. `find-here-links-3'") + )) + + + +;;; __ _ _ _ _ _ _ +;;; / _(_)_ __ __| | | |__ ___ _ __ ___ | (_)_ __ | | _____ +;;; | |_| | '_ \ / _` |_____| '_ \ / _ \ '__/ _ \_____| | | '_ \| |/ / __| +;;; | _| | | | | (_| |_____| | | | __/ | | __/_____| | | | | | <\__ \ +;;; |_| |_|_| |_|\__,_| |_| |_|\___|_| \___| |_|_|_| |_|_|\_\___/ +;;; + +;; (find-find-links-links "\\M-h" "here" "") +;; +(defun find-here-links (&rest pos-spec-list) +"Visit a temporary buffer containing hyperlinks pointing to here." + (interactive) + (apply 'find-elinks + `(;; The first line of a find-here-links buffer DOES NOT + ;; regenerates the buffer - instead the first lines point to + ;; help pages. + ,@(ee-find-here-links0) + ,@(ee-find-here-links) + ) + pos-spec-list)) + +;; Test: (find-here-links) +;; (progn (find-enode "Screen") (find-here-links)) + + + +;;; _ _ +;;; | |__ ___ __ _(_)_ __ _ __ ___ _ __ +;;; | '_ \ / _ \/ _` | | '_ \| '_ \ / _ \ '__| +;;; | |_) | __/ (_| | | | | | | | | __/ | +;;; |_.__/ \___|\__, |_|_| |_|_| |_|\___|_| +;;; |___/ +;; +;; «find-here-links-beginner» (to ".find-here-links-beginner") +;; This is a hack for beginners that is explained in a tutorial. See: +;; (find-refining-intro "4. A tip for beginners") +;; (find-refining-intro "4. A tip for beginners" "find-here-links-beginner") +;; +(defun find-here-links-beginner (&optional arg) + "A variant of `find-here-links' that may create a three-window setting." + (interactive "P") + (if arg (find-here-links-3) (find-here-links))) + +;; «find-here-links-3» (to ".find-here-links-3") +;; See: (find-here-links-intro "4. `find-here-links-3'") +;; (find-here-links-intro "5. `find-here-links-1'") +;; +(defvar ee-window-configuration-before-M-h-M-3 nil) + +(defun find-here-links-3 () + "A variant of `find-here-links' that creates a three-window setting. +Before creating the three windows this function tries to save the +current window configuration to the variable +`ee-window-configuration-before-M-h-M-3', but if that variable is +not nil we abort instead of overwriting it. +See: (find-here-links-intro \"4. `find-here-links-3'\")" + (interactive) + (if ee-window-configuration-before-M-h-M-3 + (let ((overwrite + (yes-or-no-p "Overwrite `ee-window-configuration-before-M-h-M-3'? "))) + (if (not overwrite) + (error)))) + (setq ee-window-configuration-before-M-h-M-3 + (current-window-configuration)) + (find-wset "13_o2_o_coo" nil '(find-here-links) '(eejump-1))) + +(defun find-here-links-1 () + "Restore the window configuration before `find-here-links-3'. +See: (find-here-links-intro \"5. `find-here-links-1'\")" + (interactive) + (set-window-configuration ee-window-configuration-before-M-h-M-3) + (setq ee-window-configuration-before-M-h-M-3 nil)) + + + + + + + + +(provide 'eev-hlinks) + + + +;; Local Variables: +;; coding: utf-8-unix +;; no-byte-compile: t +;; End: diff --git a/eev-intro.el b/eev-intro.el index 92e6d8b..5d2022c 100644 --- a/eev-intro.el +++ b/eev-intro.el @@ -1,6 +1,6 @@ ;;; eev-intro.el --- sandboxed tutorials for eev, like (find-eev-quick-intro) -;; Copyright (C) 2013-2019 Free Software Foundation, Inc. +;; Copyright (C) 2013-2020 Free Software Foundation, Inc. ;; ;; This file is part of GNU eev. ;; @@ -19,7 +19,7 @@ ;; ;; Author: Eduardo Ochs <eduardoo...@gmail.com> ;; Maintainer: Eduardo Ochs <eduardoo...@gmail.com> -;; Version: 2019nov04 +;; Version: 2020feb20 ;; Keywords: e-scripts ;; ;; Latest version: <http://angg.twu.net/eev-current/eev-intro.el> @@ -91,6 +91,8 @@ ;; «.find-org-intro» (to "find-org-intro") ;; «.find-escripts-intro» (to "find-escripts-intro") +;; «.find-windows-beginner-intro» (to "find-windows-beginner-intro") + ;; Videos: ;; «.find-three-main-keys-intro» (to "find-three-main-keys-intro") ;; «.find-what-sexps-can-do-intro» (to "find-what-sexps-can-do-intro") @@ -327,7 +329,7 @@ start it again by typing \"~/eev\" again in the shell prompt. Eventually you will learn how go get out of everything and how to undo almost anything, _BUT THAT WILL NOT HAPPEN IN THE FIRST TEN MINUTES_. -This tutorial is intented to make you learn the most essential things +This tutorial is intended to make you learn the most essential things in the first ten minutes - including how to navigate in Emacs's manuals. @@ -372,7 +374,7 @@ line of the block below: `M-e' accepts several different numeric prefixes that alter its behavior. We are only interested in one of them now - `M-0 M-e' -highlights the sexp for a fraction of a second insted of executing it. +highlights the sexp for a fraction of a second instead of executing it. Try it above. @@ -433,7 +435,7 @@ or sudo apt-get install emacs-common-non-dfsg may work - but for \"...-non-dfsg\" packages may need you to -enable access to the \"non-free\" respository... ask for help if +enable access to the \"non-free\" repository... ask for help if you need! An important difference between elisp hyperlinks and browser @@ -982,7 +984,9 @@ active. So: `M-j' runs: (find-eejumps) -Let's try to understand this from both a user's point of view and +`find-eejumps' is explained in the next section. + +Let's try to understand `M-j' from both a user's point of view and from a technical point of view. We may have elisp one-liners that we want to be able to execute very @@ -1037,20 +1041,49 @@ as the \"target associated to nnn\". 7.2. The list of eejump targets ------------------------------- -If you type `M-j' without a prefix argument then it runs -`(find-eejumps)', that displays a help text followed by all the -current eejump targets as defuns, one in each line. Try it: +If you type `M-j' without a prefix argument it runs +`(find-eejumps)', that displays a temporary buffer with a header +with help and links and then a list of all the current eejump targets. +Try it: (eek \"M-j\") (find-eejumps) -You will see that two of those entries are: +The header is this: + + ;; Generated by: (find-eejumps) + ;; See: (find-eev-quick-intro \"7.1. `eejump'\" \"`M-j'\") + ;; (find-emacs-keys-intro \"1. Basic keys (eev)\") + ;; (find-emacs-keys-intro \"2. Key sequences\") + ;; For example, + ;; M-1 M-j runs: (find-fline \"~/TODO\") + ;; M-2 M-j runs: (find-emacs-keys-intro) + ;; M-5 M-j runs: (find-eev-quick-intro) + ;; Current eejump targets: + +Note that after the \"See:\" we have three elisp hyperlinks to +sections of tutorials, and after the \"For example:\" we have +three examples of how to run `M-j' with numeric prefixes; each +one of these examples is followed by the elisp hyperlink whose +action corresponds to running `M-j' with that prefix. + +That header is very beginner-friendly, and if you are a beginner +who only knows how to use `M-e' and `M-j' you can, and should, +use that header as your main starting point: every time that you +feel lost you can type `M-j' to go back to that header, and you +can use its links to navigate to the documentation for Emacs and +eev. + +That header is followed by a section that is very beginner +UN-friendly, that contains a series of defuns like these ones: (defun eejump-1 () (find-fline \"~/TODO\")) (defun eejump-5 () (find-eev-quick-intro)) + + 7.3. Defining eejump targets ---------------------------- We can define new eejump targets, or overwrite the current ones, by @@ -1091,7 +1124,7 @@ Let's start with an example. If we are editing a LaTeX file, say If our \"/tmp/foo.tex\" starts with these lines % (defun c () (interactive) (find-sh \"cd /tmp/; pdflatex foo.tex\")) - % (defun d () (interactive) (find-xpdfpage \"/tmp/foo.pdf\")) + % (defun d () (interactive) (find-pdf-page \"/tmp/foo.pdf\")) % (defun e () (interactive) (find-fline \"/tmp/foo.tex\")) and we execute these defuns, then from that point on `M-x c', `M-x d' @@ -1625,7 +1658,7 @@ variables by running this: (setq ee-info-file \"elisp\") The short hyperlink to an info node is only produced when Info is -visting a node in a manual whose name matches the variable +visiting a node in a manual whose name matches the variable `ee-info-file'. @@ -1716,7 +1749,7 @@ This section was moved to: ;;; |___/ ;; ;; «find-emacs-keys-intro» (to ".find-emacs-keys-intro") -;; (find-intro-links "emacs-keys") +;; Skel: (find-intro-links "emacs-keys") (defun find-emacs-keys-intro (&rest pos-spec-list) (interactive) (let ((ee-buffer-name "*(find-emacs-keys-intro)*")) @@ -1739,15 +1772,17 @@ The most basic keys of eev are: M-e - to follow a hyperlink. Mnemonic: \"(e)valuate\"/\"(e)xecute\". See: (find-eev-quick-intro \"2. Evaluating Lisp\") (find-eev-quick-intro \"3. Elisp hyperlinks\") + M-j - to jump to certain predefined places. In particular, + `M-j' takes you to a buffer with basic help and a + list of jump targets. See: + (find-eev-quick-intro \"7.2. The list of eejump targets\") + `M-2 M-j' takes you to this help page. + `M-5 M-j' takes you to: (find-eev-quick-intro) M-k - to go back. Mnemonic: \"(k)ill buffer\". See: (find-eev-quick-intro \"3. Elisp hyperlinks\" \"M-k\") M-K - to go back without killing the buffer. See: (find-eval-intro \"5. Going back\") (find-eval-intro \"5. Going back\" \"`M-K' instead of `M-k'\") - M-j - to jump to certain predefined places - in particular, - `M-j' takes you to the list of jump targets. - `M-2 M-j' takes you to this help page. - `M-5 M-j' takes you to: (find-eev-quick-intro) <f8> - See: (find-eev-quick-intro \"6. Controlling shell-like programs\") M-T - See: (find-eev-quick-intro \"6.3. Creating eepitch blocks: `M-T'\") @@ -1913,7 +1948,7 @@ M-B -- eewrap-escript-block (find-eev-quick-intro \"`M-B'\") ;;; ;; «find-eev-install-intro» (to ".find-eev-install-intro") -;; (find-intro-links "eev-install") +;; Skel: (find-intro-links "eev-install") (defun find-eev-install-intro (&rest pos-spec-list) (interactive) (let ((ee-buffer-name "*(find-eev-install-intro)*")) @@ -2358,7 +2393,7 @@ See: ;;; \___|\___| \_/ ;;; ;; This works as an index. -;; (find-intro-links "eev") +;; Skel: (find-intro-links "eev") ;; «find-eev-intro» (to ".find-eev-intro") (defun find-eev-intro (&rest rest) (interactive) @@ -2392,47 +2427,52 @@ recommended reading order. These are the basic ones: 8. (find-rcirc-intro) 9. (find-eev-install-intro) +This is a very basic tutorial intended mainly for M$ Windows +users: + + 10. (find-windows-beginner-intro) + These ones explain ideas, conventions, and usage patterns: - 10. (find-escripts-intro) - 11. (find-links-conv-intro) + 11. (find-escripts-intro) + 12. (find-links-conv-intro) These are older and more technical versions of sections of the eev-quick-intro: - 12. (find-eval-intro) - 13. (find-links-intro) - 14. (find-brxxx-intro) - 15. (find-wrap-intro) - 16. (find-eejump-intro) - 17. (find-anchors-intro) - 18. (find-code-c-d-intro) - 19. (find-psne-intro) + 13. (find-eval-intro) + 14. (find-links-intro) + 15. (find-brxxx-intro) + 16. (find-wrap-intro) + 17. (find-eejump-intro) + 18. (find-anchors-intro) + 19. (find-code-c-d-intro) + 10. (find-psne-intro) These are etcs: - 20. (find-multiwindow-intro) - 21. (find-templates-intro) - 22. (find-org-intro) - 23. (find-videos-intro) - 24. (find-what-sexps-can-do-intro) + 21. (find-multiwindow-intro) + 22. (find-templates-intro) + 23. (find-org-intro) + 24. (find-videos-intro) + 25. (find-what-sexps-can-do-intro) These ones explain advanced features that require extra setup: - 25. (find-prepared-intro) - 26. (find-bounded-intro) - 27. (find-channels-intro) + 26. (find-prepared-intro) + 27. (find-bounded-intro) + 28. (find-channels-intro) This one is used in a video: - 28. (find-three-main-keys-intro) + 29. (find-three-main-keys-intro) These ones are obsolete: - 29. (find-emacs-intro) - 30. (find-defun-intro) + 30. (find-emacs-intro) + 31. (find-defun-intro) -Item 23 is an index of old video tutorials, with scripts for +Item 24 is an index of old video tutorials, with scripts for downloading local copies of them and links to important positions in the videos. @@ -2523,7 +2563,7 @@ For the full lists of keybindings, see: ;;; |_| |_|\___|_| \___| |_|_|_| |_|_|\_\___/ ;;; ;; «find-here-links-intro» (to ".find-here-links-intro") -;; (find-intro-links "here-links") +;; Skel: (find-intro-links "here-links") (defun find-here-links-intro (&rest pos-spec-list) (interactive) (let ((ee-buffer-name "*(find-here-links-intro)*")) @@ -2817,7 +2857,7 @@ The next steps are to learn how: ;;; |___/ ;; ;; «find-refining-intro» (to ".find-refining-intro") -;; (find-intro-links "refining") +;; Skel: (find-intro-links "refining") (defun find-refining-intro (&rest pos-spec-list) (interactive) (let ((ee-buffer-name "*(find-refining-intro)*")) @@ -2879,7 +2919,7 @@ special way, according to its type: and the other arguments are interpreted (recursively) by `ee-goto-rest': - string -> jump to the next occurence of that string + string -> jump to the next occurrence of that string number -> move down n lines list -> evaluate the list @@ -3087,7 +3127,83 @@ The big figure below shows all the keys sequences: +5. Pointing to anchors +====================== +We saw in + + (find-eev-quick-intro \"8. Anchors\") + +how to create anchors and how to point to anchors in the same +file with `to', and we saw briefly in + + (find-eev-quick-intro \"9.2. Extra arguments to `code-c-d'\") + +that the extra argument `:anchor' in + + (code-c-d \"eev\" ee-eev-source-directory :anchor) + +let us abbreviate the links below, that point to anchors, + + (find-eevfile \"eev-blinks.el\" \"«find-wottb»\") + (find-anchor (ee-eevfile \"eev-blinks.el\") \"find-wottb\") + +as just: + + (find-eev \"eev-blinks.el\" \"find-wottb\") +If you are in a file that has anchors there are two key sequences +that you can use to create a link to that anchors in it very +quickly. Remember that `M-h M-w' is a variant of `M-w' that +copies the current line to the kill ring; as a bonus, `M-h M-w' +highlights the current line for a brief while, and displays this +message in the echo area: + + Copied the current line to the kill ring - use C-y to paste + +If you run `M-h M-w' with the prefix argument 1, i.e., with `M-1 +M-h M-w', it copies the previous anchor instead of the current +line. Try it now - `M-1 M-h M-w' will flash the \"find-wottb\" +above and will say: + + Copied \"find-wottb\" to the kill ring + +If you try `M-1 M-h M-w' at the target of this sexp, on in the +lines after the target, + + (find-eev \"eev-blinks.el\" \"find-wottb\") + +the anchor \"find-wottb\" will be copied to the kill ring... if +you then type `M-h M-h' or `M-h M-3', go to the line with + + (find-eevfile \"eev-blinks.el\") + +in it and type `M-h M-y' it will become this, + + (find-eevfile \"eev-blinks.el\" \"find-wottb\") + +that is ALMOST a link to the anchor \"find-wottb\" in the file +\"eev-blinks.el\" - we need to delete the \"file\" in +`find-eevfile' to make it become a link to an anchor. It turns +out that eev has a key that does exactly that: `M-h M--'. See: + + (eek \"M-h M-k M-h M-- ;; ee-shrink-hyperlink-at-eol\") + (find-eev \"eev-edit.el\" \"ee-shrink-hyperlink-at-eol\") + +I use this so much that I got used to typing this sequence of +keys VERY quickly: + + M-1 M-h M-w + M-h M-h + (<down> several times) + M-h M-2 + M-h M-y + M-h M-- + M-h M-w + +I don't touch-type, and for me it became natural do hold the meta +key down with my left thumb while I type `M-1hwhh' and +`M-h2hyh-hw'... I would be nice to have a way to do this same +series of actions using keys that are good for touch typists. @@ -3105,7 +3221,7 @@ The big figure below shows all the keys sequences: ;;; \___| \_/ \__,_|_| ;;; ;; «find-eval-intro» (to ".find-eval-intro") -;; (find-intro-links "eval") +;; Skel: (find-intro-links "eval") ;; (find-TH "eev-article" "hyperlinks") ;; http://angg.twu.net/eev-article.html#hyperlinks ;; file:///home/edrx/TH/L/eev-article.html#hyperlinks @@ -3160,14 +3276,14 @@ but eev-mode implements a shorthand for it: `M-e'. Try it here: `M-e' accepts several different numeric prefixes that alter its behavior. We are only interested in one of them now - `M-0 M-e' -highlights the sexp for a fraction of a second insted of +highlights the sexp for a fraction of a second instead of executing it. Try it above. In some rare occasions we might want to run something like `M-e' but without moving to the end of the line first. Eev-mode implements a key binding for that: `M-E' (meta-shift-e). As an exercise, try to use `M-0 M-E' at several positions below, to -hightlight the subsexps `(* 2 3)', `(* 4 5)', and `4'. +highlight the subsexps `(* 2 3)', `(* 4 5)', and `4'. (+ (* 2 3) (* 4 5)) @@ -3357,7 +3473,7 @@ special way, according to its type: and the other arguments are interpreted (recursively) by `ee-goto-rest': - string -> jump to the next occurence of that string + string -> jump to the next occurrence of that string number -> move down n lines list -> evaluate the list @@ -3393,7 +3509,7 @@ argument in the pos-spec-list by running `ee-format-as-anchor' on it [TODO: document this], and the ones based on `ee-goto-position-page' jump to the n-th \"page\" of a buffer if the first argument of the pos-spec-list is a number, n; for -exemple, if n is 234 that will jump to the 233-th formfeed (233 +example, if n is 234 that will jump to the 233-th formfeed (233 and not 234 because the page 1 is before the first formfeed). For more on \"pages\", see: @@ -3469,7 +3585,7 @@ keep the instructions visible. 10. More on functions ===================== -A symbol - for example `f' - can be both a varible and a +A symbol - for example `f' - can be both a variable and a function; its \"value as a variable\" and its \"value as a function\" are stored in different places. Try: @@ -3684,7 +3800,7 @@ hyperlinks in scripts] ;;; |_|_|_| |_|_|\_\___/ \___\___/|_| |_|\_/ \___|_| |_|\__|_|\___/|_| |_|___/ ;;; ;; «find-links-conv-intro» (to ".find-links-conv-intro") -;; (find-intro-links "links-conv") +;; Skel: (find-intro-links "links-conv") (defun find-links-conv-intro (&rest pos-spec-list) (interactive) (let ((ee-buffer-name "*(find-links-conv-intro)*")) @@ -3859,7 +3975,12 @@ We start from some observations: `find-code-pdf-page' as its associated debugging function, and so on. - f) If we call the hyperlinks in the items above \"non-basic\" + f) `find-here-links' and its variants create temporary buffers + that violate this convention: + + (find-links-intro \"5. The first line regenerates the buffer\") + + g) If we call the hyperlinks in the items above \"non-basic\" then we get - by exclusion! - a notion of what are \"basic hyperlinks\". @@ -3870,6 +3991,7 @@ and a hyperlink to the source file at the right: External processes: (find-eev \"eev-plinks.el\") `find-elinks': (find-eev \"eev-elinks.el\") `find-elinks'+`ee-template0': (find-eev \"eev-tlinks.el\") + `find-here-links': (find-eev \"eev-hlinks.el\") `code-c-d' and `find-code-c-d': (find-eev \"eev-code.el\") `code-pdf*' and `find-code-pdf*': (find-eev \"eev-pdflike.el\") @@ -4138,7 +4260,7 @@ be expanded later: ;;; | | | | | | <\__ \ ;;; |_|_|_| |_|_|\_\___/ ;;; -;; (find-intro-links "links") +;; Skel: (find-intro-links "links") ;; «find-links-intro» (to ".find-links-intro") (defun find-links-intro (&rest rest) (interactive) @@ -4377,11 +4499,10 @@ Most of the \"M-h commands\" generate buffers with elisp hyperlinks in which the the first line \"regenerates the buffers\". This means two things: - 1. You can copy the first to your notes, and it will work as a - link to that buffer. For example: + 1. You can copy the first line to your notes, and it will work + as a link to that buffer. Here are some examples of these + first lines: - (find-efunction 'next-line) - (find-evariable 'line-move-visual) (find-latex-links \"/tmp/mytest\") (find-latex-links \"~/latextest\") (find-code-pdf-links \"/usr/local/texlive/2019/texmf-dist/doc/asymptote/\" \"{c}\") @@ -4530,7 +4651,7 @@ scripts etc\] ;;; |_| ;; ;; «find-eepitch-intro» (to ".find-eepitch-intro") -;; (find-intro-links "eepitch") +;; Skel: (find-intro-links "eepitch") ;; (find-eev "eepitch.readme") (defun find-eepitch-intro (&rest rest) (interactive) @@ -5176,7 +5297,7 @@ What functions can generate target buffers: ;;; \_/\_/ |_| \__,_| .__/ ;;; |_| ;; -;; (find-intro-links "wrap") +;; Skel: (find-intro-links "wrap") ;; «find-wrap-intro» (to ".find-wrap-intro") (defun find-wrap-intro (&rest rest) (interactive) @@ -5670,7 +5791,7 @@ it is not empty, then `M-J' produces a definition for an Note that `M-J' is quite dumb - it doesn't check if the first \"word\" is a number, nor if the second is a sexp. Use it with care! Try using `M-J' on the \"a b ...\" lines below - you will -get useless definitons. +get useless definitions. a b c d a b c @@ -5702,7 +5823,7 @@ then you'll be attributing just a \"temporary\" meaning to ;;; \__,_|_| |_|\___|_| |_|\___/|_| |___/ ;;; ;; «find-anchors-intro» (to ".find-anchors-intro") -;; (find-intro-links "anchors") +;; Skel: (find-intro-links "anchors") (defun find-anchors-intro (&rest rest) (interactive) (let ((ee-buffer-name "*(find-anchors-intro)*")) @@ -5971,7 +6092,7 @@ lists, like this (NOTE: do not execute these defuns!): and they both invoke `ee-code-c-d', which does all the template work and returns a big string; `ee-code-c-d' passes its `rest' argument to a recursive function called `ee-code-c-d-rest', and -for each one of the suported keywords there is a corresponding +for each one of the supported keywords there is a corresponding function, also recursive; for `:info' it is called `ee-code-c-d-:info'. Their specifications are like this: @@ -7061,7 +7182,7 @@ The details on how to create these \"brxxx functions\" are here: ;;; \__,_|\__,_|\__,_|_|\___/_/ \_/ |_|\__,_|\___|\___/ ;;; ;; «find-audiovideo-intro» (to ".find-audiovideo-intro") -;; (find-intro-links "audiovideo") +;; Skel: (find-intro-links "audiovideo") (defun find-audiovideo-intro (&rest pos-spec-list) (interactive) (let ((ee-buffer-name "*(find-audiovideo-intro)*")) @@ -7151,8 +7272,8 @@ execute these sexps occasionally to check if they are really pointing to the right places, and then make further adjustments; we are not doing that yet. -The idea of a \"default audio/video file\" will be explained -later. +The idea of a \"default audio/video file\" will be explained in +section 4.4. @@ -7325,6 +7446,77 @@ Then try: +4.4. The default audio/video file +--------------------------------- +One of the things that the function `find-punchandjudyvideo' does +when executed is this: + + (setq ee-audiovideo-last 'find-punchandjudyvideo) + +It sets the \"default audio/video file\" - more precisely, it +sets the global variable `ee-audiovideo-last' that indicate that +the way to play again the \"default audio/video file\" is by +running the function `find-punchandjudyvideo'. + +This is similar to what the `find-xxxtext' functions do - they +store some information about the last PDF opened with a +`find-xxxtext' function into global variables. See: + + (find-pdf-like-intro \"11. How `M-h M-p' guesses everything\") + (find-pdf-like-intro \"11. How `M-h M-p' guesses everything\" \"find-xxxtext\") + +and, for more technical details: + + (find-eev-quick-intro \"9.1. `code-c-d'\") + (find-eev-quick-intro \"9.1. `code-c-d'\" \"find-code-c-d\") + (find-code-video \"punchandjudyvideo\" + \"~/eev-videos/Punch_and_Judy_Mark_Poulton-K6LmZ0A1s9U.mp4\") + +In section 2 we mentioned that the key `M-p' in `eev-avadj-mode' +does this: + + M-p play the default audio/video file at a time offset + +Let's see in practice what this means. If we run these three +sexps here, + + (code-video \"punchandjudyvideo\" \"~/eev-videos/Punch_and_Judy_Mark_Poulton-K6LmZ0A1s9U.mp4\") + (find-punchandjudyvideo \"1:17\" \"he will sing the baby to sleep\") + (eev-avadj-mode 1) + +we will a) define `find-punchandjudyvideo', b) set the global +variable `ee-audiovideo-last' to `find-punchandjudyvideo', c) +turn `eev-avadj-mode' on. Now `M-p' should work! If you type +`M-p' on any of the lines with timestamps below it will open the +default audio/video file at that timestamp. + + 0:00 + 0:10 calls the baby + 0:40 where's the baby + 1:04 right position + 1:17 he will sing the baby to sleep + 1:33 1-2-3 + 1:48 baby downstairs + 3:12 slaps + 3:50 1-2-3 + 4:34 you keep an eye on mr Punch + 4:46 hat + 5:03 hat + 5:25 did you see him? + 5:55 clown + 6:14 slaps + 6:52 sausages + 7:24 crocodile + 8:07 crocodile + sausages + 8:32 another scene + 8:39 fight + 9:03 clown + 9:45 mr punch + + + + + 5. Passing options to mplayer ============================= @@ -7465,7 +7657,7 @@ to `find-youtubedl-links' below: In the second one we get a buffer where all occurrences of \"{title}\" have been substituted by \"TITLE\", and all -occurrences of \"{ext-}\" by \".mp4\". What happenned was that +occurrences of \"{ext-}\" by \".mp4\". What happened was that (ee-youtubedl-guess* \"/tmp/\" \"abcdefghijk\") --> (\"/tmp/TITLE-abcdefghijk.mp4.part\") @@ -7576,7 +7768,7 @@ buffers, change the variables `ee-youtubedl-dir', `ee-youtubedl-dir2', ;;; |_| |_| |_|\__,_|_|\__|_| \_/\_/ |_|_| |_|\__,_|\___/ \_/\_/ ;;; ;; «find-multiwindow-intro» (to ".find-multiwindow-intro") -;; (find-intro-links "multiwindow") +;; Skel: (find-intro-links "multiwindow") (defun find-multiwindow-intro (&rest pos-spec-list) (interactive) (let ((ee-buffer-name "*(find-multiwindow-intro)*")) @@ -8014,7 +8206,7 @@ Here: ;;; |_| \___|_|_| \___| ;;; ;; «find-rcirc-intro» (to ".find-rcirc-intro") -;; (find-intro-links "rcirc") +;; Skel: (find-intro-links "rcirc") (defun find-rcirc-intro (&rest pos-spec-list) (interactive) (let ((ee-buffer-name "*(find-rcirc-intro)*")) @@ -8147,7 +8339,7 @@ We can apply this idea (find-eev-quick-intro \"7.4. Commands with very short names\") (find-eev-quick-intro \"7.4. Commands with very short names\" \"(defun c ()\") -to rcirc. If you connect occasionaly to the channels #eev, +to rcirc. If you connect occasionally to the channels #eev, #emacs, #git and #ruby, you can run this, or put these lines in your .emacs: @@ -8202,7 +8394,7 @@ See: ;;; |_| ;; ;; «find-templates-intro» (to ".find-templates-intro") -;; (find-intro-links "templates") +;; Skel: (find-intro-links "templates") (defun find-templates-intro (&rest rest) (interactive) (let ((ee-buffer-name "*(find-templates-intro)*")) @@ -8218,27 +8410,252 @@ It is meant as both a tutorial and a sandbox. -This into is currently GARBAGE. -It should be rewritten to become a tutorial on: +This intro is being rewritten! + + + + +1. Introduction +=============== +In dec/2019 I sent this e-mail to the eev mailing list: + + https://lists.gnu.org/archive/html/eev/2019-12/msg00001.html + +It was a kind of a call for help. It contained a very brief +explanation of how the \"templated\" functions of eev, like +`find-ekey-links' and `find-latex-links', are implemented, and +showed how people can write their own templated functions as +quick hacks. + +If you want to learn how to _use_ templated functions, start by: + + (find-eev-quick-intro \"4.2. `find-ekey-links' and friends\") + (find-eev-quick-intro \"7.5. `find-latex-links'\") + +If you want to look at the source code of the existing templated +functions, take a look at: + + (find-eev \"eev-elinks.el\") + (find-eev \"eev-tlinks.el\") + + (find-links-intro \"3. Elisp hyperlinks buffers conventions\") + +This tutorial is for people who want to learn how to _write_ +their own templated functions. + +To learn how to write your own templated functions you need to: + + 1) learn how to use `ee-template0' by reading its source code + and playing with examples in the source and here, + + 2) learn how to use `find-elinks' - same thing, + + 3) learn how to use `find-find-links-links', that is a horrible + kludge that works well enough so I never cleaned it up. + + + + + +2. `ee-template0' +================= +See: + + (find-efunction 'ee-template0) + (find-eev \"eev-template0.el\") + +Try: + + (ee-template00 \"a{(+ 2 3)}b\") + + (let ((hi \"Here: \") + (a 22) + (b 33)) + (ee-template00 \"{hi}{a}+{b}={(+ a b)}\")) + + (defun foo (a b) (ee-template00 \"{a}+{b}={(+ a b)}\")) + (foo 22 33) + + (ee-template0 \"{<} a{(+ 2 3)} {>}\") + + + + +3. `find-elinks' +================ +See: + + (find-efunction 'find-elinks) + (find-eev \"eev-elinks.el\" \"find-elinks\") + +Now try these examples. They are multi-line versions with +comments of the examples in the source file. + + (find-elinks + '((a sexp) + \"a string\") + ) + +Now try these examples. They are longer, multi-line versions of +the examples in the source file. + + (find-elinks + '((a sexp) + \"a string\") + ) + + (find-elinks + '((a sexp) + \"a string\") + \"st\") + + (find-elinks + '((a sexp) + \"a string\") + \"st\" \"i\") + + (find-elinks + '((a sexp) + (another sexp) + (sexps get comment signs) + (strings in sexps: \"foo bar\") + (newlines in strings in sexps get backslashed: \"\\n\") + (ticks in sexps: 'a '(b c)) + (nils in sexps: nil () (nil nil)) + \"a string\" + \"another string\" + \"strings don't get comment signs\" + \"empty strings become empty lines\" + \"\" + \"newlines in strings\\nbecome real newlines\" + \"nils are dropped:\" + nil + \"see?\" + \"\" + (another sexp) + ) + ) + +Normally the first argument to `find-elinks' is backquoted. See: + + (find-elnode \"Backquote\") + +Try: + + `(foo ,(+ 2 3) bar) + `(foo ,'(+ 2 3) bar) + `(foo ,(list 2 3) bar) + `(foo ,@(list 2 3) bar) + +See: + + (find-eev \"eev-elinks.el\" \"find-efunction-links\") + +The first argument to `find-elinks' is called LIST. Elements of +LIST that are sexps are converted to strings using `ee-HS'. See: + + (find-eev \"eev-wrap.el\" \"ee-S\") + + + +4. Skels +======== +Many functions in eev have comments that start with \";; Skel:\", +like this: + + ;; Skel: (find-find-links-links-new \"fossil\" \"url subdir c\" \"\") + +A comment like that before a function means that I wrote that +function by first running that sexp and then modifying the code +that that sexp generated, that was a \"skeleton\". + +Try: + + (find-find-links-links-new \"fossil\" \"url subdir c\" \"\") + (find-eev \"eev-tlinks.el\" \"find-fossil-links\") + (find-eevgrep \"grep --color -nH --null -e Skel: *.el\") + + + + + +5. `find-find-links-links' +========================== +ALL my `find-*-links' started as quick hacks. +SOME of them were useful enough to deserve being cleaned up. +A FEW of them ended up in: + + http://angg.twu.net/eev-current/eev-elinks.el.html + http://angg.twu.net/eev-current/eev-tlinks.el.html + (find-eev \"eev-elinks.el\") + (find-eev \"eev-tlinks.el\") + +...but there are lots of other `find-*-links' functions in: + + http://angg.twu.net/.emacs.templates.html + +They are trivial to write. I start with a skeleton that I obtain by +running `M-x find-find-links-links', and then I modify the first line +in that buffer, regenerate, modify, regenerate, and so on until happy. +Run each of the sexps below with `M-2 M-e' to compare the buffers that +they generate: + + (find-find-links-links \"{k}\" \"{stem}\" \"{args}\") + (find-find-links-links \"\\\\M-u\" \"{stem}\" \"{args}\") + (find-find-links-links \"\\\\M-u\" \"macports\" \"{args}\") + (find-find-links-links \"\\\\M-u\" \"macports\" \"pkgname\") + (find-find-links-links \"\\\\M-u\" \"macports\" \"pkgname anotherarg\") + + + + +So: start by running something like + + (find-find-links-links \"\\\\M-u\" \"macports\" \"pkgname\") + (find-find-links-links \"\\\\M-u\" \"homebrew\" \"pkgname\") + +then copy the + +\(define-key eev-mode-map \"\\M-h\\M-u\" 'find-macports-links) + +\(defun find-macports-links (&optional pkgname &rest pos-spec-list) +\"Visit a temporary buffer containing hyperlinks for foo.\" + (interactive) + (setq pkgname (or pkgname \"{pkgname}\")) + (apply 'find-elinks + `((find-macports-links ,pkgname ,@pos-spec-list) + ;; Convention: the first sexp always regenerates the buffer. + (find-efunction 'find-macports-links) + \"\" + ,(ee-template0 \"\\ +\") + ) + pos-spec-list)) + +;; Test: (find-macports-links ___) + +to your notes, replace the `(interactive)' by + + (interactive (list (ee-debpkgname-ask))) + +and start adding things to the string in (ee-template0 \"...\"). + +I will try to update this intro in the next days: - 1) How to use `ee-template0' and `find-elinks': + (find-templates-intro) + http://angg.twu.net/eev-intros/find-templates-intro.html - (find-eev \"eev-wrap.el\" \"ee-template0\") - (find-eev \"eev-elinks.el\" \"find-elinks\") - 2) A review of the conventions here: - (find-links-conv-intro) - (find-links-conv-intro \"3. Classification\") - 3) How some template functions like these - (find-eev \"eev-tlinks.el\" \"find-find-links-links\") - (find-eev \"eev-tlinks.el\" \"find-intro-links\") - (find-eev \"eev-wrap.el\" \"find-eewrap-links\") +Etc: - are used to create first versions for several functions in - eev... + (find-links-conv-intro) + (find-links-conv-intro \"3. Classification\") + (find-eev \"eev-tlinks.el\" \"find-find-links-links\") + (find-eev \"eev-tlinks.el\" \"find-intro-links\") + (find-eev \"eev-wrap.el\" \"find-eewrap-links\") " rest))) @@ -8485,7 +8902,7 @@ But try these: ;;; |_.__/ \___/ \__,_|_| |_|\__,_|\___|\__,_| ;;; ;; «find-bounded-intro» (to ".find-bounded-intro") -;; (find-intro-links "bounded") +;; Skel: (find-intro-links "bounded") (defun find-bounded-intro (&rest pos-spec-list) (interactive) (let ((ee-buffer-name "*(find-bounded-intro)*")) (apply 'find-eintro "\ @@ -8578,7 +8995,7 @@ so you should do something like this, but for your favourite key: ;;; \___|_| |_|\__,_|_| |_|_| |_|\___|_|___/ ;;; ;; «find-channels-intro» (to ".find-channels-intro") -;; (find-intro-links "channels") +;; Skel: (find-intro-links "channels") (defun find-channels-intro (&rest pos-spec-list) (interactive) (let ((ee-buffer-name "*(find-channels-intro)*")) @@ -8684,7 +9101,7 @@ and then: a python interpreter \"listening on channel A\"; 2) we use the top shell to send the lines \"print(2+3)\" and - \"exit()\" \"thorugh the channel A\". In low-level terms + \"exit()\" \"through the channel A\". In low-level terms this means that for each line a) we save it into the file \"$EEVTMPDIR/eeg.A.str\", @@ -9088,7 +9505,7 @@ How to set it up ;;; \_/ |_|\__,_|\___|\___/|___/ ;;; ;; «find-videos-intro» (to ".find-videos-intro") -;; (find-intro-links "videos") +;; Skel: (find-intro-links "videos") (defun find-videos-intro (&rest pos-spec-list) (interactive) (let ((ee-buffer-name "*(find-videos-intro)*")) @@ -9295,7 +9712,7 @@ player. All this is explained here: 30:21 remember that the first line regenerates the buffer... 31:07 we use that to select a directory for installation. 31:40 an eepitch block -31:53 emacs is made to handle anyting that looks like text... +31:53 emacs is made to handle anything that looks like text... 32:38 running terminals inside Emacs 32:52 the best of both worlds 33:50 f8 @@ -9388,7 +9805,7 @@ use this sexp to help you: ;;; \__,_|\___|_| \__,_|_| |_| ;;; ;; «find-defun-intro» (to ".find-defun-intro") -;; (find-intro-links "defun") +;; Skel: (find-intro-links "defun") (defun find-defun-intro (&rest rest) (interactive) (let ((ee-buffer-name "*(find-defun-intro)*")) @@ -9612,7 +10029,7 @@ returns nil. But just as ;;; \___|_| |_| |_|\__,_|\___|___/ |_|_| |_|\__|_| \___/ ;;; ;; «find-emacs-intro» (to ".find-emacs-intro") -;; (find-intro-links "emacs") +;; Skel: (find-intro-links "emacs") (defun find-emacs-intro (&rest rest) (interactive) (let ((ee-buffer-name "*(find-emacs-intro)*")) @@ -9806,7 +10223,7 @@ C-x e -- call-last-kbd-macro (find-enode \"Keyboard Macros\") ;; «find-org-intro» (to ".find-org-intro") -;; (find-intro-links "org") +;; Skel: (find-intro-links "org") (defun find-org-intro (&rest pos-spec-list) (interactive) (let ((ee-buffer-name "*(find-org-intro)*")) @@ -9905,12 +10322,15 @@ these notes. You can execute a source block in Org and display its results with `C-c C-c'. See: -# (find-orgnode \"Working With Source Code\") +# (find-orgnode \"Working with source code\") # (find-orgnode \"Evaluating code blocks\") +# (find-orgnode \"Evaluating code blocks\" \":results output\") +# (find-orgnode \"Results of evaluation\" \":results output\") +# (find-orgnode \"results\" \"output\") Try it here: -#+BEGIN_SRC sh +#+BEGIN_SRC sh :results output seq 200 204 #+END_SRC @@ -9920,7 +10340,7 @@ Compare that with: and compare -#+BEGIN_SRC python +#+BEGIN_SRC python :results output def square (x): return x*x @@ -9971,7 +10391,7 @@ How do I mark a section as \"don't export this\"? ;;; |_| ;; «find-escripts-intro» (to ".find-escripts-intro") -;; (find-intro-links "escripts") +;; Skel: (find-intro-links "escripts") (defun find-escripts-intro (&rest pos-spec-list) (interactive) (let ((ee-buffer-name "*(find-escripts-intro)*")) @@ -10665,6 +11085,394 @@ This can also be used to generate links to info nodes. +;;; __ ___ _ _ +;;; \ \ / / | | |__ ___ __ _(_)_ __ _ __ ___ _ __ +;;; \ \ /\ / / __)_____| '_ \ / _ \/ _` | | '_ \| '_ \ / _ \ '__| +;;; \ V V /\__ \_____| |_) | __/ (_| | | | | | | | | __/ | +;;; \_/\_/ ( / |_.__/ \___|\__, |_|_| |_|_| |_|\___|_| +;;; |_| |___/ +;; +;; «find-windows-beginner-intro» (to ".find-windows-beginner-intro") +;; Skel: (find-intro-links "windows-beginner") + +(defun find-windows-beginner-intro (&rest pos-spec-list) (interactive) + (let ((ee-buffer-name "*(find-windows-beginner-intro)*")) + (apply 'find-eintro "\ +\(Re)generate: (find-windows-beginner-intro) +Source code: (find-efunction 'find-windows-beginner-intro) +More intros: (find-eev-quick-intro) + (find-eval-intro) + (find-eepitch-intro) +This buffer is _temporary_ and _editable_. +It is meant as both a tutorial and a sandbox. +The quickest way to open or recreate this is with `M-3 M-j'. + + + + +This is a tutorial on how to install Emacs and eev on M$ Windows. +If you're a W$ user you should start by reading it online, at: + + http://angg.twu.net/eev-intros/find-windows-beginner-intro.html + +After getting eev installed on your machine you can access it +from Emacs by typing `M-3 M-j'. + + + + + +0. Introduction +=============== +My favorite exposition of what eev is is this presentation, called +\"How to record executable notes with eev - and how to play them back\": + + http://angg.twu.net/emacsconf2019.html + http://angg.twu.net/LATEX/2019emacsconf.pdf (slides) + http://www.youtube.com/watch?v=86yiRG8YJD0 (video) + +The video ends with a demo that shows a non-trivial example of +\"executable notes\". The most interesting part of that demo shows how +to use eev to send commands to an external program - a unix shell, +being run in interactive mode. Here's a link to that part (the t=938 +tells youtube to jump to 15:38): + + http://www.youtube.com/watch?v=86yiRG8YJD0&t=938 + +These notes are an attempt - ongoing, and work in progress! - to help +Windows users with installing Emacs, eev, and Lua, and with trying to +use Emacs on Windows to send commands to external programs - currently +first to the crappy shell that comes with Windows, and after that to +Lua. A future version of these instructions will also include how to +install Python, how to run it interactively from Emacs, and how to +send commands to it. + +I don't have easy access to Windows machines, so I'm having to ask +friends to try this for me. Also, Linux/*NIXes are Windows are +totally different planets - it's common for Windows people, even +programmers, to have practically zero experience with terminals, +a.k.a. with \"the Command Line\"... in *NIXes this is so inconceivable +that after discovering that many Windows programmers don't know how to +use terminals I spent more than one week trying to figure out how to +proceed. + +Version of these instructions: 2020feb20. + + + + +1. Download and install Emacs +============================= +Official instructions: +https://www.gnu.org/software/emacs/download.html#windows + +Download one of the .zips below: +http://gnu.c3sl.ufpr.br/ftp/emacs/windows/emacs-26/ +http://gnu.c3sl.ufpr.br/ftp/emacs/windows/emacs-26/README +http://gnu.c3sl.ufpr.br/ftp/emacs/windows/emacs-26/emacs-26.3-i686.zip (32 bits) +http://gnu.c3sl.ufpr.br/ftp/emacs/windows/emacs-26/emacs-26.3-x86_64.zip (64 bits) + +then unpack the .zip and create a desktop icon or shortcut to +<emacsdir>/bin/runemacs.exe. + +Note: don't use Emacs25 on Windows - it can't access the package repository! The details are here: +https://emacs.stackexchange.com/questions/233/how-to-proceed-on-package-el-signature-check-failure/52823#52823 + + + + +2. Key sequences and how to quit +================================ +Most people who use Emacs do many things by using key sequences - for +example `C-x C-s' to save the current file. + +`C-x C-s' is the Emacs notation for \"control-x control-s\". This +notation is explained here: + + (find-enode \"User Input\" \"<Ctrl>\" \"a\" \"C-a\") + (find-enode \"User Input\" \"<Meta>-a\" \"M-a\" \"<Alt>\") + +The best way to learn key sequences when you are a beginner is by +using the menu bar: + + (find-enode \"Menu Bar\") + +for example, in the \"File\" menu the last option is: + + Quit C-x C-c + +If you type just `C-x' and wait the `C-x' will be displayed in the +\"Echo area\" at the bottom of the screen. This is explained here: + + (find-enode \"Echo Area\") + + The line at the very bottom of the frame is the \"echo area\". It is + used to display small amounts of text for various purposes. + + The echo area is so-named because one of the things it is used + for is \"echoing\", which means displaying the characters of a + multi-character command as you type. Single-character commands are + not echoed. Multi-character commands (*note Keys) are echoed if you + pause for more than a second in the middle of a command. Emacs then + echoes all the characters of the command so far, to prompt you for + the rest. Once echoing has started, the rest of the command echoes + immediately as you type it. This behavior is designed to give + confident users fast response, while giving hesitant users maximum + feedback. + + The echo area is also used to display an \"error message\" when a + command cannot do its job. Error messages may be accompanied by + beeping or by flashing the screen. + +There are several ways to abort a key sequence in the middle. They +are explained here, + + (find-enode \"Quitting\") + +but what I recommend to beginners is: if you are stuck in the middle +of a key sequence and don't know how to abort it, just go to the +\"File\" menu, use the option \"Quit\", and restart Emacs. + + + + +3. Using M-x and installing eev +=============================== +We can run commands by name by using `M-x'. `M-x' uses the last line +of the screen as a \"minibuffer\" - see: + + (find-enode \"Minibuffer\") + (find-enode \"Basic Minibuffer\" \"it appears in the echo area\") + (find-enode \"M-x\" \"Running Commands by Name\") + +To install eev, + 1. run `M-x list-packages', + 2. select \"eev\" at the list of packages, + 3. click on \"install\". + +To load eev and enter its tutorial, run + `M-x eev-beginner'. + +The tutorial looks like this: + (find-eev-quick-intro) + + + + +4. Understanding buffers and the mode line +========================================== +It's good to be able to interpret the mode line - it gives a lot of +information about where we are. See: + + (find-enode \"Mode Line\") + +For example, after running `M-x eev-beginner' the mode line says this: + + -:**- *(find-eev-quick-intro)* Top L1 (Fundamental eev) --- + +The best way to understand what each component means is by moving the +mouse pointer onto it and looking at the help that is displayed. The +main components in this case are: + + \"**\" - this buffer is read-write and has been modified. See: + + (find-enode \"Mode Line\" \"**\") + + \"*(find-eev-quick-intro)*\" - the name of this buffer. + + A curiosity: this buffer is not associated to a file! If you + try to save it with `C-x C-s' or with the \"Save\" option in the + \"File\" menu you will get a prompt in the minibuffer that starts + with: + + File to save in: + + For more information on buffers and files, see: + + (find-enode \"Mode Line\" \" BUF \" \"name of the buffer\") + (find-enode \"Buffers\" \"Most buffers are made by visiting files\") + (find-enode \"Basic Files\") + + \"Top L1\" - see: + + (find-enode \"Mode Line\" \"Top\") + (find-enode \"Mode Line\" \"line number at point\") + (find-enode \"Point\") + + \"(Fundamental eev)\" - see: + + (find-enode \"Mode Line\" \"(MAJOR MINOR)\") + (find-enode \"Mode Line\" \"major mode\") + (find-enode \"Mode Line\" \"minor modes\") + + + + +5. More on modes +================ +The \"eev\" in the mode line means that the key bindings defined by eev +are \"active\". The main key bindings of eev are listed here, + + (find-emacs-keys-intro \"1. Basic keys (eev)\") + +and if you want more details about whats is an \"active keymap\" you can +read these sections of the manual: + + (find-enode \"Key Bindings\") + (find-enode \"Keymaps\") + (find-enode \"Local Keymaps\") + +The five main major modes that beginners need to learn about are the +Fundamental Mode, the Help Mode, the Info Mode, Dired Mode, and Shell +mode. In the Fundamental Mode most \"basic\" keys are interpreted as +editing keys - see: + + (find-enode \"Major Modes\" \"Fundamental mode\") + (find-enode \"Keymaps\" \"self-inserting character\") + + + + +5.1. Eev mode +------------- +The three main keys of Eev Mode are these ones: + + M-e - to follow a hyperlink. Mnemonic: \"(e)valuate\"/\"(e)xecute\". + See: (find-eev-quick-intro \"2. Evaluating Lisp\") + (find-eev-quick-intro \"3. Elisp hyperlinks\") + M-j - to jump to certain predefined places. In particular, + `M-j' takes you to a buffer with basic help and a + list of jump targets. See: + (find-eev-quick-intro \"7.2. The list of eejump targets\") + `M-2 M-j' takes you to this help page. + `M-5 M-j' takes you to: (find-eev-quick-intro) + M-k - to go back. Mnemonic: \"(k)ill buffer\". + See: (find-eev-quick-intro \"3. Elisp hyperlinks\" \"M-k\") + +The text above was taken from: + + (find-emacs-keys-intro \"1. Basic keys (eev)\") + +From this point onwards I will suppose that the reader knows how to +use at least `M-e' and `M-j'. + +Note the Eev mode is a global minor mode. The next subsections are +about the other four main major modes - besides Fundamental mode. + + + + +5.2. Help Mode +-------------- +Most help commands in Emacs display buffers in Help Mode. For +example, if you run `C-h f Info-mode' or execute one of the sexps +below + + (find-efunctiondescr 'Info-mode) + (find-efunctiondescr 'help-mode) + (find-efunctiondescr 'dired-mode) + +you will get buffers in Help Mode - they are read-only, and if you +type `q' in them this be interpreted as `quit' rather than as \"insert +the character `q'\". + + + +5.3. Info Mode +-------------- +The key sequence `C-h r' opens the Emacs manual in Info Mode. This is +a read-only mode like Help Mode, but more keys become navigation keys. +The main ones are: + + q Quit Info: reselect previously selected buffer. + RET Follow a node reference near point. + n Move to the \"next\" node of this node. + p Move to the \"previous\" node of this node. + u Move \"up\" from this node. + +Also, the tool bar changes completely, and it shows icons +corresponding to the main navigation keys. See: + + (find-enode \"Tool Bars\") + + + +5.4. Dired Mode +--------------- +Dired Mode lets you navigate the directory structure. You can enter +it by typing `C-x C-f RET'. If you type `RET' on a line that shows a +directory this will be interpreted as \"enter that directory\", and +`RET' on a line that shows a file is interpreted as \"open that file\". +See: + + (find-enode \"Dired\") + (find-enode \"Dired Enter\" \"C-x C-f\") + (find-enode \"ls in Lisp\") + + + +5.5. Shell Mode +--------------- +Emacs can run terminals inside its buffers - and by default that +terminal runs the default shell. In Windows the default shell is +\"cmd.exe\", that is reminiscent of MS-DOS, and is VERY clumsly. See: + + https://en.wikipedia.org/wiki/Windows_Console + https://en.wikipedia.org/wiki/Command-line_interface + https://en.wikipedia.org/wiki/MS-DOS#Windows_command-line_interface + https://en.wikipedia.org/wiki/Cmd.exe + https://en.wikipedia.org/wiki/Batch_file + https://en.wikipedia.org/wiki/Terminal_emulator + +If you run `M-x shell' you will get a shell buffer. See: + + (find-enode \"Interactive Shell\") + +especially this part of the first paragraph: + + To give input to the subshell, go to the end of the buffer and type + the input, terminated by <RET>. + +As an exercise, try to give these commands to the Windows shell: + + dir + cd + cd .. + dir + + + + +6. Lua +====== +Lua is a programming language that many people - like me - find +much better and much simpler than Python. The examples of +\"controlling shell-like programs\" in the main tutorials of eev +use Python because it comes installed by default in all modern +*NIXes... see: + + (find-eev-quick-intro \"6.2. Other targets\") + (find-eepitch-intro \"1.1. Another target\") + +but on Windows Lua is easier to install than Python, so let's +start by it and leave Python to a second stage. + +Try to follow the instructions here: + + (find-windows-eepitch-lua-links nil) + + +[Unfinished!!!] + + + + +" pos-spec-list))) + +;; (find-windows-beginner-intro) + + + ;;; _ _ _ _ @@ -10675,7 +11483,7 @@ This can also be used to generate links to info nodes. ;;; |___/ ;; «find-three-main-keys-intro» (to ".find-three-main-keys-intro") -;; (find-intro-links "three-main-keys") +;; Skel: (find-intro-links "three-main-keys") ;; (find-three-main-keys-intro) ;; Used in this video: @@ -10791,7 +11599,7 @@ line of the block below: `M-e' accepts several different numeric prefixes that alter its behavior. We are only interested in one of them now - `M-0 M-e' -highlights the sexp for a fraction of a second insted of executing it. +highlights the sexp for a fraction of a second instead of executing it. Try it above. Also: @@ -10958,7 +11766,7 @@ Btw, the videos that I produced using this \"script\" are here: ;;; |_| ;; ;; «find-what-sexps-can-do-intro» (to ".find-what-sexps-can-do-intro") -;; (find-intro-links "what-sexps-can-do") +;; Skel: (find-intro-links "what-sexps-can-do") (defun find-what-sexps-can-do-intro (&rest pos-spec-list) (interactive) (let ((ee-buffer-name "*(find-what-sexps-can-do-intro)*")) @@ -11078,7 +11886,7 @@ wget -nc http://angg.twu.net/eev-videos/Punch_and_Judy_Mark_Poulton-K6LmZ0A1s9U. ;; «find-creating-links-intro» (to ".find-creating-links-intro") -;; (find-intro-links "creating-links") +;; Skel: (find-intro-links "creating-links") (defun find-creating-links-intro (&rest pos-spec-list) (interactive) (let ((ee-buffer-name "*(find-creating-links-intro)*")) @@ -11125,7 +11933,7 @@ The beginner's way of creating \"hyperlinks to here\" is with: -;; (find-intro-links "creating-links") +;; Skel: (find-intro-links "creating-links") diff --git a/eev-load.el b/eev-load.el index b6ddd2d..547629e 100644 --- a/eev-load.el +++ b/eev-load.el @@ -1,7 +1,7 @@ ;;; eev-load.el -- load all the main modules of eev. ;;; This can also be used as an index to the main source files. -;; Copyright (C) 2019 Free Software Foundation, Inc. +;; Copyright (C) 2019-2020 Free Software Foundation, Inc. ;; ;; This file is part of GNU eev. ;; @@ -104,6 +104,7 @@ (require 'eev-plinks) ; (find-eev "eev-plinks.el") (require 'eev-elinks) ; (find-eev "eev-elinks.el") (require 'eev-tlinks) ; (find-eev "eev-tlinks.el") +(require 'eev-hlinks) ; (find-eev "eev-hlinks.el") ;; ;; The `brxxx' functions. See: ;; (find-eev-quick-intro "3.1. Non-elisp hyperlinks") diff --git a/eev-mode.el b/eev-mode.el index 8304f66..ea9adf8 100644 --- a/eev-mode.el +++ b/eev-mode.el @@ -19,7 +19,7 @@ ;; ;; Author: Eduardo Ochs <eduardoo...@gmail.com> ;; Maintainer: Eduardo Ochs <eduardoo...@gmail.com> -;; Version: 2019oct16 +;; Version: 2020feb20 ;; Keywords: e-scripts ;; ;; Latest version: <http://angg.twu.net/eev-current/eev-mode.el> @@ -118,6 +118,7 @@ and: (find-eval-intro \"`M-k'\")" ;; Source: (find-eev "eev-elinks.el") (define-key eev-mode-map "\M-h\M-a" 'find-code-audiovideo-links) (define-key eev-mode-map "\M-h\M-d" 'find-debpkg-links) + (define-key eev-mode-map "\M-h\M-e" 'find-extra-file-links) (define-key eev-mode-map "\M-h\M-f" 'find-efunction-links) (define-key eev-mode-map "\M-h\M-g" 'find-grep-links) (define-key eev-mode-map "\M-h\M-h" 'find-here-links) diff --git a/eev-testblocks.el b/eev-testblocks.el index 538b921..33e1a04 100644 --- a/eev-testblocks.el +++ b/eev-testblocks.el @@ -60,6 +60,7 @@ ((eq major-mode 'ruby-mode) (ee-insert-test-ruby)) ((eq major-mode 'sh-mode) (ee-insert-test-sh)) ((eq major-mode 'tcl-mode) (ee-insert-test-tcl)) + ((eq major-mode 'idris-mode) (ee-insert-test-idris)) (t (error "ee-insert-test: Unsupported major mode")))) (defun ee-insert-test-lua () @@ -122,6 +123,15 @@ source %s } " (buffer-name)))) +(defun ee-insert-test-idris () + (interactive) + (insert (format " +{- + (eepitch-to-buffer \"*idris-repl*\") + +-} +" (buffer-name)))) + diff --git a/eev-tlinks.el b/eev-tlinks.el index 56b84e1..0fd6f32 100644 --- a/eev-tlinks.el +++ b/eev-tlinks.el @@ -1,6 +1,6 @@ ;;; eev-tlinks.el --- hyperlinks to temporary buffers generated by templates -;; Copyright (C) 2013-2019 Free Software Foundation, Inc. +;; Copyright (C) 2013-2020 Free Software Foundation, Inc. ;; ;; This file is part of GNU eev. ;; @@ -19,7 +19,7 @@ ;; ;; Author: Eduardo Ochs <eduardoo...@gmail.com> ;; Maintainer: Eduardo Ochs <eduardoo...@gmail.com> -;; Version: 2019oct14 +;; Version: 2020feb20 ;; Keywords: e-scripts ;; ;; Latest version: <http://angg.twu.net/eev-current/eev-tlinks.el> @@ -41,6 +41,10 @@ ;; The functions here are one complexity step above the functions in: ;; (find-eev "eev-elinks.el") ;; +;; See: +;; (find-links-conv-intro "3. Classification") +;; (find-links-conv-intro "3. Classification" "find-elinks") + ;; NOTE (written in 2019mar05): some of the functions here are very ;; old and ugly and I haven't used them in ages. They will be deleted ;; in the next few months. @@ -51,25 +55,31 @@ -;; «.ee-copy-rest» (to "ee-copy-rest") +;; «.ee-copy-rest» (to "ee-copy-rest") ;; -;; «.find-find-links-links» (to "find-find-links-links") -;; «.find-intro-links» (to "find-intro-links") -;; «.find-pdflikedef-links» (to "find-pdflikedef-links") -;; «.find-eev-header-links» (to "find-eev-header-links") +;; «.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") ;; -;; «.find-debpkg-links» (to "find-debpkg-links") -;; «.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") -;; «.find-psne-links» (to "find-psne-links") -;; «.find-git-links» (to "find-git-links") -;; «.find-apt-get-source-links» (to "find-apt-get-source-links") -;; «.find-eev-video-links» (to "find-eev-video-links") +;; «.find-intro-links» (to "find-intro-links") +;; «.find-pdflikedef-links» (to "find-pdflikedef-links") +;; «.find-eev-header-links» (to "find-eev-header-links") ;; -;; «.find-latex-links» (to "find-latex-links") -;; «.find-lua-links» (to "find-lua-links") -;; «.find-escreenshot-links» (to "find-escreenshot-links") +;; «.find-debpkg-links» (to "find-debpkg-links") +;; «.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") +;; «.find-psne-links» (to "find-psne-links") +;; «.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-eev-video-links» (to "find-eev-video-links") +;; +;; «.find-latex-links» (to "find-latex-links") +;; «.find-lua-links» (to "find-lua-links") +;; «.find-escreenshot-links» (to "find-escreenshot-links") +;; «.find-windows-eepitch-lua-links» (to "find-windows-eepitch-lua-links") +;; «.find-extra-file-links» (to "find-extra-file-links") (require 'eev-env) @@ -202,9 +212,8 @@ See: (find-eev \"eev-tlinks.el\" \"ee-copy-rest\")" ;;; ;; ;; «find-find-links-links» (to ".find-find-links-links") -;; See: -;; (find-eev "eev-template.el" "find-find-links-links") -;; (find-find-links-links "u" "find-links" "k stem args") +;; See: (find-templates-intro "horrible" "kludge") +;; Test: (find-find-links-links "u" "find-links" "k stem args") (defun ee-prepend-commas (str) (save-match-data @@ -262,6 +271,141 @@ 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") +;; (ee-ffll-comma-args "plic bletch") +;; (find-estring (ee-ffll-setqs " " "foo bar")) +;; (find-estring (ee-ffll-lets " " "foo bar")) +;; (find-estring-elisp (ee-ffll-defun-without-lets "mytask" "foo bar")) +;; (find-estring-elisp (ee-ffll-defun-with-lets "mytask" "foo bar" "plc bltch")) +;; (find-estring-elisp (ee-ffll-defun "mytask" "foo bar")) +;; (find-estring-elisp (ee-ffll-defun "mytask" "foo bar" "plic bletch")) +;; +(defun ee-ffll-optional (args) + (if (< 0 (length (split-string args))) + (concat "&optional " args " ") + "")) + +(defun ee-ffll-setqs (spaces args) + (mapconcat (lambda (arg) (format "%s(setq %s (or %s \"{%s}\"))\n" + spaces arg arg arg)) + (split-string args) + "")) + +(defun ee-ffll-lets (spaces vars) + (format "let* (%s)" + (mapconcat (lambda (var) (format "(%s \"{%s}\")" var var)) + (split-string vars) + (concat "\n" spaces " ")))) + +(defun ee-ffll-comma-args (args) + (mapconcat (lambda (arg) (format ",%s " arg)) + (split-string args) + "")) + +(defun ee-ffll-defun-without-lets (stem args) + (let* ((optional (ee-ffll-optional args)) + (setqs (ee-ffll-setqs " " args)) + (comma-args (ee-ffll-comma-args args)) + ) + (ee-template0 "\ +(defun find-{stem}-links ({optional}&rest pos-spec-list) +\"Visit a temporary buffer containing hyperlinks for {stem}.\" + (interactive) +{setqs}\ + (apply + 'find-elinks + `((find-{stem}-links {comma-args},@pos-spec-list) + ;; Convention: the first sexp always regenerates the buffer. + (find-efunction 'find-{stem}-links) + \"\" + ,(ee-template0 \"\\ +\") + ) + pos-spec-list)) +"))) + +(defun ee-ffll-defun-with-lets (stem args vars) + (let* ((optional (ee-ffll-optional args)) + (setqs (ee-ffll-setqs " " args)) + (comma-args (ee-ffll-comma-args args)) + (lets (ee-ffll-lets " " vars)) + ) + (ee-template0 "\ +(defun find-{stem}-links ({optional}&rest pos-spec-list) +\"Visit a temporary buffer containing hyperlinks for {stem}.\" + (interactive) +{setqs}\ + ({lets} + (apply + 'find-elinks + `((find-{stem}-links {comma-args},@pos-spec-list) + ;; Convention: the first sexp always regenerates the buffer. + (find-efunction 'find-{stem}-links) + \"\" + ,(ee-template0 \"\\ +\") + ) + pos-spec-list))) +"))) + +(defun ee-ffll-defun (stem args &optional vars) + (if (equal vars "") (setq vars nil)) + (if vars (ee-ffll-defun-with-lets stem args vars) + (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)) + + + + + + + + ;;; _ _ _ _ _ ;;; (_)_ __ | |_ _ __ ___ | (_)_ __ | | _____ ;;; | | '_ \| __| '__/ _ \ _____| | | '_ \| |/ / __| @@ -289,7 +433,7 @@ See: (find-eev \"eev-intro.el\")" ;; (find-{stem}-intro) ;; <find-{stem}-intro> -;; (find-intro-links \"{stem}\") +;; Skel: (find-intro-links \"{stem}\") \(defun find-{stem}-intro (&rest pos-spec-list) (interactive) (let ((ee-buffer-name \"*(find-{stem}-intro)*\")) @@ -1088,9 +1232,10 @@ cd {ee-git-dir} git clone {url} cd {dir} +export PAGER=cat git branch --list -a git for-each-ref -PAGER=cat git log --oneline --graph --all -20 +git log --oneline --graph --all -20 # (find-fline \"{ee-git-dir}\") # (find-fline \"{dir}\") @@ -1113,6 +1258,61 @@ PAGER=cat git log --oneline --graph --all -20 + +;; «find-fossil-links» (to ".find-fossil-links") +;; Skel: (find-find-links-links-new "fossil" "url subdir c" "") +;; Test: (find-fossil-links "http://fossil.0branch.com/oorexx-mode") +;; See: https://fossil-scm.org/ +;; +(defun ee-fossil-url-stem (url) (ee-git-url-stem url)) + +(defun find-fossil-links (&optional url subdir c &rest pos-spec-list) +"Visit a temporary buffer containing hyperlinks for fossil." + (interactive (list (ee-url-at-point))) + (setq url (or url "{url}")) + (setq subdir (or subdir (ee-fossil-url-stem url) "{subdir}")) + (setq c (or c (replace-regexp-in-string "[-.]" "" subdir) "{c}")) + (apply + 'find-elinks + `((find-fossil-links ,url ,subdir ,c ,@pos-spec-list) + (find-fossil-links "{url}" "{subdir}" "{c}") + ;; Convention: the first sexp always regenerates the buffer. + (find-efunction 'find-fossil-links) + "" + ,(ee-template0 "\ +# (find-sh \"fossil help\") +# (find-sh \"fossil help clone\") +# (find-sh \"fossil help pull\") +# (find-sh \"fossil help all\") +# (find-sh \"fossil help open\") + + (eepitch-shell) + (eepitch-kill) + (eepitch-shell) +# rm -fv ~/usrc/fossil-repos/{subdir}.fsl +mkdir -p ~/usrc/fossil-repos/ +cd ~/usrc/fossil-repos/ + +fossil clone {url} {subdir}.fsl +fossil pull {url} -R {subdir}.fsl +fossil all ls + +# cd ~/usrc/{subdir}/ && fossil close +# rm -Rfv ~/usrc/{subdir}/ +mkdir -p ~/usrc/{subdir}/ +cd ~/usrc/{subdir}/ +fossil open ~/usrc/fossil-repos/{subdir}.fsl + +# (code-c-d \"{c}\" \"~/usrc/{subdir}/\") +# (find-{c}file \"\") +") + ) + pos-spec-list)) + + + + + ;;; _ _ ;;; __ _ _ __ | |_ __ _ ___| |_ ___ ___ _ _ _ __ ___ ___ ;;; / _` | '_ \| __|____ / _` |/ _ \ __|____/ __|/ _ \| | | | '__/ __/ _ \ @@ -1332,6 +1532,8 @@ echo 'http://angg.twu.net/eev-videos/{anggstem}.mp4' >> ~/.psne.log ;; Tests: (find-latex-links) ;; (find-latex-links "/tmp/foo") +;; (find-latex-links "/tmp/foo" 2) +;; (find-latex-links "/tmp/foo" 2 "copy-rest") @@ -1471,6 +1673,174 @@ dofile \"{fname0}\" + + +;; «find-windows-eepitch-lua-links» (to ".find-windows-eepitch-lua-links") +;; Skel: (find-find-links-links-new "windows-eepitch-lua" "dir" "") +;; Test: (find-windows-eepitch-lua-links "/tmp/") +;; +(defun find-windows-eepitch-lua-links (&optional dir &rest pos-spec-list) +"Visit a temporary buffer that helps in setting up `eepitch-lua52's on M$ Windows." + (interactive) + ;; (setq dir (or dir "{dir}")) + (setq dir (or dir default-directory)) + (apply + 'find-elinks-elisp + `((find-windows-eepitch-lua-links ,dir ,@pos-spec-list) + (find-windows-eepitch-lua-links "{dir}" ,@pos-spec-list) + ;; Convention: the first sexp always regenerates the buffer. + ;; (find-efunction 'find-windows-eepitch-lua-links) + "" + ,(ee-template0 "\ +;; Instructions: +;; To configure the `eepitch-lua52' function on M$ Windows, do this: +;; +;; 1) Install ZeroBrane from: +;; https://studio.zerobrane.com/ +;; +;; 2) Find the directory inside the ZeroBrane installation that +;; has the file lua52.exe. +;; +;; 3) Open that directory in Emacs using Dired - see: +;; (find-node \"(emacs)Dired\") +;; Hints: use RET to enter into a subdirectory; use M-k to go back; +;; you may start here: +;; (find-fline \"C:/\") +;; +;; 4) Run `M-x find-windows-eepitch-lua-links' there. You should get +;; a buffer like this one, but with that directory in the first line. +;; This is like adjusting the parameter of `find-latex-links', +;; but the value of \"{<}dir{>}\" is set to the current directory. See: +;; (find-eev-quick-intro \"7.5. `find-latex-links'\") +;; +;; 5) Test if you've got the correct \"{<}dir{>}\". If you got it +;; right then the sexp below should open that directory and go to +;; line where the \"lua52.exe\" is: +;; (find-fline \"{dir}\" \"lua52.exe\") +;; +;; 6) Try the sexp below - it is a low-level test to see a) if our +;; current path to \"lua52.exe\" is the right one AND b) if we can run +;; that \"lua52.exe\" as a \"shell-like program\" in a target buffer. +;; These ideas are explained here, +;; (find-eev-quick-intro \"6.1. The main key: <F8>\") +;; (find-eepitch-intro \"1.1. Another target\") +;; and the test sexp is: +;; (eepitch-comint \"lua52\" \"{dir}lua52.exe\") +;; +;; 7) If you got a prompt like this one +;; +;; Lua 5.2.4 Copyright (C) 1994-2015 Lua.org, PUC-Rio +;; > +;; +;; in the right window in the test in item (6) then everything is +;; working. If you didn't get a prompt like that then you NEED to run +;; this before performing another test: +;; (eepitch-kill) +;; +;; 8) Override the current definition of eepitch-lua52 by running this: + +(defun eepitch-lua52 () (interactive) + (eepitch-comint \"lua52\" + \"{dir}lua52.exe\")) + +;; Note that it is a 3-line sexp! If you execute it with `M-e' +;; the result in the echo area should be \"eepitch-lua52\". +;; +;; 9) Test if the eepitch block below works: run it by typing +;; `<f8>'s on its three red star lines, and then `<f8>'s on its three +;; non-red star lines. + + (eepitch-lua52) + (eepitch-kill) + (eepitch-lua52) +print(2+3) +for i=2,20,3 do print(i) end +os.exit() + +") + ) + pos-spec-list)) + + + + + +;; «find-extra-file-links» (to ".find-extra-file-links") +;; Skel: (find-find-links-links-new "extra-file" "fname c" "dir") +;; +(defun find-extra-file-links (&optional fname c &rest pos-spec-list) +"Visit a temporary buffer containing hyperlinks for extra-file." + (interactive (list (and (eq major-mode 'dired-mode) (ee-dired-to-fname)))) + (if fname (setq fname (ee-shorten-file-name fname))) + (setq fname (or fname "{fname}")) + (setq c (or c "{c}")) + (let* ((dir (file-name-directory fname))) + (apply + 'find-elinks-elisp + `((find-extra-file-links ,fname ,c ,@pos-spec-list) + ;; Convention: the first sexp always regenerates the buffer. + ;; (find-efunction 'find-extra-file-links) + ;; "" + ,(ee-template0 "\ +;; See: (find-eev-quick-intro \"9.1. `code-c-d'\") +;; (find-pdf-like-intro \"9. Generating three pairs\" \"`M-h M-p'\") +;; (find-audiovideo-intro \"2.1. `find-extra-file-links'\") + +;; Links to this directory: +;; (find-fline {(ee-S (file-name-directory fname))}) +\(code-c-d \"{c}\" \"{(file-name-directory fname)}\") +;; (find-{c}file \"\") + +;; Links to a PDF file: +;; (find-pdf-page \"{fname}\") +;; (find-pdf-text \"{fname}\") +\(code-pdf-page \"{c}\" \"{fname}\") +\(code-pdf-text \"{c}\" \"{fname}\") +;; (find-{c}page) +;; (find-{c}text) + +;; Links to an audio file: +;; (find-audio \"{fname}\") +\(code-audio \"{c}audio\" \"{fname}\") +;; (find-{c}audio) +;; (find-{c}audio \"0:00\") + +;; Links to a video file: +;; (find-video \"{fname}\") +\(code-video \"{c}video\" \"{fname}\") +;; (find-{c}video) +;; (find-{c}video \"0:00\") +;; +;; (eev-avadj-mode 0) +;; (eev-avadj-mode) + +;; Links to an shell-like program (for eepitch): +;; (eepitch-comint \"{c}\" \"{fname}\") + +(defun eepitch-{c} () (interactive) + (eepitch-comint \"{c}\" + \"{fname}\")) + +;; Test: + + (eepitch-{c}) + (eepitch-kill) + (eepitch-{c}) +") + ) + pos-spec-list))) + +;; Tests: +;; (find-extra-file-links "~/eev-videos/three-keys-2.mp4") + + + + + + + + + (provide 'eev-tlinks)