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

    Added `find-elocus-links' (`M-h M-l').
---
 ChangeLog      | 16 +++++++++++++
 VERSION        |  4 ++--
 eev-code.el    |  1 +
 eev-elinks.el  | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 eev-helpful.el | 46 ++++++++++++++++++++++++++++++++++++-
 eev-intro.el   | 57 +++++++++++++++++++++++-----------------------
 eev-load.el    |  8 ++++---
 eev-mode.el    |  3 ++-
 eev-tlinks.el  | 13 +++++------
 9 files changed, 175 insertions(+), 44 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 427d6e4588..316340be51 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,21 @@
+2024-03-06  Eduardo Ochs  <eduardoo...@gmail.com>
+
+       * eev-mode.el (eev-mode-map-set): bind `M-h M-l' to
+       `find-elocus-links'.
+
+       * eev-elinks.el (find-elocus-links, ee-read-key-sequence)
+       (ee-binding-locus, ee-keymap-lookup): new functions.
+
+2024-03-05  Eduardo Ochs  <eduardoo...@gmail.com>
+
+       * eev-helpful.el (find-hkeymap-links): new function.
+
+       * eev-code.el (ee-code-c-d-base): added a defvar.
+
 2024-03-04  Eduardo Ochs  <eduardoo...@gmail.com>
 
+       * eev-tlinks.el (find-eev-reload-links): added eev-aliases.
+
        * eev-intro.el (find-eev-levels-intro): rewrote some sections.
 
        * eev-beginner.el (eev-beginner): added a (require 'eev-aliases).
diff --git a/VERSION b/VERSION
index 8f182386e8..5953b2bfa2 100644
--- a/VERSION
+++ b/VERSION
@@ -1,2 +1,2 @@
-Tue Mar  5 01:50:24 GMT 2024
-Mon Mar  4 22:50:24 -03 2024
+Wed Mar  6 04:59:05 GMT 2024
+Wed Mar  6 01:59:05 -03 2024
diff --git a/eev-code.el b/eev-code.el
index 2691123db4..27b845fc72 100644
--- a/eev-code.el
+++ b/eev-code.el
@@ -214,6 +214,7 @@ Try this: (find-code-c-d \"CODE\" \"/DIR/\" :info \"INFO\")"
    ;;      (eek \"M-h M-f  apply\")
    ;;      (eek \"M-h M-f  interactive\")
    ;;
+   (defvar ee-{c}dir \"{d}\")
    (setq ee-{c}dir \"{d}\")
    (defun ee-{c}file (str)
      (concat (ee-expand ee-{c}dir) str))
diff --git a/eev-elinks.el b/eev-elinks.el
index 212aab46b6..105b509c8d 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:    20240113
+;; Version:    20240306
 ;; Keywords:   e-scripts
 ;;
 ;; Latest version: <http://anggtwu.net/eev-current/eev-elinks.el>
@@ -85,6 +85,7 @@
 ;; «.find-eminormodes-links»   (to "find-eminormodes-links")
 ;; «.find-emodeline-links»     (to "find-emodeline-links")
 ;; «.find-emenubar-links»      (to "find-emenubar-links")
+;; «.find-elocus-links»                (to "find-elocus-links")
 
 ;; «.find-code-pdf-links»      (to "find-code-pdf-links")
 ;; «.find-pdf-links»           (to "find-pdf-links")
@@ -309,7 +310,8 @@ This is an internal function used by `find-efunction-links' 
and
     (find-efunctionlgrep ',f)
     (find-efunctionlgrep ',f ',f)
     (find-eloadhistory-for ',f)
-    (find-estring-elisp (ee-eloadhistory-find-flines))
+    (find-eloadhistory-for ',f 2 ,(format " %s)" f))
+    ;; (find-estring-elisp (ee-eloadhistory-find-flines))
     ""
     (symbol-file ',f 'defun)
     (find-fline (symbol-file ',f 'defun))
@@ -1737,6 +1739,71 @@ You can use this to understand how the mode line works."
 
 
 
+;;;  _                         
+;;; | |    ___   ___ _   _ ___ 
+;;; | |   / _ \ / __| | | / __|
+;;; | |__| (_) | (__| |_| \__ \
+;;; |_____\___/ \___|\__,_|___/
+;;;                            
+;; «find-elocus-links»  (to ".find-elocus-links")
+;; Skel: (find-find-links-links-new "elocus" "key keymap" "f")
+;; Test: (find-elocus-links)
+;;       (find-elocus-links "M-h M-h" eev-mode-map)
+;;
+(defun find-elocus-links (&optional key keymap &rest pos-spec-list)
+  "Visit a temporary buffer with info about KEY and its locus (a KEYMAP).
+When `find-elocus-links' is called interactively it asks the user for a
+key sequence, calls `help--binding-locus' to find the keymap in which
+that key sequence is defined, and calls `keymap-lookup' to find the
+command bound to that key sequence - and then it shows lots of
+hyperlinks about all that."
+  (interactive (list (ee-read-key-sequence "Key sequence: ")))
+  (setq key    (or key "{key}"))
+  (setq keymap (or keymap (ee-binding-locus key) "{keymap}"))
+  (let* ((f (ee-keymap-lookup (symbol-value keymap) key)))
+    (apply
+     'find-elinks-elisp
+     `((find-elocus-links ,key ',keymap ,@pos-spec-list)
+       ;; Convention: the first sexp always regenerates the buffer.
+       (find-efunction 'find-elocus-links)
+       ""
+       ,(ee-template0 "\
+;; (require 'helpful)
+;; (find-evariable       '{keymap})
+;; (find-evardescr       '{keymap})
+;; (find-hkeymap-links   '{keymap})
+;; (find-hkeymap-links   '{keymap} 2 {(ee-S key)} \"{f}\")
+;; (find-efunction-links '{f})
+;; (find-efunctiondescr  '{f})
+;; (find-efunction       '{f})
+")
+       )
+     pos-spec-list)))
+
+
+;; Internal functions used by `find-elocus-links'.
+;; Tests: (ee-read-key-sequence "Key sequence: ")
+;;        (ee-binding-locus "M-h M-h")
+;;        (ee-keymap-lookup eev-mode-map "M-h")
+;;        (ee-keymap-lookup eev-mode-map "M-h M-h")
+;;        (ee-keymap-lookup eev-mode-map "M-h M-h M-h")
+;;        (ee-keymap-lookup "foo"        "M-h M-h M-h")
+;;        (ee-active-minor-modes)
+;;   See: (find-efunction 'help--binding-locus)
+;;
+(defun ee-read-key-sequence (prompt)
+  (format-kbd-macro (read-key-sequence-vector prompt)))
+
+(defun ee-binding-locus (key)
+  (help--binding-locus (kbd key) nil))
+
+(defun ee-keymap-lookup (keymap key)
+  (if (keymapp keymap)
+      (let ((result (keymap-lookup keymap key)))
+       (and (commandp result)
+            result))))
+
+
 
 
 
diff --git a/eev-helpful.el b/eev-helpful.el
index 393032a602..c5613363a4 100644
--- a/eev-helpful.el
+++ b/eev-helpful.el
@@ -19,7 +19,7 @@
 ;;
 ;; Author:     Eduardo Ochs <eduardoo...@gmail.com>
 ;; Maintainer: Eduardo Ochs <eduardoo...@gmail.com>
-;; Version:    20230127
+;; Version:    20240305
 ;; Keywords:   e-scripts
 ;;
 ;; Latest version: <http://anggtwu.net/eev-current/eev-helpful.el>
@@ -31,6 +31,7 @@
 
 ;; «.find-helpful-links»       (to "find-helpful-links")
 ;; «.find-hlinks»              (to "find-hlinks")
+;; «.find-hkeymap-links»       (to "find-hkeymap-links")
 
 
 
@@ -182,6 +183,49 @@ the name of a buffer in helpful-mode.")
 
 
 
+;; «find-hkeymap-links»  (to ".find-hkeymap-links")
+;; Skel: (find-find-links-links-new "hkeymap" "symbol" "ee-buffer-name")
+;; Test: (find-hkeymap-links 'emacs-lisp-mode-map)
+;;
+(defun find-hkeymap-links (&optional symbol &rest pos-spec-list)
+"Visit a temporary buffer containing hyperlinks for hkeymap."
+  (interactive)
+  (setq symbol (or symbol "{symbol}"))
+  (let ((ee-buffer-name
+        (or ee-buffer-name
+            (format "*(find-hkeymap-links '%s)*" symbol))))
+    (apply
+     'find-elinks
+     `((find-hkeymap-links ',symbol ,@pos-spec-list)
+       ;; Convention: the first sexp always regenerates the buffer.
+       (find-efunction 'find-hkeymap-links)
+       ""
+       (find-evariable ',symbol)
+       (find-hvariable ',symbol)
+       ""
+       ,(helpful--format-keymap (symbol-value symbol))
+       )
+     pos-spec-list)))
+
+'("--A test:--"
+
+  (defun find-4a (a b c d) (find-wset "13_o2_o2_o_o+"  a b c d))
+  (find-4a nil
+    ' (find-hkeymap-links 'emacs-lisp-mode-map)
+    ' (find-hkeymap-links 'lisp-mode-shared-map)
+    ' (find-hkeymap-links 'prog-mode-map)
+    )
+  (find-4a nil
+    ' (find-evariable 'emacs-lisp-mode-map)
+    ' (find-evariable 'lisp-mode-shared-map)
+    ' (find-evariable 'prog-mode-map)
+    )
+
+"--end--")
+
+
+
+
 
 
 
diff --git a/eev-intro.el b/eev-intro.el
index e829258295..2b4d52de03 100644
--- a/eev-intro.el
+++ b/eev-intro.el
@@ -19,7 +19,7 @@
 ;;
 ;; Author:     Eduardo Ochs <eduardoo...@gmail.com>
 ;; Maintainer: Eduardo Ochs <eduardoo...@gmail.com>
-;; Version:    20240304
+;; Version:    20240305
 ;; Keywords:   e-scripts
 ;;
 ;; Latest version: <http://anggtwu.net/eev-current/eev-intro.el>
@@ -339,9 +339,9 @@ explained in this video:
 The three links in the \"Video links:\" block below
 
   [Video links:]
-    (find-eevnavvideo \"0:30\" \"0.1. M-x package-initialize\")
-    (find-eevnavvideo \"0:39\" \"0.2. M-x list-packages\")
-    (find-eevnavvideo \"2:38\" \"0.3. M-x eev-beginner\")
+    (find-eevnavvideo \"00:30\" \"0.1. M-x package-initialize\")
+    (find-eevnavvideo \"00:39\" \"0.2. M-x list-packages\")
+    (find-eevnavvideo \"02:33\" \"0.3. M-x eev-beginner\")
 
 point to positions in that video; to learn how to use links like
 those, visit this URL:
@@ -368,10 +368,10 @@ after starting it again you will need to type `M-x 
eev-beginner'
 to activate eev again. For an explanation of this in video, see:
 
   [Video links:]
-    (find-eevnavvideo \"3:46\" \"0.4. for the beginners: quitting and 
restarting\")
-    (find-eevnavvideo \"4:06\"   \"the part of the sequence of keys\")
-    (find-eevnavvideo \"4:21\"   \"go to the file menu, click quit\")
-    (find-eevnavvideo \"4:46\"   \"enter emacs again, type M-x eev-beginner\")
+    (find-eevnavvideo \"03:46\" \"0.4. for the beginners: quitting and 
restarting\")
+    (find-eevnavvideo \"04:05\"   \"the part of the sequence of keys\")
+    (find-eevnavvideo \"04:23\"   \"go to the file menu, click quit\")
+    (find-eevnavvideo \"04:41\"   \"enter emacs again, type M-x eev-beginner\")
 
 Eventually you will learn how to get out of everything and how to undo
 almost anything, _BUT THAT WILL NOT HAPPEN IN THE FIRST TEN MINUTES_.
@@ -569,7 +569,7 @@ creates this buffer, and switches to it:
 
 
 [Video links:]
-  (find-eev2020video \"29:39\" \"2. A tale of two `describe-key's\")
+  (find-eev2020video \"29:38\" \"2. A tale of two `describe-key's\")
   (find-eev2020video \"31:31\"   \"the problem with the standard 
`describe-key'\")
   (find-eev2020video \"35:07\"   \"My variant: `find-ekey-links'\")
   (find-eev2020video \"37:00\"   \"how `find-ekey-links' generates its links\")
@@ -897,12 +897,11 @@ For more details see:
 
 [Video links:]
   (find-eevnavvideo \"10:36\" \"if I type <f8> six times here\")
-  (find-eevnavvideo \"10:50\" \"a shell running inside Emacs\")
-  (find-eev2021video \"0:14\" \"and if we type f8 several times here\")
-  (find-eev2019video \"15:11\" \"Demo: the eepitch block (in red star lines)\")
+  (find-eevnavvideo \"10:49\" \"a shell running inside Emacs\")
+  (find-eev2021video \"00:14\" \"and if we type f8 several times here\")
+  (find-eev2019video \"15:13\" \"Demo: the eepitch block (in red star lines)\")
   (find-eev2019video \"15:48\" \"Demo: eepitch on non-red star lines\")
-  (find-eev2019video \"15:56\" \"Demo: eepitch in action\")
-  (find-eevtestblsvideo \"2:33\" \"if I run f8 here I start a new Lua 
interpreter\")
+  (find-eev2019video \"15:58\" \"Demo: eepitch in action\")
 
 
 
@@ -1055,12 +1054,12 @@ star, but to make that work you need to know a bit of 
Lisp. See:
 7. Quick access to one-liners
 =============================
 [Video links:]
-  (find-eevnavvideo \"6:28\"  \"M-j: you can forget practically 
everything...\")
-  (find-eevnavvideo \"6:41\"  \"if you type just M-j\")
-  (find-eevnavvideo \"6:48\"  \"has a header that is beginner-friendly\")
-  (find-eevnavvideo \"8:48\"  \"most of the entries have hyperlinks to the 
manual\")
-  (find-eevnavvideo \"9:48\"  \"M-j with numeric prefixes\")
-  (find-eevnavvideo \"9:59\"  \"M-2 M-j runs (find-emacs-keys-intro)\")
+  (find-eevnavvideo \"06:29\" \"M-j: you can forget practically 
everything...\")
+  (find-eevnavvideo \"06:41\" \"if you type just M-j\")
+  (find-eevnavvideo \"06:49\" \"has a header that is beginner-friendly\")
+  (find-eevnavvideo \"08:45\" \"most of the entries have hyperlinks to the 
manual\")
+  (find-eevnavvideo \"09:49\" \"M-j with numeric prefixes\")
+  (find-eevnavvideo \"09:59\" \"M-2 M-j runs (find-emacs-keys-intro)\")
   (find-eevnavvideo \"10:06\" \"M-5 M-j runs (find-eev-quick-intro)\")
 
 
@@ -1236,9 +1235,9 @@ next section. Try it now:
   e (find-fline \"/tmp/foo.tex\")
 
 [Video links:]
-  (find-eev2020video \"26:49\" \"1.5.3. `M-J' (meta-uppercase-J)\")
+  (find-eev2020video \"26:48\" \"1.5.3. `M-J' (meta-uppercase-J)\")
   (find-eev2020video \"26:58\"   \"transforms the current line\")
-  (find-eev2020video \"27:37\"   \"into a defun\")
+  (find-eev2020video \"27:36\"   \"into a defun\")
 
 
 
@@ -1571,10 +1570,10 @@ files.
 See also: (find-code-c-d-intro)
 
 [Video links:]
-  (find-eev2020video  \"8:20\" \"`code-c-d' defines several new functions\")
+  (find-eev2020video \"08:18\" \"`code-c-d' defines several new functions\")
   (find-eev2020video \"14:43\" \"1.4. How code-c-d is implemented\")
   (find-eev2020video \"17:20\"   \"find-code-c-d shows the code...\")
-  (find-eev2019video \"17:07\" \"Demo: `code-c-d'\")
+  (find-eev2019video \"17:02\" \"Demo: `code-c-d'\")
 
 
 
@@ -1714,8 +1713,8 @@ some string in it...
   (find-pdf-text \"~/Coetzee99.pdf\" 3 \"LECTURE I\")
 
 [Video links:]
-  (find-eev2020video \"4:52\" \"`find-pdf-page' calls an external program\")
-  (find-eev2020video \"5:26\" \"`find-pdf-text' converts the PDF to text and\")
+  (find-eev2020video \"04:51\" \"`find-pdf-page' calls an external program\")
+  (find-eev2020video \"05:26\" \"`find-pdf-text' converts the PDF to text 
and\")
 
 
 
@@ -19356,8 +19355,9 @@ at the top. For example,
   (find-eloadhistory-for 'find-eevfile 2 \" ee-eevfile)\")
 
 shows the entry in the load-history for the file in which `find-eevfile'
-was defined, and it jumps to the the beginning of this block in it:
+was defined, and it jumps to the first defun in this block:
 
+  ee-eevfile
   (defun . ee-eevfile)
   (defun . find-eevfile)
   (defun . find-eevsh)
@@ -19369,7 +19369,8 @@ was defined, and it jumps to the the beginning of this 
block in it:
 These are exactly the functions that were defined by this call to
 `code-c-d',
 
-  (code-c-d \"eev\" ee-eev-source-directory :anchor)
+  ;; (find-code-c-d \"eev\" ee-eev-source-directory :anchor)
+          (code-c-d \"eev\" ee-eev-source-directory :anchor)
 
 that appears here:
 
diff --git a/eev-load.el b/eev-load.el
index 2b4cd19acf..704ec0c2bb 100644
--- a/eev-load.el
+++ b/eev-load.el
@@ -20,7 +20,7 @@
 ;;
 ;; Author:     Eduardo Ochs <eduardoo...@gmail.com>
 ;; Maintainer: Eduardo Ochs <eduardoo...@gmail.com>
-;; Version:    20240227
+;; Version:    20240304
 ;; Keywords:   e-scripts
 ;;
 ;; Supersedes: (find-eev "eev-all.el")
@@ -185,9 +185,11 @@
 ;; IMPORTANT: Since 2019mar05 these files are no longer loaded by
 ;; default! Note the "'" at the beginning of each line!
 
+;; This can't be loaded by default because it needs a package (hydra).
+' (require 'eev-hydras)         ; (find-eev "eev-hydras.el")
 
-
-;; TODO: explain this!
+;; This is optional because it "contaminates the main namespace".
+;; See: (find-eev-levels-intro)
 ' (require 'eev-aliases)        ; (find-eev "eev-aliases.el")
 
 
diff --git a/eev-mode.el b/eev-mode.el
index 9e5ab54f20..fde2fbad53 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:    20240228
+;; Version:    20240306
 ;; Keywords:   e-scripts
 ;;
 ;; Latest version: <http://anggtwu.net/eev-current/eev-mode.el>
@@ -125,6 +125,7 @@ and: (find-eval-intro \"`M-k'\")"
   (define-key eev-mode-map "\M-h\M-h" 'find-here-links)
   (define-key eev-mode-map "\M-h\M-i" 'find-eintro-or-einfo-links)
   (define-key eev-mode-map "\M-h\M-k" 'find-ekey-links)
+  (define-key eev-mode-map "\M-h\M-l" 'find-elocus-links)
   (define-key eev-mode-map "\M-h\M-n" 'find-eunicodeucs)
   (define-key eev-mode-map "\M-h\M-p" 'find-pdf-links)
   (define-key eev-mode-map "\M-h\M-s" 'find-strange-function-links)
diff --git a/eev-tlinks.el b/eev-tlinks.el
index b1a8fa9709..33d8c23196 100644
--- a/eev-tlinks.el
+++ b/eev-tlinks.el
@@ -1022,21 +1022,19 @@ sudo dpkg -i *.deb
 ;;;  \___|\___| \_/      |_|  \___|_|\___/ \__,_|\__,_|
 ;;;                                                    
 ;; «find-eev-reload-links»  (to ".find-eev-reload-links")
-;; Skel: (find-find-links-links-new "eev-reload" "dir" "")
+;; Skel: (find-find-links-links-new "eev-reload" "" "")
 ;; Test: (find-eev-reload-links)
 ;;
-(defun find-eev-reload-links (&optional dir &rest pos-spec-list)
+(defun find-eev-reload-links (&rest pos-spec-list)
 "Visit a temporary buffer with a script for reloading eev. Experimental!"
   (interactive)
-  (setq dir (or dir "{dir}"))
   (apply
    'find-elinks-elisp
-   `((find-eev-reload-links ,dir ,@pos-spec-list)
+   `((find-eev-reload-links ,@pos-spec-list)
      ;; Convention: the first sexp always regenerates the buffer.
      (find-efunction 'find-eev-reload-links)
      ""
-     ,(ee-template0 "\
-
+     ,(ee-template0 "
  (eepitch-shell)
  (eepitch-kill)
  (eepitch-shell)
@@ -1063,7 +1061,8 @@ git pull
   eev-wconfig
   eev-audiovideo
   eev-videolinks
-  eev-rcirc\"))
+  eev-rcirc
+  eev-aliases\"))
         do (load modulename))
 
 

Reply via email to