emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/eev 3325b83 41/64: Some clean-ups in the code for `find


From: Stefan Monnier
Subject: [elpa] externals/eev 3325b83 41/64: Some clean-ups in the code for `find-eintro-links' and `find-einfo-links'.
Date: Sun, 7 Apr 2019 16:59:09 -0400 (EDT)

branch: externals/eev
commit 3325b83526b3797ddf7f0689ff292db2d1d89b3e
Author: Eduardo Ochs <address@hidden>
Commit: Eduardo Ochs <address@hidden>

    Some clean-ups in the code for `find-eintro-links' and `find-einfo-links'.
---
 ChangeLog     |  24 +++++++++
 VERSION       |   4 +-
 eev-elinks.el | 163 +++++++++++++++++++++++++++++++++++++++++-----------------
 eev-intro.el  |  89 +++++++++++++++++++++++++++++++-
 eev-mode.el   |  18 +++----
 eev-tlinks.el |  13 +++--
 6 files changed, 244 insertions(+), 67 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 08a6057..78679bb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2019-02-25  Eduardo Ochs  <address@hidden>
+
+       * eev-intro.el (find-eev-install-intro): small changes.
+       (find-eev-quick-intro): small changes.
+
+       * eev-elinks.el (ee-info-fullnode+): new function.
+       (ee-info-shortlink): new function.
+       (find-einfo-links): rewritten.
+       (ee-intro-stem): added comments, and deleted the copy of the
+       `(defun ee-intro-stem ...)' that was in eev-tlinks.el.
+       (find-eintro-links): new function.
+       (find-eintro-or-einfo-links): new function.
+       (ee-find-here-links0): small changes.
+
+       * eev-mode.el (eev-mode-map-set): changed the binding of `M-h M-i'
+       to `find-eintro-or-einfo-links'.
+       (eev-mode-help): small changes.
+
+       * eev-tlinks.el (find-intro-links): small changes.
+
+2019-02-24  Eduardo Ochs  <address@hidden>
+
+       * eev-codings.el (ee-tolatin1-re): new function.
+
 2019-02-23  Eduardo Ochs  <address@hidden>
 
        * eev-intro.el (find-links-intro): rewrote some sections.
diff --git a/VERSION b/VERSION
index 33f90e1..b889248 100644
--- a/VERSION
+++ b/VERSION
@@ -1,2 +1,2 @@
-Sun Feb 24 17:13:22 GMT 2019
-Sun Feb 24 14:13:22 -03 2019
+Tue Feb 26 00:21:15 GMT 2019
+Mon Feb 25 21:21:15 -03 2019
diff --git a/eev-elinks.el b/eev-elinks.el
index cd9553a..d43ddb9 100644
--- a/eev-elinks.el
+++ b/eev-elinks.el
@@ -19,7 +19,7 @@
 ;;
 ;; Author:     Eduardo Ochs <address@hidden>
 ;; Maintainer: Eduardo Ochs <address@hidden>
-;; Version:    2019feb03
+;; Version:    2019feb25
 ;; Keywords:   e-scripts
 ;;
 ;; Latest version: <http://angg.twu.net/eev-current/eev-elinks.el>
@@ -62,8 +62,10 @@
 ;; �.find-ekey-links�          (to "find-ekey-links")
 ;; �.find-elongkey-links�      (to "find-elongkey-links")
 ;; �.find-einfo-links�         (to "find-einfo-links")
+;; �.find-eintro�              (to "find-eintro")
 
 ;; �.ee-code-c-d-pairs-eval�   (to "ee-code-c-d-pairs-eval")
+;; �.ee-code-c-d-filter�       (to "ee-code-c-d-filter")
 ;; �.ee-find-xxxfile-sexps�    (to "ee-find-xxxfile-sexps")
 ;; �.find-file-links�          (to "find-file-links")
 ;; �.find-grep-links�          (to "find-grep-links")
@@ -443,84 +445,146 @@ This is an internal function used by `find-ekey-links' 
and
 ;;; |_| |_|_| |_|\__,_|      \___|_|_| |_|_|  \___/ 
 ;;;                                                 
 ;; �find-einfo-links� (to ".find-einfo-links")
-;; A test: (progn (find-enode "Lisp Eval") (find-einfo-links))
-;;         (progn (find-enode "Lisp Eval") (eek "M-h M-i"))
+;; Tests: (progn (find-enode "Lisp Eval") (find-einfo-links))
+;;        (progn (find-enode "Lisp Eval") (eek "M-h M-i"))
 
 ;; Moved to eev-mode.el:
 ;; (define-key eev-mode-map "\M-h\M-i" 'find-einfo-links)
 
 (defvar ee-info-file "")
 
-(defun ee-infop       () (get-buffer "*info*"))
-(defun ee-info-node   () (with-current-buffer "*info*" Info-current-node))
-(defun ee-info-book+  () (with-current-buffer "*info*" Info-current-file))
-(defun ee-info-book-  () (file-name-nondirectory (ee-info-book+)))
-(defun ee-info-file-  () (file-name-nondirectory  ee-info-file))
-(defun ee-info-shortp () (string= (ee-info-book-) (ee-info-file-)))
-(defun ee-info-shortf () (ee-intern "find-%snode" ee-info-code))
-(defun ee-info-fullnode () (format "(%s)%s" (ee-info-book-) (ee-info-node)))
+(defun ee-infop          () (get-buffer "*info*"))
+(defun ee-info-node      () (with-current-buffer "*info*" Info-current-node))
+(defun ee-info-book+     () (with-current-buffer "*info*" Info-current-file))
+(defun ee-info-book-     () (file-name-nondirectory (ee-info-book+)))
+(defun ee-info-fullnode  () (format "(%s)%s" (ee-info-book-) (ee-info-node)))
+(defun ee-info-fullnode+ () (format "(%s)%s" (ee-info-book+) (ee-info-node)))
+
+(defun ee-info-file-     () (file-name-nondirectory ee-info-file))
+(defun ee-info-shortp    () (string= (ee-info-book-) (ee-info-file-)))
+(defun ee-info-shortf    () (ee-intern "find-%snode" ee-info-code))
+(defun ee-info-shortlink () (list (ee-info-shortf) (ee-info-node)))
 
 (defun ee-find-info-links ()
   `((info      ,(ee-info-fullnode))
     (find-node ,(ee-info-fullnode))
-    ,(if (ee-info-shortp)
-        (list (ee-info-shortf) (ee-info-node)))))
-
-
-;; A test: (ee-intro-stem "*(find-foo-intro)*")
+    ,(if (ee-info-shortp) (ee-info-shortlink))
+    ))
 
-(defun find-einfo-links (&optional intro &rest rest)
+(defun find-einfo-links (&optional fullnode &rest rest)
   "Visit a temporary buffer containing hyperlinks to the current info page.
-When possible, try to produce also a shorter hyperlink, like the last one in:
+When possible try to produce also a short hyperlink, like the last one in:
+
   (info \"(bashref)Pipelines\")
   (find-node \"(bashref)Pipelines\")
   (find-bashnode \"Pipelines\")
-The hack for generating the shorter hyperlink uses the global
-variables `ee-info-code' and `ee-info-file' - see:
-  (progn
-   (find-code-c-d \"bash\" \"/usr/share/doc/bash/examples/\" \"bashref\")
-   (ee-goto-position \"ee-info-code\"))
-
-As an extra hack, if this function is called from a \"*(find-???-intro)*\"
-buffer, also generate a link to that buffer."
+
+The short link is generated when the non-directory part of the
+current value of the global variable `ee-info-file' - set by the
+last call to a function of the form `find-XXXnode' - matches the
+value of (ee-info-book-). This only works reliably for info
+\"books\" that are in `Info-directory-list'."
   (interactive)
-  (setq intro (or intro (ee-intro-stem (buffer-name (current-buffer)))))
+  (setq fullnode (or fullnode (ee-info-fullnode)))
   (apply 'find-elinks `(
     ;; Convention: the first sexp always regenerates the buffer.
-    (find-einfo-links ,intro ,@rest)
-    ;; Body:
+    (find-einfo-links ,fullnode ,@rest)
+    (find-einfo-links ,(ee-info-fullnode+) ,@rest)
     ""
-    ,@(if (ee-infop)
-         (ee-find-info-links)
-       '("[No \"*info*\" buffer]"))
-    ""
-    ,@(if intro
-        ;; (list (ee-intern "find-%s-intro" intro))
-        (ee-find-intro-links)
-       ;; else: "[Not invoked from a \"*find-xxx-intro*\" buffer]"
-       )
+    ,@(ee-find-info-links)
     ) rest))
 
 
+;; A test: (ee-intro-stem "*(find-foo-intro)*")
 
-
-;; Used by `find-intro-links', that was moved to:
-;;   (find-eev "eev-tlinks.el" "find-intro-links")
-
+;; Old version:
+
+;; (defun find-einfo-links (&optional intro &rest rest)
+;;   "Visit a temporary buffer containing hyperlinks to the current info page.
+;; When possible, try to produce also a shorter hyperlink, like the last one 
in:
+;;   (info \"(bashref)Pipelines\")
+;;   (find-node \"(bashref)Pipelines\")
+;;   (find-bashnode \"Pipelines\")
+;; The hack for generating the shorter hyperlink uses the global
+;; variables `ee-info-code' and `ee-info-file' - see:
+;;   (progn
+;;    (find-code-c-d \"bash\" \"/usr/share/doc/bash/examples/\" \"bashref\")
+;;    (ee-goto-position \"ee-info-code\"))
+;; 
+;; As an extra hack, if this function is called from a \"*(find-???-intro)*\"
+;; buffer, also generate a link to that buffer."
+;;   (interactive)
+;;   (setq intro (or intro (ee-intro-stem (buffer-name (current-buffer)))))
+;;   (apply 'find-elinks `(
+;;     ;; Convention: the first sexp always regenerates the buffer.
+;;     (find-einfo-links ,intro ,@rest)
+;;     ;; Body:
+;;     ""
+;;     ,@(if (ee-infop)
+;;       (ee-find-info-links)
+;;        '("[No \"*info*\" buffer]"))
+;;     ""
+;;     ,@(if intro
+;;      ;; (list (ee-intern "find-%s-intro" intro))
+;;      (ee-find-intro-links)
+;;        ;; else: "[Not invoked from a \"*find-xxx-intro*\" buffer]"
+;;        )
+;;     ) rest))
+
+
+
+;;;   __ _           _            _       _             
+;;;  / _(_)_ __   __| |       ___(_)_ __ | |_ _ __ ___  
+;;; | |_| | '_ \ / _` |_____ / _ \ | '_ \| __| '__/ _ \ 
+;;; |  _| | | | | (_| |_____|  __/ | | | | |_| | | (_) |
+;;; |_| |_|_| |_|\__,_|      \___|_|_| |_|\__|_|  \___/ 
+;;;                                                     
+;; �find-eintro� (to ".find-eintro")
+
+;; Test: (ee-intro-stem "*(find-eev-quick-intro)*")
 (defun ee-intro-stem (&optional bufname)
-  (setq bufname (or bufname (buffer-name (current-buffer))))
+  "Convert a string of the form \"*(find-STEM-intro)*\" to \"STEM\".
+When BUFNAME is nil use the name of the current buffer instead.
+When BUFNAME is a string that is not of the right form return nil.
+This can be used to test if the current buffer is an intro buffer."
+  (setq bufname (or bufname (buffer-name)))
   (if (string-match "^\\*(find-\\(.*\\)-intro)\\*$" bufname)
       (match-string 1 bufname)))
 
+;; Test: (find-elinks (ee-find-intro-links "FOO"))
 (defun ee-find-intro-links (&optional stem)
-  (setq stem (or stem (ee-intro-stem)))
   (let ((find-xxx-intro (ee-intern "find-%s-intro" stem))
        (url (format "http://angg.twu.net/eev-intros/find-%s-intro.html"; stem)))
     `(,(ee-H url)
       (,find-xxx-intro)
       )))
 
-  
+;; Test: (find-eintro-links "eev-quick")
+(defun find-eintro-links (&optional stem &rest rest)
+  "Visit a temporary buffer containing hyperlinks to the current intro.
+This only works reliably if either 1) the current buffer has a
+name like \"*(find-STEM-intro)*\", or 2) STEM is given explicitly."
+  (interactive)
+  (setq stem (or stem (ee-intro-stem)))
+  (apply 'find-elinks `(
+    ;; Convention: the first sexp always regenerates the buffer.
+    (find-eintro-links ,stem ,@rest)
+    ""
+    ,@(ee-find-intro-links stem)
+    ) rest))
+
+
+;; Note that eev-mode.el has this:
+;; (define-key eev-mode-map "\M-h\M-i" 'find-eintro-or-einfo-links)
+(defun find-eintro-or-einfo-links ()
+  "Visit a temporary buffer containing hyperlinks to the current intro buffer.
+If we're not in an intro buffer, visit a temporary buffer
+containing hyperlinks to the current _info node_ instead. This is
+a hack to let use use `M-h M-i' for both \"intro\" and \"info\"."
+  (interactive)
+  (if (ee-intro-stem)
+      (find-eintro-links)
+    (find-einfo-links)))
 
 
 
@@ -535,6 +599,7 @@ buffer, also generate a link to that buffer."
 ;;;                                                  |_|                     
 ;;
 ;; �ee-code-c-d-pairs-eval� (to ".ee-code-c-d-pairs-eval")
+;; �ee-code-c-d-filter� (to ".ee-code-c-d-filter")
 ;; Each call to `(code-c-d C D)' generates an entry `(C D)' in the
 ;; alist `ee-code-c-d-pairs', and this is used to make
 ;; `(find-file-links FNAME)' list short hyperlinks to FNAME. Let's
@@ -573,7 +638,7 @@ Actually return a list of `(F elt)'s."
 
 (defun ee-code-c-d-filter-1 (code)
   "Run CODE on each `c-d' of `ee-code-c-d-pairs' and return a list of results.
-This is a simpler version of `ee-code-c-d-filter-1', used for debugging."
+This is a simpler version of `ee-code-c-d-filter-2', used for debugging."
   (ee-filter
    (lambda (c-d)
      (let* ((c (car c-d))
@@ -625,6 +690,8 @@ Only eval CODE when (ee-expand D) is a prefix of (ee-expand 
FNAME)."
 (defun ee-intern (fmt &rest args)
   (intern (apply 'format fmt args)))
 
+;; Renamed to `ee-code-c-d-filter-2'. See above.
+;;
 ;; (defun ee-code-c-d-pairs-eval (fname code)
 ;;   "For each entry (C D) in `ee-code-c-d-pairs' for which D is a prefix of 
FNAME,
 ;; evaluate f in the context of a big `let', and return the result."
@@ -1188,8 +1255,8 @@ This needs a temporary directory; see: 
(find-prepared-intro)"
 
 (defun ee-find-here-links0 ()
   `(,(ee-H "See: ")
-    (find-links-intro "`find-here-links'")
-    (find-efunctiondescr 'eev-mode "M-h M-h")
+    (find-eev-quick-intro "4.1. `find-here-links'")
+    (find-emacs-keys-intro "1. Basic keys (eev)" "M-h M-h")
     ))
 
 ;; (find-find-links-links "\\M-h" "here" "")
diff --git a/eev-intro.el b/eev-intro.el
index 4964772..454190b 100644
--- a/eev-intro.el
+++ b/eev-intro.el
@@ -20,7 +20,7 @@
 ;;
 ;; Author:     Eduardo Ochs <address@hidden>
 ;; Maintainer: Eduardo Ochs <address@hidden>
-;; Version:    2019feb23
+;; Version:    2019feb25
 ;; Keywords:   e-scripts
 ;;
 ;; Latest version: <http://angg.twu.net/eev-current/eev-intro.el>
@@ -1380,6 +1380,74 @@ then these hyperlinks should work:
 
 
 
+
+10. Generating short hyperlinks
+===============================
+
+10.1. Generating short hyperlinks to files
+------------------------------------------
+If you run this
+
+  (code-c-d \"foo\"  \"/tmp/FOO\")
+  (code-c-d \"bar\"  \"/tmp/FOO/BAR/\")
+  (code-c-d \"plic\" \"/tmp/FOO/BAR/PLIC/\")
+
+then these five links will all point to the same file:
+
+  (find-file  \"/tmp/FOO/BAR/PLIC/bletch\")
+  (find-fline \"/tmp/FOO/BAR/PLIC/bletch\")
+  (find-foofile       \"/BAR/PLIC/bletch\")
+  (find-barfile            \"PLIC/bletch\")
+  (find-plicfile                \"bletch\")
+ 
+Note that the last three are short hyperlinks. If you open that
+file and then type `M-h M-h' this will run `find-here-links',
+that will run:
+
+  (find-file-links \"/tmp/FOO/BAR/PLIC/bletch\")
+
+and this will create an elisp hyperlinks buffer in which the last
+sexps will be the three different short hyperlinks to
+\"/tmp/FOO/BAR/PLIC/bletch\" above.
+
+This works for all files. If you visit a file and type `M-h M-h'
+then the last hyperlinks in the temporary buffer will be the
+short hyperlinks to that file.
+
+
+
+
+10.2. Generating short hyperlinks to info nodes
+-----------------------------------------------
+If you run this
+
+  (code-c-d \"el\" ee-emacs-lisp-directory \"elisp\")
+
+then these three hyperlinks will point to the same info node:
+
+  (info      \"(elisp)Top\")
+  (find-node \"(elisp)Top\")
+  (find-elnode      \"Top\")
+
+Note that the last one is a short hyperlink. If you open that
+info node and type `M-h M-h' this will run `find-here-links',
+that will run something similar to:
+
+  (find-einfo-links \"(elisp)Top\")
+
+
+
+
+10.3. Generating short hyperlinks to intros
+-------------------------------------------
+
+10.3. Generating short hyperlinks to PDFs
+-----------------------------------------
+
+
+
+
+
 \(To be continued...)
 " pos-spec-list)))
 
@@ -1682,9 +1750,28 @@ very far. See:
   (find-enode    \"Packages\")
   (find-elnode   \"Packaging\")
   (find-efaqnode \"Packages that do not come with Emacs\")
+  (find-elnode   \"Autoload\")
+
+Eev is an atypical package and I am note sure how to handle
+autoloads in its case. I would like - *in a first moment!* - to
+make only a handful of its functions autoloadable, and to make
+each of them autoload all the main modules of eev, but I couldn't
+find (yet) how to do that...
 
 Help would be greatly appreciated!
 
+Note: _100%_ of the feedback that I received about eev in the
+last years came from people who knew practically nothing about
+Emacs or GNU/Linux before trying eev. They installed it by
+copying and pasting to a terminal the script in
+
+  (find-eev-quick-intro \"1. Installing eev\")
+
+and then invoking Emacs+eev with the \"~/eev\" script. For them
+installing a package with `M-x list-packages' is too hard.
+
+If you want to change these statistics, send me a \"hi\"!
+
 
 " pos-spec-list)))
 
diff --git a/eev-mode.el b/eev-mode.el
index e554de0..bf1897e 100644
--- a/eev-mode.el
+++ b/eev-mode.el
@@ -19,7 +19,7 @@
 ;;
 ;; Author:     Eduardo Ochs <address@hidden>
 ;; Maintainer: Eduardo Ochs <address@hidden>
-;; Version:    2019feb23
+;; Version:    2019feb25
 ;; Keywords:   e-scripts
 ;;
 ;; Latest version: <http://angg.twu.net/eev-current/eev-mode.el>
@@ -101,18 +101,18 @@ and: (find-eval-intro \"`M-k'\")"
   ;;   (find-eev-quick-intro "4. Creating Elisp Hyperlinks")
   ;;   (find-eev-quick-intro "4. Creating Elisp Hyperlinks" "`M-h M-h'")
   ;; Source: (find-eev "eev-elinks.el")
-  (define-key eev-mode-map "\M-h\M-d" 'find-debpkg-links)    
-  (define-key eev-mode-map "\M-h\M-f" 'find-efunction-links) 
+  (define-key eev-mode-map "\M-h\M-d" 'find-debpkg-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)
-  (define-key eev-mode-map "\M-h\M-i" 'find-einfo-links)     
-  (define-key eev-mode-map "\M-h\M-k" 'find-ekey-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-n" 'find-eunicodeucs)
   (define-key eev-mode-map "\M-h\M-p" 'find-pdflike-page-links)
-  (define-key eev-mode-map "\M-h\M-v" 'find-evariable-links) 
-  (define-key eev-mode-map "\M-hf"    'find-file-links)      
+  (define-key eev-mode-map "\M-h\M-v" 'find-evariable-links)
+  (define-key eev-mode-map "\M-hf"    'find-file-links)
   (define-key eev-mode-map "\M-hM"    'find-ekbmacro-links)
-  ;; (define-key eev-mode-map "\M-h\M-m" 'find-manpage-links)   
+  ;; (define-key eev-mode-map "\M-h\M-m" 'find-manpage-links)
   ;; (define-key eev-mode-map "\M-hm"    'find-last-manpage-links)
   ;;
   ;; Information about text properties, faces, and chars:
@@ -212,7 +212,7 @@ Commands to convert the current line into hyperlinks:
 Commands to generate pages with lists of hyperlinks:
   \\[find-here-links]  -- \"hyperlinks to here\", which supersedes all these:
     \\[find-file-links]   -- hyperlinks to the current file
-    \\[find-einfo-links] -- hyperlinks to the current Info node (or intro)
+    \\[find-find-eintro-or-einfo-links] -- hyperlinks to the current intro, or 
Info node
     \\[find-grep-links] -- hyperlinks to `find-xxxgrep' sexps
     \\[find-manpage-links] -- hyperlinks to a manpage (ask for name)
     \\[find-last-manpage-links]   -- hyperlinks to a manpage (being viewed)
diff --git a/eev-tlinks.el b/eev-tlinks.el
index a61c1b1..f669fba 100644
--- a/eev-tlinks.el
+++ b/eev-tlinks.el
@@ -272,18 +272,16 @@ This is an internal function used by 
`find-{stem}-links'.\"
 ;; (find-find-links-links "i" "intro" "stem")
 ;; A test: (find-intro-links)
 
-(defun ee-intro-stem (&optional bufname)
-  (setq bufname (or bufname (buffer-name)))
-  (if (string-match "^\\*(find-\\(.*\\)-intro)\\*$" bufname)
-      (match-string 1 bufname)))
-
 (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 (list (ee-intro-stem)))
+  (interactive)
   (setq stem (or stem "{stem}"))
   (apply 'find-elinks-elisp
-   `((find-intro-links ,stem ,@pos-spec-list)
+   `((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 "\
@@ -311,6 +309,7 @@ Hello
 ;; (find-{stem}-intro)
 ")) pos-spec-list))
 
+;; (find-intro-links)
 ;; (find-intro-links "emacs")
 
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]