[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eev fff4f9b 1/4: Added `find-eeit-links' and \'find-ema
From: |
Stefan Monnier |
Subject: |
[elpa] externals/eev fff4f9b 1/4: Added `find-eeit-links' and \'find-emacs-tangents-links' |
Date: |
Tue, 13 Oct 2020 23:39:55 -0400 (EDT) |
branch: externals/eev
commit fff4f9b0f00147434cb38911451cd329819bd79a
Author: Eduardo Ochs <eduardoochs@gmail.com>
Commit: Eduardo Ochs <eduardoochs@gmail.com>
Added `find-eeit-links' and \'find-emacs-tangents-links'
---
ChangeLog | 44 +++++++
VERSION | 4 +-
eejump.el | 1 +
eev-elinks.el | 126 ++++++++++++++-----
eev-intro.el | 364 ++++++++++++++++++++++++++++++++++--------------------
eev-testblocks.el | 60 ++++-----
eev-tlinks.el | 121 ++++++++++++++++--
eev-wrap.el | 4 +
8 files changed, 519 insertions(+), 205 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8ed98cd..7ab38bf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,47 @@
+2020-10-10 Eduardo Ochs <eduardoochs@gmail.com>
+
+ * eev-testblocks.el (ee-insert-test-tuareg-mode): new function.
+ (ee-insert-test-idris-mode): deleted.
+
+ * eev-elinks.el (ee-package-dir): new function.
+ (ee-package-desc): new function.
+ (ee-package-findelpafiles): new function.
+ (ee-find-epackage-links0): total rewrite.
+ (find-epackage-links): total rewrite.
+
+2020-10-09 Eduardo Ochs <eduardoochs@gmail.com>
+
+ * eev-tlinks.el (find-eeit-links): new function.
+
+ * eev-intro.el (find-eepitch-intro): new section: "3.1.
+ `find-eeit-links'".
+
+2020-10-06 Eduardo Ochs <eduardoochs@gmail.com>
+
+ * eev-intro.el (find-windows-beginner-intro): added instructions
+ to run `M-x package-initialize'.
+ (find-templates-intro): added more references to
+ `find-find-links-links-new'.
+ (find-links-intro): marked as obsolete.
+ (find-eval-intro): moved the section on byte-compiled functions to
+ `(find-elisp-intro)'.
+ (find-elisp-intro): new sections: "11. Byte-compiled functions",
+ "11.1. Why eev avoids byte-compilation", and "11.2. How
+ `find-efunction' works". They were taken from `(find-eval-intro)'
+ and slightly rewritten.
+
+ * eev-tlinks.el (find-emacs-tangents-links): new function.
+ (find-intro-links): rewrote using `find-find-links-links-new'.
+
+ * eejump.el (eejump-50): new function - now `M-5 M-0 M-j' opens
+ `(find-eev-intro)'.
+
+2020-10-04 Eduardo Ochs <eduardoochs@gmail.com>
+
+ * eev-intro.el (find-eev-quick-intro): added pointers to a new
+ video to the installation instructions and deleted the pointers to
+ very old videos.
+
2020-10-02 Eduardo Ochs <eduardoochs@gmail.com>
* eev-intro.el (find-psne-intro): added two new sections, one on
diff --git a/VERSION b/VERSION
index 9b43c11..2d27046 100644
--- a/VERSION
+++ b/VERSION
@@ -1,2 +1,2 @@
-Sun Oct 4 09:22:54 GMT 2020
-Sun Oct 4 06:22:54 -03 2020
+Sat Oct 10 07:04:21 GMT 2020
+Sat Oct 10 04:04:21 -03 2020
diff --git a/eejump.el b/eejump.el
index 7d9440e..6aa7b52 100644
--- a/eejump.el
+++ b/eejump.el
@@ -103,6 +103,7 @@ See: (find-eejump-intro \"\\neejump\\n\")"
(defun eejump-2 () (find-emacs-keys-intro))
(defun eejump-3 () (find-windows-beginner-intro))
(defun eejump-5 () (find-eev-quick-intro))
+(defun eejump-50 () (find-eev-intro))
(defun eejump-6 () (find-escripts-intro))
(defun eejump-10 () (set-frame-font "5x7" t))
diff --git a/eev-elinks.el b/eev-elinks.el
index edcd91d..e8e4c78 100644
--- a/eev-elinks.el
+++ b/eev-elinks.el
@@ -76,6 +76,7 @@
;; «.find-eface-links» (to "find-eface-links")
;; «.find-color-links» (to "find-color-links")
;; «.find-epackage-links» (to "find-epackage-links")
+;; «.ee-package-dir» (to "ee-package-dir")
;; «.find-code-pdf-links» (to "find-code-pdf-links")
;; «.find-pdf-links» (to "find-pdf-links")
@@ -1117,59 +1118,124 @@ This needs a temporary directory; see:
(find-prepared-intro)"
;;; |_| |___/
;;
;; «find-epackage-links» (to ".find-epackage-links")
-;; Skel: (find-find-links-links-new "epackage" "pkgname" "")
-;; Tests: (find-epackage-links "0x0")
-;; (find-estring (ee-find-epackage-links0 "0x0"))
-;;
-(defun find-epackage-links (&optional pkgname &rest pos-spec-list)
-"Visit a temporary buffer containing hyperlinks for an Emacs package."
- (interactive)
- (setq pkgname (or pkgname "{pkgname}"))
+;; Skel: (find-find-links-links-new "epackage" "pkg c d" "")
+;; Test: (find-epackage-links 'lua-mode)
+;; (find-epackage-links 'tetris)
+;; (find-epackage-links 'foo)
+;;
+(defun find-epackage-links (&optional pkg c d &rest pos-spec-list)
+"Visit a temporary buffer containing hyperlinks for an Emacs package.
+PKG must be a symbol; C and D are arguments for `code-c-d'.
+If D is t then try to use `ee-package-dir' to get the directory."
+ (interactive (list (symbol-at-point)))
+ (setq pkg (or pkg "{pkg}"))
+ (setq c (or c (replace-regexp-in-string "[-]" "" (symbol-name pkg))))
+ (setq d (cond ((eq d t) (ee-package-dir pkg))
+ ((eq d nil) "{d}")
+ (t d)))
(apply
'find-elinks
- `((find-epackage-links ,pkgname ,@pos-spec-list)
+ `((find-epackage-links ,(ee-add-quote pkg) ,c ,d ,@pos-spec-list)
+ (find-epackage-links ,(ee-add-quote pkg) ,c t ,@pos-spec-list)
;; Convention: the first sexp always regenerates the buffer.
(find-efunction 'find-epackage-links)
(find-elpafile "")
""
- ,(ee-find-epackage-links0 pkgname)
+ ,(ee-find-epackage-links0 pkg c d)
)
pos-spec-list))
-(defun ee-find-epackage-links0 (pkgname)
+(defun ee-find-epackage-links0 (pkg c d)
"This is an internal function used by `find-epackage-links'."
- (let* ((spkgname (format "\n %s " pkgname))
- (pattern (format "%s%s-*" ee-elpadir pkgname))
- (fnames (ee-file-expand-wildcards-slash pattern))
- (sexps (mapcar (lambda (s) (list 'find-elpafile s)) fnames))
- (sexps (reverse sexps))
- (lines (mapconcat 'ee-HS sexps "\n"))
+ (let* ((spkg (format "\n %s " pkg))
+ (findelpafiles0 (ee-package-findelpafiles pkg))
+ (findelpafiles1 (reverse findelpafiles0))
+ (findelpafiles (mapconcat 'ee-HS findelpafiles1 "\n"))
)
(ee-template0 "\
-# (find-epackages {(ee-S spkgname)})
-# (find-epackage-links '{pkgname})
-# (find-epackage '{pkgname})
-{lines}
+# (find-epackages {(ee-S spkg)})
+# (find-epackage-links '{pkg})
+# (find-epackage '{pkg})
+{findelpafiles}
+
+# (ee-package-dir '{pkg})
+# (find-epp (ee-package-desc '{pkg}))
+
+# (code-c-d \"{c}\" \"{d}\")
+# (find-{c}file \"\")
-# http://elpa.gnu.org/packages/{pkgname}.html
-# http://melpa.org/#/{pkgname}
+# http://elpa.gnu.org/packages/{pkg}.html
+# http://melpa.org/#/{pkg}
")))
-(defun ee-file-name-nondirectory-slash (fname)
- "Like `file-name-nondirectory', but appends a / to FNAME if it is a
directory.
-This is an internal function used by `ee-find-epackage-links'."
- (concat (file-name-nondirectory fname)
- (if (file-directory-p fname) "/" "")))
+
+;; Tests: (find-fline ee-elpadir)
+;; (find-fline "~/.emacs.d/elpa/" "lua-mode-")
+;; (ee-file-expand-wildcards-slash "~/.emacs.d/elpa/lua-mode-*")
+;; (ee-package-findelpafiles "lua-mode")
+;;
+(defun ee-package-findelpafiles (pkgname)
+ "Convert a PKGNAME to a list of `(find-elpafile ...)' sexps."
+ (let* ((pattern (format "%s%s-*" ee-elpadir pkgname))
+ (fnames (ee-file-expand-wildcards-slash pattern)))
+ (mapcar (lambda (s) (list 'find-elpafile s)) fnames)))
(defun ee-file-expand-wildcards-slash (pattern)
- "Like `file-expand-wildcards' but with `ee-file-name-nondirectory-slash' &
sort.
-This is an internal function used by `ee-find-epackage-links'."
+"Like `file-expand-wildcards' but with `ee-file-name-nondirectory-slash' &
sort."
(let* ((fnames0 (file-expand-wildcards pattern))
(fnames1 (mapcar 'ee-file-name-nondirectory-slash fnames0))
(fnames2 (sort fnames1 'string<)))
fnames2))
+(defun ee-file-name-nondirectory-slash (fname)
+"Like `file-name-nondirectory', but appends a / to FNAME if it is a directory."
+ (concat (file-name-nondirectory fname)
+ (if (file-directory-p fname) "/" "")))
+
+
+
+
+;; «ee-package-dir» (to ".ee-package-dir")
+;; This function converts a package name (a symbol) into the directory
+;; in which that package was installed (or nil), using functions from
+;; "package.el".
+;;
+;; Tests: (require 'package)
+;; (package-initialize)
+;; (ee-package-dir 'lua-mode)
+;; (ee-package-dir 'tetris)
+;; (ee-package-dir 'foo)
+;; (ee-package-desc 'lua-mode)
+;; (ee-package-desc 'tetris)
+;; (ee-package-desc 'foo)
+;;
+;; WARNING: the function `ee-package-dir' and its dependency
+;; `ee-package-desc' use several functions from "package.el", and I
+;; don't understand package.el well enough!
+;;
+;; See: (find-efile "emacs-lisp/package.el" "(cl-defstruct (package-desc")
+;; (find-efunction 'describe-package-1)
+;; (find-efunction 'describe-package-1 "(let* ((desc ")
+;;
+(defun ee-package-dir (pkg)
+"Convert the name of the package PKG to the directory where it was installed."
+ (let* ((desc (ee-package-desc pkg))
+ (dir (and desc (package-desc-dir desc))))
+ (if (stringp dir)
+ (replace-regexp-in-string
+ "\\([^/]\\)$" "\\1/"
+ (ee-shorten-file-name dir)))))
+
+(defun ee-package-desc (pkg)
+"An internal function used by `ee-package-dir'.
+Convert PKG - a symbol - to a package-desc structure (or to nil)."
+ (or (if (package-desc-p pkg) pkg)
+ (cadr (assq pkg package-alist))
+ (let ((built-in (assq pkg package--builtins)))
+ (if built-in
+ (package--from-builtin built-in)
+ (cadr (assq pkg package-archive-contents))))))
diff --git a/eev-intro.el b/eev-intro.el
index 90fc7c5..4aaf50f 100644
--- a/eev-intro.el
+++ b/eev-intro.el
@@ -307,7 +307,7 @@ this video (from 2016!):
http://angg.twu.net/eev-videos/video-eev-quick-0.mp4
-Open the page at
+To run it, open the page at
http://angg.twu.net/eev-intros/find-eev-quick-intro.html
@@ -2446,6 +2446,7 @@ Main intros: (find-eev-quick-intro)
Index to the source files: (find-eev \"eev-load.el\")
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-5 M-0 M-j'.
Here is a list of all the available sandbox-y tutorials that
@@ -3486,6 +3487,8 @@ are numbers or strings. Try:
7. Pos-spec-lists
=================
+[Moved to:] (find-refining-intro \"1. Pos-spec-lists\")
+
The optional arguments that refine a hyperlink form what we call
a \"pos-spec-list\". For example, the pos-spec-list here has two
elements,
@@ -3670,128 +3673,6 @@ Try:
-10.1. Byte-compiled functions
------------------------------
-Most functions in Emacs are byte-compiled - which means that
-their function cells contain a \"byte-code\" instead of a lambda
-expression. These byte-codes are very hard for humans to read.
-See:
-
- (find-elnode \"What Is a Function\" \"byte-code function\")
- (find-elnode \"Byte-Code Type\")
- (find-elnode \"Byte Compilation\")
- (find-elnode \"Disassembly\")
-
-Here is an example:
-
- (find-efunctiondescr 'find-file)
- (find-efunction 'find-file)
- (symbol-function 'find-file)
- (find-efunctionpp 'find-file)
- (find-efunctiond 'find-file)
-
-The `find-efunctionpp' link above takes the content of the
-function cell of `find-file' and \"pretty-prints\" it, i.e.,
-indents it in a nice way, but the result in this case is
-unreadable... and the `find-efunctiond' link shows a decompiled
-version of that byte-code, which is only slightly better. Both
-the `find-efunctionpp' and the `find-efunctiond' links show
-internal representations that are very different from the source
-code. Compare that with a case in which the function is not
-byte-compiled:
-
- (find-efunctiondescr 'find-fline)
- (find-efunction 'find-fline)
- (symbol-function 'find-fline)
- (find-efunctionpp 'find-fline)
-
-The `(find-efunctionpp 'find-fline)' shows a lambda expression
-that is very similar to the defun that defined `find-fline'.
-
-
-
-
-10.2. How `find-efunction' works
---------------------------------
-Eev defines hyperlink functions called `find-efunction',
-`find-evariable' and `find-eface' that are wrappers around the
-standard functions `find-function', `find-variable' and
-`find-face-definition'; the eev variants support pos-spec-lists.
-Try:
-
- (find-efunction 'find-fline)
- (find-function 'find-fline)
- (find-evariable 'ee-hyperlink-prefix)
- (find-variable 'ee-hyperlink-prefix)
- (find-eface 'eepitch-star-face)
- (find-face-definition 'eepitch-star-face)
-
-The Emacs functions are defined here:
-
- (find-efile \"emacs-lisp/find-func.el\")
-
-Their inner workings are quite complex. They use `symbol-file',
-that works on the variable `load-history'. Here are some links to
-documentation and tests:
-
- (find-efunctiondescr 'symbol-file)
- (find-elnode \"Where Defined\")
- (symbol-file 'find-fline 'defun)
- (symbol-file 'ee-hyperlink-prefix 'defvar)
- (symbol-file 'eepitch-star-face 'defface)
- (find-epp (assoc (locate-library \"eepitch\") load-history))
-
-The functions in \"find-func.el\" use `symbol-file' to find the
-file where a given symbol was defined, and then search a defun,
-defvar of defface in it that _may be_ the definition that we are
-looking for. The eev variants use the functions
-`find-function-noselect', `find-variable-noselect' and
-`find-definition-noselect' from \"find-func.el\", that return a
-pair (BUFFER . POS). Try:
-
- (find-efunctiondescr 'find-function-noselect)
- (find-efunctiondescr 'find-variable-noselect)
- (find-efunctiondescr 'find-definition-noselect)
-
- (find-ebufferandpos (find-function-noselect 'find-fline)
- )
- (find-ebufferandpos (find-variable-noselect 'ee-hyperlink-prefix)
- )
- (find-ebufferandpos (find-definition-noselect 'eepitch-star-face 'defface)
- )
-
-These `find-*-select' functions work quite well but are not 100%
-reliable - for example, if an elisp file has several definitions
-for the same function, variable, or face, the `find-*-select's
-don't know which ones were executed, neither which one was
-executed last, overriding the other ones... and it may return the
-position of a defun, defvar, or defface that is not the
-\"active\" one.
-
-
-
-
-10.3. Why eev avoids byte-compilation
--------------------------------------
-All the source files of eev have a \"no-byte-compile: t\" in
-them. See:
-
- (find-eevgrep \"grep --color -nH -e no-byte-compile: *.el\")
- (find-elnode \"Byte Compilation\" \"no-byte-compile: t\")
-
-This is non-standard, but it is a deliberate design choice.
-
-(TODO: explain the three main reasons: it is easier to teach
-emacs to beginners if they see lots of lambda expressions and few
-byte-codes; `code-c-d' and friends define functions dynamically
-and `find-efunction' don't work on them; in a distribution with
-only the \".elc\"s of eev users wouldn't have access to the
-documentation and examples in the comments of the source files.)
-
-
-
-
-
10.4. Quote and backquote
-------------------------
Eev uses backquote a lot and avoids macros.
@@ -4314,13 +4195,13 @@ It is meant as both a tutorial and a sandbox.
-Note: this intro is being rewritten!
-Ideally it should _complement_ the material in:
- (find-eev-quick-intro \"3. Elisp hyperlinks\")
-
-
-
-
+Note: this intro is obsolete!
+I need to move some parts of it to other intros and then delete it.
+ See: (find-here-links-intro)
+ (find-refining-intro)
+ (find-templates-intro)
+ (find-links-conv-intro \"3. Classification\")
+ (find-links-conv-intro \"3. Classification\" \"regenerate\")
@@ -5112,7 +4993,35 @@ function does not exist. To add support for
`FooBar-mode' to `M-x
eeit', just define a function with the right name. See the source
for examples:
- (find-eev \"eev-testblocks.el\")
+ (find-eev \"eev-testblocks.el\" \"examples\")
+
+
+
+
+3.1. `find-eeit-links'
+----------------------
+If you run this,
+
+ (find-eeit-links 'lua-mode)
+
+you will get a buffer with:
+
+ a) links to inspect the current definition of
+ `ee-insert-test-lua-mode',
+
+ b) links that let you compare that with the `ee-insert-test-'s
+ for other major modes,
+
+ c) a barebones `(defun ...)' that lets you redefine
+ `ee-insert-test-lua-mode'.
+
+If you run `find-eeit-links' interactively with `M-x' then it
+will run as:
+
+ (find-eeit-links <current-major-mode>)
+
+and you can use that to inspect the `ee-insert-test-' support for
+the current major mode, or to implement it yourself.
@@ -8520,6 +8429,9 @@ It is meant as both a tutorial and a sandbox.
This intro is being rewritten!
+The prerequisites for understand this are:
+ (find-elisp-intro)
+ (find-links-conv-intro \"3. Classification\")
@@ -8559,8 +8471,7 @@ To learn how to write your own templated functions you
need to:
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.
+ 3) learn how to use `find-find-links-links-new'.
@@ -8690,6 +8601,9 @@ Try:
5. `find-find-links-links'
==========================
+(Note: `find-find-links-links' is obsolete, and is superseded by
+`find-find-links-links-new')
+
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:
@@ -11356,9 +11270,10 @@ of the screen as a \"minibuffer\" - see:
(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\".
+ 1. run `M-x package-initialize',
+ 2. run `M-x list-packages',
+ 3. select \"eev\" at the list of packages,
+ 4. click on \"install\".
To load eev and enter its tutorial, run
`M-x eev-beginner'.
@@ -12273,6 +12188,183 @@ They are the hardest ones to read in the eev source.
+
+11. Byte-compiled functions
+===========================
+Most functions in Emacs are byte-compiled - which means that
+their function cells contain a \"byte-code\" instead of a lambda
+expression. These byte-codes are very hard for humans to read.
+See:
+
+ (find-elnode \"What Is a Function\" \"byte-code function\")
+ (find-elnode \"Byte-Code Type\")
+ (find-elnode \"Byte Compilation\")
+ (find-elnode \"Disassembly\")
+
+Here is an example:
+
+ (find-efunctiondescr 'find-file)
+ (find-efunction 'find-file)
+ (symbol-function 'find-file)
+ (find-efunctionpp 'find-file)
+ (find-efunctiond 'find-file)
+
+The `find-efunctionpp' link above takes the content of the
+function cell of `find-file' and \"pretty-prints\" it, i.e.,
+indents it in a nice way, but the result in this case is
+unreadable... and the `find-efunctiond' link shows a decompiled
+version of that byte-code, which is only slightly better. Both
+the `find-efunctionpp' and the `find-efunctiond' links show
+internal representations that are very different from the source
+code. Compare that with a case in which the function is not
+byte-compiled:
+
+ (find-efunctiondescr 'find-fline)
+ (find-efunction 'find-fline)
+ (symbol-function 'find-fline)
+ (find-efunctionpp 'find-fline)
+
+The `(find-efunctionpp 'find-fline)' shows a lambda expression
+that is very similar to the defun that defined `find-fline'.
+
+
+
+
+
+11.1. Why eev avoids byte-compilation
+-------------------------------------
+All the source files of eev have a \"no-byte-compile: t\" in
+them. See:
+
+ (find-eevgrep \"grep --color -nH -e no-byte-compile: *.el\")
+ (find-elnode \"Byte Compilation\" \"no-byte-compile: t\")
+ (find-enode \"Specifying File Variables\")
+
+This `no-byte-compile: t' is non-standard, but it is a deliberate
+design choice. I tried to make eev as beginner-friendly as
+possible, and beginners find byte-compiled functions confusing,
+so I avoided them as much as possible. Remember that several
+functions in eev define other functions - for example:
+
+ (find-eev-quick-intro \"9.1. `code-c-d'\")
+ (find-eev-quick-intro \"9.1. `code-c-d'\" \"mass-produced\")
+ (find-eev-quick-intro \"9.1. `code-c-d'\" \"find-code-c-d\")
+
+and if you try to understand what a hyperlink function like one
+below does by typing `M-h M-f' on it,
+
+ (find-efile \"subr.el\")
+
+then the `find-efunction' link in the `M-h M-f' buffer will not
+work - but the `find-efunctionpp' link will. Try:
+
+ (find-efunction 'find-efile)
+ (find-efunctionpp 'find-efile)
+
+
+
+
+
+11.2. How `find-efunction' works
+--------------------------------
+Eev defines hyperlink functions called `find-efunction',
+`find-evariable' and `find-eface' that are wrappers around the
+standard Emacs functions `find-function', `find-variable' and
+`find-face-definition'; the eev variants support pos-spec-lists.
+Try:
+
+ (find-efunction 'find-fline)
+ (find-function 'find-fline)
+ (find-evariable 'ee-hyperlink-prefix)
+ (find-variable 'ee-hyperlink-prefix)
+ (find-eface 'eepitch-star-face)
+ (find-face-definition 'eepitch-star-face)
+
+The Emacs functions are defined here:
+
+ (find-efile \"emacs-lisp/find-func.el\")
+
+and their inner workings are quite complex. To begin with, hey
+use `symbol-file', that works on the variable `load-history'.
+Here are some links to documentation and tests:
+
+ (find-efunctiondescr 'symbol-file)
+ (find-elnode \"Where Defined\")
+ (symbol-file 'find-fline 'defun)
+ (symbol-file 'find-efile 'defun)
+ (symbol-file 'ee-hyperlink-prefix 'defvar)
+ (symbol-file 'eepitch-star-face 'defface)
+ (find-eloadhistory \"eepitch\")
+ (find-eloadhistory \"eepitch\" \"eepitch-star-face\")
+
+The functions in \"find-func.el\" use `symbol-file' to find the
+file where a given symbol was defined, and then search for a
+defun, defvar of defface in it that _looks like_ the definition
+that we are looking for.
+
+Emacs knows that `find-efile' was defined in \"eev-code.el\",
+because of:
+
+ (symbol-file 'find-efile 'defun)
+ (find-eloadhistory \"eev-code\" \"find-efile\")
+
+but if we run
+
+ (find-function 'find-efile)
+
+this will fail, because Emacs will look for something like
+\"(defun find-efile \" in \"eev-code.el\", and it will not find
+it; it doesn't know that `find-efile' was defined by this
+`code-c-d':
+
+ (find-eev \"eev-code.el\" \"code-c-d-s\")
+ (find-eev \"eev-code.el\" \"code-c-d-s\" \"\\\"e\\\"\")
+
+Let's be even more precise. \"find-func.el\" defines these
+low-level functions,
+
+ (find-efunctiondescr 'find-function-noselect)
+ (find-efunctiondescr 'find-variable-noselect)
+ (find-efunctiondescr 'find-definition-noselect)
+
+that return structures of the form (BUFFER . POS), and eev
+defines a function
+
+ (find-efunctiondescr 'find-ebufferandpos)
+ (find-efunction 'find-ebufferandpos)
+
+that jumps to a (BUFFER . POS); `find-efunction' and friends are
+implemented using `find-ebufferandpos'. Try:
+
+ (find-ebufferandpos
+ (find-function-noselect 'find-fline)
+ )
+ (find-ebufferandpos
+ (find-variable-noselect 'ee-hyperlink-prefix)
+ )
+ (find-ebufferandpos
+ (find-definition-noselect 'eepitch-star-face 'defface)
+ )
+
+These `find-*-noselect' functions work quite well but are not
+100% reliable - for example, if an elisp file has several
+definitions for the same function, variable, or face, the
+`find-*-noselect's don't know which ones were executed, neither
+which one was executed last, overriding the other ones... and it
+may return the position of a defun, defvar, or defface that is
+not the \"active\" one. In eev redefinitions like these ones
+
+ (code-pdf-page \"foomanual\" \"/usr/src/foo-1.2.3/manual.pdf\")
+ (code-pdf-page \"foomanual\" \"/usr/src/foo-1.2.4/manual.pdf\")
+
+are quite common, and
+
+ (find-efunctionpp 'find-foomanualpage)
+
+will give you information about the current definition.
+
+
+
" pos-spec-list)))
;; (find-elisp-intro)
diff --git a/eev-testblocks.el b/eev-testblocks.el
index c95f213..892e6bc 100644
--- a/eev-testblocks.el
+++ b/eev-testblocks.el
@@ -36,6 +36,12 @@
;; interactive tests. See:
;;
;; (find-eepitch-intro "3. Test blocks")
+;; (find-eepitch-intro "3.1. `find-eeit-links'")
+
+
+;; «.ee-insert-test» (to "ee-insert-test")
+;; «.examples» (to "examples")
+
@@ -60,20 +66,28 @@
(funcall (intern (format "ee-insert-test-%s" major-mode)))
(error "ee-insert-test: Unsupported major mode: %s" major-mode)))
-;; The old definition was:
+
+;;; _
+;;; _____ ____ _ _ __ ___ _ __ | | ___ ___
+;;; / _ \ \/ / _` | '_ ` _ \| '_ \| |/ _ \/ __|
+;;; | __/> < (_| | | | | | | |_) | | __/\__ \
+;;; \___/_/\_\__,_|_| |_| |_| .__/|_|\___||___/
+;;; |_|
;;
-;; (defun ee-insert-test ()
-;; "Insert a \"test block\" - an eepitch block in a multiline comment."
-;; (interactive)
-;; (cond ((eq major-mode 'lua-mode) (ee-insert-test-lua))
-;; ((eq major-mode 'python-mode) (ee-insert-test-python))
-;; ((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))
-;; ((eq major-mode 'haskell-mode) (ee-insert-test-haskell))
-;; (t (error "ee-insert-test: Unsupported major mode"))))
+;; «examples» (to ".examples")
+;; See: (find-eepitch-intro "3.1. `find-eeit-links'")
+(defun ee-insert-test-haskell-mode ()
+ (interactive)
+ (insert (format "
+{-
+ (eepitch-ghci)
+ (eepitch-kill)
+ (eepitch-ghci)
+:load %s
+
+-}
+" (buffer-name))))
(defun ee-insert-test-julia-mode ()
(interactive)
@@ -147,26 +161,16 @@ source %s
}
" (buffer-name))))
-(defun ee-insert-test-idris-mode ()
+(defun ee-insert-test-tuareg-mode ()
(interactive)
(insert (format "
-{-
- (eepitch-to-buffer \"*idris-repl*\")
-
--}
-" (buffer-name))))
-
-
-(defun ee-insert-test-haskell-mode ()
- (interactive)
- (insert (format "
-{-
- (eepitch-ghci)
+(*
+ (eepitch-ocaml)
(eepitch-kill)
- (eepitch-ghci)
-:load %s
+ (eepitch-ocaml)
+#use \"%s\";;
--}
+*)
" (buffer-name))))
diff --git a/eev-tlinks.el b/eev-tlinks.el
index 58414a4..7ce02d2 100644
--- a/eev-tlinks.el
+++ b/eev-tlinks.el
@@ -19,7 +19,7 @@
;;
;; Author: Eduardo Ochs <eduardoochs@gmail.com>
;; Maintainer: Eduardo Ochs <eduardoochs@gmail.com>
-;; Version: 2020feb20
+;; Version: 2020oct06
;; Keywords: e-scripts
;;
;; Latest version: <http://angg.twu.net/eev-current/eev-tlinks.el>
@@ -80,6 +80,8 @@
;; «.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")
+;; «.find-emacs-tangents-links» (to "find-emacs-tangents-links")
+;; «.find-eeit-links» (to "find-eeit-links")
(require 'eev-env)
@@ -413,22 +415,24 @@ This is an internal function used by
`find-{stem}-links'.\"
;;; |_|_| |_|\__|_| \___/ |_|_|_| |_|_|\_\___/
;;;
;; «find-intro-links» (to ".find-intro-links")
-;; (find-find-links-links "i" "intro" "stem")
-;; A test: (find-intro-links)
-
+;; Skel: (find-find-links-links-new "intro" "stem" "")
+;; Test: (find-intro-links)
+;;
(defun find-intro-links (&optional stem &rest pos-spec-list)
"Visit a temporary buffer with a skeleton for defining `find-<STEM>-intro'.
All `find-*-intro' functions in eev-intro.el were written using this.
See: (find-eev \"eev-intro.el\")"
(interactive)
(setq stem (or stem "{stem}"))
- (apply 'find-elinks-elisp
- `((find-intro-links ,stem ,@pos-spec-list)
+ (apply
+ 'find-elinks-elisp
+ `((find-intro-links ,stem ,@pos-spec-list)
(find-intro-links "{stem}" ,@pos-spec-list)
(find-intro-links "foo" ,@pos-spec-list)
;; Convention: the first sexp always regenerates the buffer.
(find-efunction 'find-intro-links)
- ,(ee-template0 "\
+ ""
+ ,(ee-template0 "\
;; (ee-copy-rest 1 '(find-eev \"eev-intro.el\"))
;; (find-{stem}-intro)
@@ -441,7 +445,7 @@ See: (find-eev \"eev-intro.el\")"
\\(Re)generate: (find-{stem}-intro)
Source code: (find-efunction 'find-{stem}-intro)
More intros: (find-eev-quick-intro)
- (find-eval-intro)
+ (find-eev-intro)
(find-eepitch-intro)
This buffer is _temporary_ and _editable_.
It is meant as both a tutorial and a sandbox.
@@ -451,7 +455,9 @@ Hello
\" pos-spec-list)))
;; (find-{stem}-intro)
-")) pos-spec-list))
+")
+ )
+ pos-spec-list))
;; (find-intro-links)
;; (find-intro-links "emacs")
@@ -1841,6 +1847,103 @@ os.exit()
+;; «find-emacs-tangents-links» (to ".find-emacs-tangents-links")
+;; Skel: (find-find-links-links-new "emacs-tangents" "yyyy mm dd msg txtstem"
"")
+;; Test: (find-emacs-tangents-links "2020" "10" "05")
+;;
+(defun find-emacs-tangents-links (&optional yyyy mm dd msg txtstem &rest
pos-spec-list)
+"Visit a temporary buffer with hyperlinks to a post in emacs-tangents."
+ (interactive)
+ (setq yyyy (or yyyy "{yyyy}"))
+ (setq mm (or mm "{mm}"))
+ (setq dd (or dd "{dd}"))
+ (setq msg (or msg "{msg}"))
+ (setq txtstem (or txtstem "{txtstem}"))
+ (apply
+ 'find-elinks
+ `((find-emacs-tangents-links ,yyyy ,mm ,dd ,msg ,txtstem ,@pos-spec-list)
+ ;; Convention: the first sexp always regenerates the buffer.
+ (find-emacs-tangents-links "2020" "10" "05" "msg00000" "txts2ETp920ql")
+ (find-emacs-tangents-links "2018" "01" "29" "msg00025" "txtJ1ftXqItdm")
+ (find-efunction 'find-emacs-tangents-links)
+ ""
+ ,(ee-template0 "\
+# https://sachachua.com/blog/{yyyy}/
+# https://sachachua.com/blog/{yyyy}/{mm}/
+# https://sachachua.com/blog/{yyyy}/{mm}/{yyyy}-{mm}-{dd}-emacs-news/
+# https://lists.gnu.org/archive/html/emacs-tangents/{yyyy}-{mm}/
+# https://lists.gnu.org/archive/html/emacs-tangents/{yyyy}-{mm}/{msg}.html
+
+ (eepitch-shell)
+ (eepitch-kill)
+ (eepitch-shell)
+# (find-fline \"~/usrc/emacs-tangents/\")
+# (find-fline \"~/usrc/emacs-tangents/{yyyy}-{mm}-{dd}-emacs-news.org\")
+
+mkdir -p ~/usrc/emacs-tangents/
+cd ~/usrc/emacs-tangents/
+# rm -v {yyyy}-{mm}-{dd}-emacs-news.org
+wget -nc -O {yyyy}-{mm}-{dd}-emacs-news.org \\
+ https://lists.gnu.org/archive/html/emacs-tangents/{yyyy}-{mm}/{txtstem}.txt
+")
+ )
+ pos-spec-list))
+
+
+
+
+;; «find-eeit-links» (to ".find-eeit-links")
+;; Skel: (find-find-links-links-new "eeit" "majormode" "majormodestr
eeitfunstr eeitfun")
+;; See: (find-eepitch-intro "3.1. `find-eeit-links'")
+;; Test: (find-eeit-links 'lua-mode)
+;;
+(defun find-eeit-links (&optional majormode &rest pos-spec-list)
+"Visit a temporary buffer containing hyperlinks for eeit."
+ (interactive)
+ (setq majormode (or majormode major-mode))
+ (let* ((majormodestr (symbol-name majormode))
+ (eeitfunstr (concat "ee-insert-test-" majormodestr))
+ (eeitfun (intern eeitfunstr)))
+ (apply
+ 'find-elinks-elisp
+ `((find-eeit-links ',majormode ,@pos-spec-list)
+ ;; Convention: the first sexp always regenerates the buffer.
+ ;; ""
+ ,(ee-template0 "\
+;; (find-efunction 'find-eeit-links)
+;; (find-eepitch-intro \"3. Test blocks\")
+;; (find-eepitch-intro \"3.1. `find-eeit-links'\")
+;; (find-eev \"eev-testblocks.el\" \"examples\")
+
+;; Current definition:
+;; (find-efunction '{eeitfun})
+;; (find-efunctionpp '{eeitfun})
+;; (find-epp (ee-defun-sexp-for '{eeitfun}))
+
+
+;; <{eeitfunstr}>
+;;
+(defun {eeitfunstr} ()
+ (interactive)
+ (insert (format \"
+--[[
+ (eepitch-lua51)
+ (eepitch-kill)
+ (eepitch-lua51)
+dofile \\\"%s\\\"
+
+--]]
+\" (buffer-name))))
+
+;; Test:
+;; ({eeitfunstr})
+
+")
+ )
+ pos-spec-list)))
+
+
+
diff --git a/eev-wrap.el b/eev-wrap.el
index d5ece26..d50a7f0 100644
--- a/eev-wrap.el
+++ b/eev-wrap.el
@@ -181,6 +181,7 @@ have to run an \"undo\"."
;;; |_| |_| |_.__(_) \___||___/\___|_| |_| .__/ \__| |_.__/|_|_|\_\
;;; |_|
;;
+;; See: (find-eev-quick-intro "8.4. Creating e-script blocks")
;; (define-key eev-mode-map "\M-B" 'eewrap-escript-block)
(defun eewrap-escript-block () (interactive)
@@ -309,6 +310,7 @@ have to run an \"undo\"."
;;; | | | |_____| __/ _ | |_) | (_| | _| | | < __/
;;; |_| |_| |_| (_) | .__/ \__,_|_| |_|_|_|\_\___|
;;; |_|
+;;
;; See: (find-pdf-like-intro)
;; (define-key eev-mode-map "\M-P" 'eewrap-pdflike)
@@ -332,8 +334,10 @@ have to run an \"undo\"."
;;; | | | |_____| |_| |_ | |_) | (_| | _| | | < __/_____| | | | | | <
;;; |_| |_| \__\_(_) | .__/ \__,_|_| |_|_|_|\_\___| |_|_|_| |_|_|\_\
;;; |_|
+;;
;; See: (find-pdf-like-intro)
;; (define-key eev-mode-map "\M-Q" 'eewrap-pdflike-link)
+;; OBSOLETE.
(defun eewrap-pdflike-link () (interactive)
(ee-this-line-wrapn 2 'ee-wrap-pdflike-link))