branch: externals/eev commit 24a2753f93881c2e64a414de0c5ddee2ff42aba8 Author: Eduardo Ochs <eduardoo...@gmail.com> Commit: Eduardo Ochs <eduardoo...@gmail.com>
Added a few new `find-*-links' functions. --- ChangeLog | 18 ++++ VERSION | 4 +- eev-blinks.el | 6 +- eev-elinks.el | 246 +++++++++++++++++++++++++++++++++++++++++++---------- eev-hlinks.el | 15 ++-- eev-intro.el | 7 +- eev-multiwindow.el | 28 +++++- eev-tlinks.el | 34 ++++++-- 8 files changed, 296 insertions(+), 62 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2392bd1..26f369a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2021-12-19 Eduardo Ochs <eduardoo...@gmail.com> + + * eev-elinks.el (find-ekbmacro-links): small changes. + (find-emajormode-links): new function. + (find-eminormodes-links): new function. + + * eev-blinks.el (find-eppm): new function. + +2021-12-18 Eduardo Ochs <eduardoo...@gmail.com> + + * eev-elinks.el (ee-package-url): new function. + (ee-find-epackage-links0): mostly rewritten. + +2021-12-17 Eduardo Ochs <eduardoo...@gmail.com> + + * eev-multiwindow.el (ee-first-frame-with-title) + (ee-select-frame, find-wset-F): new functions. + 2021-12-16 Eduardo Ochs <eduardoo...@gmail.com> * eev-hlinks.el (ee-find-w3m-links): new function. diff --git a/VERSION b/VERSION index c3056e0..a78b58f 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -Fri Dec 17 01:42:59 GMT 2021 -Thu Dec 16 22:42:59 -03 2021 +Sun Dec 19 19:50:42 GMT 2021 +Sun Dec 19 16:50:42 -03 2021 diff --git a/eev-blinks.el b/eev-blinks.el index df54552..f6614d2 100644 --- a/eev-blinks.el +++ b/eev-blinks.el @@ -21,7 +21,7 @@ ;; ;; Author: Eduardo Ochs <eduardoo...@gmail.com> ;; Maintainer: Eduardo Ochs <eduardoo...@gmail.com> -;; Version: 20211101 +;; Version: 20211219 ;; Keywords: e-scripts ;; ;; Latest version: <http://angg.twu.net/eev-current/eev-blinks.el> @@ -1045,6 +1045,10 @@ that `find-epp' would print in a single line." (let ((ee-buffer-name (or ee-buffer-name "*pp*"))) (apply 'find-estring-elisp (ee-ppp0 object) pos-spec-list))) +(defun find-eppm (code &rest pos-spec-list) + "This is essentially the same as (find-epp (macroexpand CODE))." + (apply 'find-epp (macroexpand code) pos-spec-list)) + ;; «find-efunctionpp» (to ".find-efunctionpp") ;; See: (find-elisp-intro "6. Defining functions") ;; (find-elisp-intro "6. Defining functions" "lambda") diff --git a/eev-elinks.el b/eev-elinks.el index f1080d7..92abe0d 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: 20211128 +;; Version: 20211219 ;; Keywords: e-scripts ;; ;; Latest version: <http://angg.twu.net/eev-current/eev-elinks.el> @@ -70,14 +70,19 @@ ;; «.ee-find-xxxfile-sexps» (to "ee-find-xxxfile-sexps") ;; «.find-file-links» (to "find-file-links") ;; «.find-grep-links» (to "find-grep-links") -;; «.find-ekbmacro-links» (to "find-ekbmacro-links") ;; «.find-pdflike-page-links» (to "find-pdflike-page-links") ;; «.ee-hyperlink-prefix» (to "ee-hyperlink-prefix") + ;; «.find-eface-links» (to "find-eface-links") ;; «.find-ecolor-links» (to "find-ecolor-links") ;; «.find-epackage-links» (to "find-epackage-links") -;; «.ee-package-dir» (to "ee-package-dir") +;; «.ee-package-desc» (to "ee-package-desc") +;; «.ee-package-dir» (to "ee-package-dir") ;; «.find-esetkey-links» (to "find-esetkey-links") +;; «.find-ekbmacro-links» (to "find-ekbmacro-links") +;; «.find-emajormode-links» (to "find-emajormode-links") +;; «.find-eminormodes-links» (to "find-eminormodes-links") +;; «.find-emodeline-links» (to "find-emodeline-links") ;; «.find-code-pdf-links» (to "find-code-pdf-links") ;; «.find-pdf-links» (to "find-pdf-links") @@ -488,9 +493,15 @@ This is an internal function used by `find-ekey-links' and ;; «find-einfo-links» (to ".find-einfo-links") ;; 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) +;; +;; Key binding: +;; (find-eev "eev-mode.el" "eev-mode-map-set") +;; (find-eev "eev-mode.el" "eev-mode-map-set" "\\M-h\\M-i") +;; +;; See: +;; (find-eev "eev-hlinks.el" "ee-fhl-main-program") +;; (find-eev "eev-hlinks.el" "ee-fhl-main-program" "(ee-find-info-links)") +;; (find-eev-quick-intro "10.2. Generating short hyperlinks to info nodes") (defvar ee-info-file "") @@ -913,34 +924,6 @@ when this is true remove the prefix D from FNAME, and put the sexp -;;; __ _ _ -;;; / _(_)_ __ __| | _ __ ___ __ _ ___ _ __ ___ -;;; | |_| | '_ \ / _` |_____| '_ ` _ \ / _` |/ __| '__/ _ \ -;;; | _| | | | | (_| |_____| | | | | | (_| | (__| | | (_) | -;;; |_| |_|_| |_|\__,_| |_| |_| |_|\__,_|\___|_| \___/ -;;; -;; «find-ekbmacro-links» (to ".find-ekbmacro-links") -;; Skel: (find-find-links-links-old "M" "macro" "") -;; (find-efunction 'find-ekbmacro-links) - -;; Moved to eev-mode.el: -;; (define-key eev-mode-map "\M-hM" 'find-ekbmacro-links) - -(defun find-ekbmacro-links () (interactive) - (find-elinks `( - (find-ekbmacro-links) - "" - (format-kbd-macro last-kbd-macro) - (setq last-kbd-macro (kbd ,(format-kbd-macro last-kbd-macro))) - "" - (find-enode "Keyboard Macros") - (find-enode "Edit Keyboard Macro") - (eek "M-h M-k C-x C-k C-e ;; kmacro-edit-macro-repeat") - (eek " C-x C-k C-e ;; kmacro-edit-macro-repeat") - (eek "M-h M-k C-x C-k l ;; kmacro-edit-lossage") - (eek " C-x C-k l ;; kmacro-edit-lossage") - ))) - ;;; _ __ _ _ _ @@ -1259,6 +1242,18 @@ If D is t then try to use `ee-package-dir' to get the directory." # (find-epp (ee-package-desc '{pkg})) # (find-estruct (ee-package-desc '{pkg})) +# (package-initialize) +# (package-refresh-contents) +# (package-install '{pkg}) +# (find-epackage '{pkg}) +# (ee-package-dir '{pkg}) +# (find-fline (ee-package-dir '{pkg})) +# (find-epp (ee-package-desc '{pkg})) +# (find-estruct (ee-package-desc '{pkg})) +# (kill-new (ee-package-url '{pkg})) +# (insert \"\\n# \" (ee-package-url '{pkg})) +# (package-delete (ee-package-desc '{pkg})) + # (find-epackage-links '{pkg} \"{c}\" t) # (find-epackage '{pkg}) # (code-c-d \"{c}\" \"{d}\") @@ -1300,6 +1295,7 @@ If D is t then try to use `ee-package-dir' to get the directory." +;; «ee-package-desc» (to ".ee-package-desc") ;; «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 @@ -1322,15 +1318,6 @@ If D is t then try to use `ee-package-dir' to get the directory." ;; (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)." @@ -1341,6 +1328,22 @@ Convert PKG - a symbol - to a package-desc structure (or to nil)." (package--from-builtin built-in) (cadr (assq pkg package-archive-contents)))))) +(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-url (pkg) + "Convert the name of the package PKG to its website." + (let ((desc (ee-package-desc pkg))) + (and desc (alist-get :url (package-desc-extras desc))))) + + + @@ -1419,6 +1422,163 @@ Convert PKG - a symbol - to a package-desc structure (or to nil)." +;;; __ _ _ +;;; / _(_)_ __ __| | _ __ ___ __ _ ___ _ __ ___ +;;; | |_| | '_ \ / _` |_____| '_ ` _ \ / _` |/ __| '__/ _ \ +;;; | _| | | | | (_| |_____| | | | | | (_| | (__| | | (_) | +;;; |_| |_|_| |_|\__,_| |_| |_| |_|\__,_|\___|_| \___/ +;;; +;; «find-ekbmacro-links» (to ".find-ekbmacro-links") +;; Skel: (find-find-links-links-new "ekbmacro" "" "") +;; Test: (find-ekbmacro-links) +;; +;; The standard way to save and edit keyboard macros is with +;; the key sequences explained here, +;; (find-enode "Keyboard Macros") +;; (find-enode "Save Keyboard Macro") +;; (find-enode "Edit Keyboard Macro") +;; but I prefer to use this function. It is bound to `M-h M': +;; (find-eev "eev-mode.el" "eev-mode-map-set") +;; (find-eev "eev-mode.el" "eev-mode-map-set" "\\M-hM") +;; +(defun find-ekbmacro-links (&rest pos-spec-list) +"Visit a temporary buffer containing hyperlinks on keyboard macros." + (interactive) + (apply + 'find-elinks + `((find-ekbmacro-links ,@pos-spec-list) + ;; Convention: the first sexp always regenerates the buffer. + (find-efunction 'find-ekbmacro-links) + "" + (format-kbd-macro last-kbd-macro) + (setq last-kbd-macro (kbd ,(format-kbd-macro last-kbd-macro))) + (eek ,(format-kbd-macro last-kbd-macro)) + "" + (find-enode "Keyboard Macros") + (find-enode "Save Keyboard Macro") + (find-enode "Edit Keyboard Macro") + (eek "M-h M-k C-x C-k C-e ;; kmacro-edit-macro-repeat") + (eek " C-x C-k C-e ;; kmacro-edit-macro-repeat") + (eek "M-h M-k C-x C-k l ;; kmacro-edit-lossage") + (eek " C-x C-k l ;; kmacro-edit-lossage") + ) + pos-spec-list)) + + + +;; «find-emajormode-links» (to ".find-emajormode-links") +;; Skel: (find-find-links-links-new "emajormode" "mode" "") +;; Test: (find-emajormode-links major-mode) +;; +(defun find-emajormode-links (&optional mode &rest pos-spec-list) +"Visit a temporary buffer containing hyperlinks about the major mode." + (interactive (list major-mode)) + (setq mode (or mode "{mode}")) + (apply + 'find-elinks + `((find-emajormode-links ,mode ,@pos-spec-list) + ;; Convention: the first sexp always regenerates the buffer. + (find-efunction 'find-emajormode-links) + "" + (find-efunction-links ',mode) + (find-efunctiondescr ',mode) + (find-efunction ',mode) + "" + (find-estring (documentation ',mode)) + (find-estring (documentation ',mode t)) + ) + pos-spec-list)) + + + + +;; «find-eminormodes-links» (to ".find-eminormodes-links") +;; Skel: (find-find-links-links-new "eminormodes" "" "") +;; Test: (find-eminormodes-links) +;; +(defun find-eminormodes-links (&rest pos-spec-list) +"Visit a temporary buffer containing hyperlinks about minor modes." + (interactive) + (apply + 'find-elinks + `((find-eminormodes-links ,@pos-spec-list) + ;; Convention: the first sexp always regenerates the buffer. + (find-efunction 'find-eminormodes-links) + "" + (find-elnode "Minor Modes") + (find-eppp minor-mode-list) + (find-eppp local-minor-modes) + (find-eppp global-minor-modes) + "" + (require 'dash) + (find-eppp (--filter (not (boundp it)) minor-mode-list)) + (find-eppp (--filter (and (boundp it) (symbol-value it)) minor-mode-list)) + (find-elinks (--map `(find-efunctiondescr ',it) minor-mode-list)) + (find-elinks (--map `(find-efunction ',it) minor-mode-list)) + "" + (find-elnode "Active Keymaps") + (find-elnode "Standard Keymaps") + (find-elnode "Searching Keymaps") + (find-elnode "Controlling Active Maps") + (find-elnode "Controlling Active Maps" "current-minor-mode-maps") + (find-elnode "Controlling Active Maps" "minor-mode-key-binding") + (find-eppp (current-minor-mode-maps)) + (find-eppp minor-mode-map-alist) + (find-eppp (-map 'car minor-mode-map-alist)) + "" + (find-efunctiondescr 'define-minor-mode) + (find-efunction 'define-minor-mode) + (find-eppm '(define-minor-mode ee-FOO-mode "no doc" :keymap ee-FOO-map)) + ) + pos-spec-list)) + + + + +;; «find-emodeline-links» (to ".find-emodeline-links") +;; Skel: (find-find-links-links-new "emodeline" "" "") +;; Test: (find-emodeline-links) +;; +(defun find-emodeline-links (&rest pos-spec-list) +"Visit a temporary buffer containing hyperlinks about the mode line. +You can use this to understand how the mode line works." + (interactive) + (apply + 'find-elinks + `((find-emodeline-links ,@pos-spec-list) + ;; Convention: the first sexp always regenerates the buffer. + (find-efunction 'find-emodeline-links) + "" + (find-elnode "Mode Line Format") + (find-elnode "Emulating Mode Line") + (find-evardescr 'mode-line-format) + (find-epp mode-line-format) + (find-epp (format-mode-line mode-line-format)) + (find-epp (format-mode-line mode-line-format 'header-line)) + (ee-no-properties (format-mode-line mode-line-format)) + (insert "\n# " (format-mode-line mode-line-format)) + "" + (find-evardescr 'mode-line-front-space) + (find-evardescr 'mode-line-mule-info) + (find-evardescr 'mode-line-client) + (find-evardescr 'mode-line-modified) + (find-evardescr 'mode-line-remote) + (find-evardescr 'mode-line-frame-identification) + (find-evardescr 'mode-line-buffer-identification) + (find-evardescr 'mode-line-position) + (find-evardescr 'mode-line-modes) + (find-evardescr 'mode-line-misc-info) + (find-evardescr 'mode-line-end-spaces) + ) + pos-spec-list)) + + + + + + + + ;;; __ _ _ _ _ _ _ ;;; / _(_)_ __ __| | ___ ___ __| | _____/\__ | (_)_ __ | | _____ diff --git a/eev-hlinks.el b/eev-hlinks.el index caef768..63e84a4 100644 --- a/eev-hlinks.el +++ b/eev-hlinks.el @@ -19,7 +19,7 @@ ;; ;; Author: Eduardo Ochs <eduardoo...@gmail.com> ;; Maintainer: Eduardo Ochs <eduardoo...@gmail.com> -;; Version: 20211216 +;; Version: 20211219 ;; Keywords: e-scripts ;; ;; Latest version: <http://angg.twu.net/eev-current/eev-hlinks.el> @@ -75,6 +75,7 @@ ;; «.ee-fhl-main-program» (to "ee-fhl-main-program") ;; «.ee-fhl-run» (to "ee-fhl-run") ;; «.ee-find-here-links» (to "ee-find-here-links") +;; «.ee-find-here-links-old» (to "ee-find-here-links-old") ;; «.find-here-links» (to "find-here-links") ;; ;; «.low-level-functions» (to "low-level-functions") @@ -100,7 +101,10 @@ ;; by a program in a domain-specific language that should be easy to ;; understand, easy to extend, and easy to debug - the one below. ;; +;; `find-here-links' runs this "program" with `ee-fhl-run'. +;; ;; Try: (find-eppp ee-fhl-main-program) +;; (ee-fhl-run ee-fhl-main-program) (defvar ee-fhl-main-program '(:or @@ -157,9 +161,10 @@ (defun ee-fhl-run (fhl-program) "See `ee-fhl-main-program'." - (setq ee-fhl-if-sexp1 nil) - (setq ee-fhl-if-sexp2 nil) - (ee-fhl-eval fhl-program)) + (setq ee-fhl-sexp1 nil) + (setq ee-fhl-sexp2 nil) + (ee-fhl-eval fhl-program) + (list ee-fhl-sexp1 ee-fhl-sexp2)) ;; Tests: ;; (ee-fhl-eval '(:eval (+ 20 3))) @@ -204,7 +209,7 @@ return the result of (eval ee-fhl-sexp2), slightly preprocessed." (cons "" (eval ee-fhl-sexp2))) - +;; «ee-find-here-links-old» (to ".ee-find-here-links-old") ;; Old version: ;; (defun ee-find-here-links () ;; (cond ;; by major mode diff --git a/eev-intro.el b/eev-intro.el index 907919e..d615e3b 100644 --- a/eev-intro.el +++ b/eev-intro.el @@ -6225,8 +6225,9 @@ are hyperlinks, and the ones in \"\"-lines are not. 3.3. `eepitch-preprocess-line' ------------------------------ The key <f8> is bound to `eepitch-this-line'. You can see the -source code of that function by following this hyperlink: +source code of that function by following these hyperlinks: + (find-eev \"eepitch.el\" \"eepitch-this-line\") (find-efunction 'eepitch-this-line) The source of `eepitch-this-line' contains this mysterious setq: @@ -6278,7 +6279,7 @@ then the in the source of `eepitch-this-line' will first set `line' to the string in the current line between the beginning-of-line and the end-of-line, and then if `line' starts with \"#: \" that prefix -is deleted from it; and it this \"line after removing the +is deleted from it; and it is this \"line after removing the prefix\" that is processed according the the rules of two red stars/one red star/no red stars. @@ -6296,7 +6297,7 @@ Gnuplot file works as a test block. Running - (setq eepitch-preprocess-regexp \"\") + (setq eepitch-preprocess-regexp \"^\") or diff --git a/eev-multiwindow.el b/eev-multiwindow.el index 34523a8..cec28b7 100644 --- a/eev-multiwindow.el +++ b/eev-multiwindow.el @@ -19,7 +19,7 @@ ;; ;; Author: Eduardo Ochs <eduardoo...@gmail.com> ;; Maintainer: Eduardo Ochs <eduardoo...@gmail.com> -;; Version: 20211031 +;; Version: 20211217 ;; Keywords: e-scripts ;; ;; Latest version: <http://angg.twu.net/eev-current/eev-multiwindow.el> @@ -146,6 +146,32 @@ that. This is mainly for `find-wset'." +;; Support for frames. +;; Inspired by this discussion: +;; https://lists.gnu.org/archive/html/eev/2021-11/index.html +;; +(defun ee-first-frame-with-title (title) + "Return the first frame with title TITLE or nil if none exists." + (let ((frameswiththattitle + (cl-loop for frame in (frame-list) + if (equal title (frame-parameter frame 'title)) + collect frame))) + (car frameswiththattitle))) + +(defun ee-select-frame (title) + "Like `select-frame-set-input-focus', but on a frame with title TITLE. +Use the first frame with that title if several exist. If there isn't a +frame with that title, create one." + (let ((frame (ee-first-frame-with-title title))) + (if frame + (select-frame-set-input-focus frame) + (let ((newframe (make-frame `((title . ,title))))) + (select-frame-set-input-focus newframe))))) + +(defun find-wset-F () (ee-select-frame (car sexps)) (setq sexps (cdr sexps))) + + + (provide 'eev-multiwindow) diff --git a/eev-tlinks.el b/eev-tlinks.el index 9999c51..731f7cc 100644 --- a/eev-tlinks.el +++ b/eev-tlinks.el @@ -43,11 +43,27 @@ ;; ;; See: ;; (find-links-conv-intro "3. Classification") +;; (find-links-conv-intro "3. Classification" "c)") ;; (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 (or many) months. +;; (find-links-conv-intro "3. Classification" "eev-tlinks.el") +;; +;; Many of the functions in this file are "five-minute hacks" whose +;; first versions were written in two steps. In the first step I ran +;; `M-x find-find-links-links-new', adjusted the arguments in the +;; first line of the temporary buffer and regenerated the buffer; this +;; gave me a "skeleton" for the real function. In the second step I +;; adjusted the arguments of the `find-elinks' and the string inside +;; the `ee-template0'. Each function here that was written in this way +;; has a "Skel:" line in the comments about its definition, and if you +;; run the sexp in the "Skel:" line you get its skeleton. There is a +;; video explaining this here: +;; +;; (to "find-find-links-links-new") +;; +;; Some of the functions in this file were written with an ancestor of +;; `find-find-links-links-new' that generated uglier code; they need +;; to be rewritten. Also, some functions here are very old, and I +;; haven't used or tested them in ages; they deserve to be deleted. @@ -327,13 +343,17 @@ This is an internal function used by `find-{stem}-links'.\" (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) + (find-find-links-links-new "mytaskA" "" "") + (find-find-links-links-new "mytaskB" "foo" "") + (find-find-links-links-new "mytaskC" "foo bar" "") + (find-find-links-links-new "mytaskD" "foo bar baz" "plic bletch") + (find-find-links-links-new) ;; 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))) + ,(concat ";; Skel: " (ee-S `(find-find-links-links-new ,stem ,args ,vars))) + ,(ee-template0 ";; Test: (find-{stem}-links)") ";;" ,(ee-ffll-defun stem args vars) )