branch: externals/eev commit a33e2d7edf6e1d22ecc0201402d344c727205f43 Author: Eduardo Ochs <eduardoo...@gmail.com> Commit: Eduardo Ochs <eduardoo...@gmail.com>
New file: eev-kla.el. --- .dir-locals.el | 14 ++++ ChangeLog | 10 +++ VERSION | 4 +- eev-edit.el | 13 ++-- eev-intro.el | 2 +- eev-kla.el | 208 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ eev-load.el | 3 +- eev.el | 2 +- 8 files changed, 245 insertions(+), 11 deletions(-) diff --git a/.dir-locals.el b/.dir-locals.el new file mode 100644 index 0000000000..ed831664f0 --- /dev/null +++ b/.dir-locals.el @@ -0,0 +1,14 @@ +;; This file: +;; http://angg.twu.net/eev-current/.dir-locals.el.html +;; http://angg.twu.net/eev-current/.dir-locals.el +;; (find-angg "eev-current/.dir-locals.el") +;; (find-eev ".dir-locals.el") +;; Author: Eduardo Ochs <eduardoo...@gmail.com> +;; Public domain. +;; +;; See: (find-eev "eev-kla.el" "intro") +;; (find-enode "Directory Variables") +;; (find-enode "Directory Variables" "a subdirectory (a string)") +;; +(("" . ((nil . ((ee-preferred-c . "eev"))))) + ) diff --git a/ChangeLog b/ChangeLog index ab0b4ae558..017c3e8fd7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2022-02-24 Eduardo Ochs <eduardoo...@gmail.com> + + * eev-kla.el: new file. + + * eev-load.el (eev-kla): load "eev-kla.el". + + * .dir-locals.el: new file. + + * eev-edit.el (ee-copy-preceding-tag-to-kill-ring): return str. + 2022-02-18 Eduardo Ochs <eduardoo...@gmail.com> * eev-videolinks.el (code-youtubevideo, find-code-youtubevideo) diff --git a/VERSION b/VERSION index 090b15fa03..9b94b0b316 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -Fri Feb 18 08:16:14 GMT 2022 -Fri Feb 18 05:16:14 -03 2022 +Thu Feb 24 08:38:28 GMT 2022 +Thu Feb 24 05:38:28 -03 2022 diff --git a/eev-edit.el b/eev-edit.el index 35e5f5638b..ecfe2a0065 100644 --- a/eev-edit.el +++ b/eev-edit.el @@ -1,6 +1,6 @@ ;;; eev-edit.el -- tools for editing (mainly refining) elisp hyperlinks. -*- lexical-binding: nil; -*- -;; Copyright (C) 2012-2020 Free Software Foundation, Inc. +;; Copyright (C) 2012-2021 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: 20201228 +;; Version: 20220224 ;; Keywords: e-scripts ;; ;; Latest version: <http://angg.twu.net/eev-current/eev-edit.el> @@ -44,6 +44,7 @@ ;; «.ee-duplicate-this-line» (to "ee-duplicate-this-line") ;; «.ee-yank-pos-spec» (to "ee-yank-pos-spec") ;; «.ee-copy-this-line-to-kill-ring» (to "ee-copy-this-line-to-kill-ring") +;; «.ee-copy-preceding-tag» (to "ee-copy-preceding-tag") ;; «.ee-shrink-hyperlink-at-eol» (to "ee-shrink-hyperlink-at-eol") ;; «.ee-flip-psne-ness» (to "ee-flip-psne-ness") ;; «.eewrap-vldi-list-line» (to "eewrap-vldi-list-line") @@ -143,11 +144,10 @@ With a prefix argument run `ee-copy-preceding-tag-to-kill-ring' instead." (message msg)))) - -;; Experimental, 2019aug29 +;; «ee-copy-preceding-tag» (to ".ee-copy-preceding-tag") ;; See: (find-anchors-intro "3. The preceding tag") +;; (find-anchors-intro "3. The preceding tag" "M-1 M-h M-w") ;; -;; (defun ee-tag-re () (ee-tolatin1 "«\\([!-~]+\\)»")) (defvar ee-tag-re-utf-8 "«\\([!-~]+\\)»") (defun ee-tag-re () ee-tag-re-utf-8) @@ -163,7 +163,8 @@ A \"tag\" is the string between \"«»\"s in an anchor." (msg (format "Copied \"%s\" to the kill ring" str))) (eeflash start end eeflash-copy) (kill-new str) - (message msg)) + (message msg) + str) (error "No preceding tag!")))) diff --git a/eev-intro.el b/eev-intro.el index 54868f3a24..128a1350e4 100644 --- a/eev-intro.el +++ b/eev-intro.el @@ -3511,7 +3511,7 @@ that the extra argument `:anchor' in (code-c-d \"eev\" ee-eev-source-directory :anchor) -let us abbreviate the link below, that points to an anchor, +lets us abbreviate the link below, that points to an anchor, (find-eevfile \"eev-blinks.el\" \"«find-wottb»\") diff --git a/eev-kla.el b/eev-kla.el new file mode 100644 index 0000000000..6c107e0e4a --- /dev/null +++ b/eev-kla.el @@ -0,0 +1,208 @@ +;;; eev-kla.el -- kill link to anchor and variants. -*- lexical-binding: nil; -*- + +;; Copyright (C) 2012-2021 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: 20220224 +;; Keywords: e-scripts +;; +;; Latest version: <http://angg.twu.net/eev-current/eev-kla.el> +;; htmlized: <http://angg.twu.net/eev-current/eev-kla.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-psne-intro.html> +;; <http://angg.twu.net/eev-intros/find-prepared-intro.html> +;; (find-eev-intro) +;; (find-psne-intro) +;; (find-prepared-intro) + +;; «.intro» (to "intro") +;; «.ee-preferred-c» (to "ee-preferred-c") +;; «.utils» (to "utils") +;; «.eekla» (to "eekla") +;; «.eeklf» (to "eeklf") + + + + +;;; Commentary: + +;; «intro» (to ".intro") +;; +;; 1. Choosing a link to here +;; ========================== +;; This section of the main tutorial +;; +;; (find-eev-quick-intro "10.1. Generating short hyperlinks to files") +;; +;; explains that we can have several `code-c-d's "pointing to the same +;; directory", and if we run +;; +;; (eek "M-h M-h ;; find-here-links") +;; +;; here in this file it will try to generate links to "here" - and it +;; will show several options, including one for each `code-c-d' that +;; points to this directory or to any of its parents. One of the +;; options will be this one: +;; +;; (find-eevfile "eev-kla.el") +;; +;; It is associated to this `code-c-d': +;; +;; (code-c-d "eev" ee-eev-source-directory :anchor) +;; +;; that is one of the predefined `code-c-d's that are executed when +;; eev is loaded. It appears here: +;; +;; (find-eev "eev-code.el" "code-c-d-s") +;; +;; Apparently there isn't a way to choose automatically which of the +;; links in the `find-here-links' buffer is the best one - we always +;; have to choose the "right" link by hand. +;; +;; +;; 2. Our preferred link to here +;; ============================= +;; This file implement a VERY HACKY way to choose the "right" link +;; automatically and to save it to the kill ring. When the variable +;; +;; ee-preferred-c +;; +;; is non-nil it says which `code-c-d' is the "best" one for this +;; file; if you eval it above you will see that its value is "eev", +;; that is the "c", i.e., the first argument, of this `code-c-d': +;; +;; (code-c-d "eev" ee-eev-source-directory :anchor) +;; +;; The "d" of that `code-c-d' is its second argument - the directory. +;; The "d" for that "c" is stored in this variable: +;; +;; ee-eevdir +;; +;; so knowing the "c" is enough. +;; +;; My favorite way to set the value of `ee-preferred-c' in a directory +;; and in all its subdirectories is by using directory variables. See: +;; +;; (find-enode "Directory Variables") +;; (find-eev ".dir-locals.el") +;; +;; +;; 3. Commands +;; =========== +;; At this moment this file implements these commands: +;; +;; 1) `M-x eekla', that <K>ills a <L>ink to an <A>nchor. See: +;; +;; (find-anchors-intro "3. The preceding tag" "M-1 M-h M-w") +;; (find-refining-intro "5. Pointing to anchors") +;; +;; 2) `M-x ee-preferred-c-show', that shows the current directory +;; and the value of `ee-preferred-c' at the window at the right. +;; This is useful to check if the ".dir-locals.el" file was +;; correctly written. +;; +;; Try them! =) +;; +;; TODO: `M-x eekls', that <K>ills a <L>ink to a <S>tring. + + +;; «ee-preferred-c» (to ".ee-preferred-c") +;; +(defvar ee-preferred-c nil + "See: (find-eev \"eev-kla.el\")") + +;;;###autoload +(put 'ee-preferred-c 'safe-local-variable #'stringp) + +(defun ee-preferred-c-show () + "Show the current value of `ee-preferred-c' at the window at the right." + (interactive) + (find-2a nil '(find-epp (list default-directory ee-preferred-c)))) + + + +;; «utils» (to ".utils") +;; +(defun ee-kl-dir (c) + (ee-expand (eval (read (format "ee-%sdir" c))))) + +(defun ee-kl-fname (c fname) + (ee-remove-prefix (ee-kl-dir c) (ee-expand fname))) + +(defun ee-kl-kill (sexp) + (kill-new (concat sexp "\n")) + (message "Copied to the kill ring: %s" sexp)) + + + +;;; _ _ +;;; ___ ___| | _| | __ _ +;;; / _ \/ _ \ |/ / |/ _` | +;;; | __/ __/ <| | (_| | +;;; \___|\___|_|\_\_|\__,_| +;;; +;; «eekla» (to ".eekla") +;; <K>ill <L>ink to <A>nchor. +;; More precisely: produce a link to the preceding anchor and put it +;; in the kill-ring. + +(defun ee-kla-sexp (c fname anchor) + (format "(find-%s \"%s\" \"%s\")" c (ee-kl-fname c fname) anchor)) + +(defun eekla () + "Put in the kill ring a link to the preceding anchor." + (interactive) + (let* ((c (or ee-preferred-c (error "`ee-preferred-c' is nil here!"))) + (fname buffer-file-name) + (anchor (ee-copy-preceding-tag-to-kill-ring))) + (ee-kl-kill (ee-kla-sexp c fname anchor)))) + + +;;; _ _ __ +;;; ___ ___| | _| |/ _| +;;; / _ \/ _ \ |/ / | |_ +;;; | __/ __/ <| | _| +;;; \___|\___|_|\_\_|_| +;;; +;; «eeklf» (to ".eeklf") +;; <K>ill <L>ink to <File>. + +(defun ee-klf-sexp (c fname) + (format "(find-%sfile \"%s\")" c (ee-kla-fname c fname))) + +(defun eeklf () + "Put in the kill ring a link to this file." + (interactive) + (let* ((c (or ee-preferred-c (error "`ee-preferred-c' is nil here!"))) + (fname buffer-file-name)) + (ee-kl-kill (ee-klf-sexp c fname)))) + + +;; I use these aliases: +;; (defalias 'kla 'eekla) +;; (defalias 'klf 'eeklf) + +(provide 'eev-kla) + + +;; Local Variables: +;; coding: utf-8-unix +;; no-byte-compile: t +;; End: diff --git a/eev-load.el b/eev-load.el index 6f5070eeaf..55a4be7e48 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: 20211107 +;; Version: 20220224 ;; Keywords: e-scripts ;; ;; Supersedes: (find-eev "eev-all.el") @@ -141,6 +141,7 @@ (require 'eev-env) ; (find-eev "eev-env.el") (require 'eev-edit) ; (find-eev "eev-edit.el") (require 'eev-testblocks) ; (find-eev "eev-testblocks.el") +(require 'eev-kla) ; (find-eev "eev-kla.el") ;; ;; Hyperlinks to audio, video, and IRC: ;; (find-video-links-intro) diff --git a/eev.el b/eev.el index b83c3f95c8..86e363129c 100644 --- a/eev.el +++ b/eev.el @@ -6,7 +6,7 @@ ;; Package-Requires: ((emacs "24.4")) ;; Keywords: lisp e-scripts ;; URL: http://angg.twu.net/#eev -;; Version: 20220218 +;; Version: 20220224 ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by