branch: externals/eev commit 5befc963101b71e8114b132cd6b42c2583221534 Author: Eduardo Ochs <eduardoo...@gmail.com> Commit: Eduardo Ochs <eduardoo...@gmail.com>
Added `ee-0x0-upload-region' (a.k.a. `u0'). --- ChangeLog | 7 +++++++ VERSION | 4 ++-- eev-env.el | 37 +++++++++++++++++++-------------- eev-tlinks.el | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 97 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index f4f8dcc..2687a70 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2021-08-10 Eduardo Ochs <eduardoo...@gmail.com> + + * eev-tlinks.el (ee-0x0-url): new variable. + (ee-0x0-upload-region, find-0x0-links): new functions. + + * eev-env.el: added a "(require 'eepitch)". + 2021-08-08 Eduardo Ochs <eduardoo...@gmail.com> * eepitch.el (find-vtermprocess): new function. diff --git a/VERSION b/VERSION index 4c5141a..4cd5ae8 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -Sun Aug 8 06:08:09 GMT 2021 -Sun Aug 8 03:08:09 -03 2021 +Wed Aug 11 01:45:06 GMT 2021 +Tue Aug 10 22:45:06 -03 2021 diff --git a/eev-env.el b/eev-env.el index a406847..3a9e0b5 100644 --- a/eev-env.el +++ b/eev-env.el @@ -1,6 +1,6 @@ ;;; eev-env.el -- set some environment variables. -;; Copyright (C) 2012-2019 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: 20190302 +;; Version: 20210810 ;; Keywords: e-scripts ;; ;; Latest version: <http://angg.twu.net/eev-current/eev-env.el> @@ -34,12 +34,11 @@ ;;; Commentary: -;; Used by: (find-eev "eev-prepared.el") -;; -;; Related but obsolete files: -;; <http://angg.twu.net/eev-current/README.html> -;; <http://angg.twu.net/eev-current/eev-langs.el.html> -;; <http://angg.twu.net/eev-current/eev-rctool.html> +;; This file defines the environment variable $S +;; and a few other things. + +;; For: (find-eev "eepitch.el" "ee-expand") +(require 'eepitch) @@ -53,19 +52,25 @@ ;;; Set some environment variables (for ee-expand, getenv, ;;; shell buffers, xterms started from Emacs, etc). -;; (find-eevrcfile ".bashrc") -;; (find-eevrcfile ".zshrc") - -;; Note: `ee-setenv' and its calls for "S" and "EEVDIR" were moved to: -;; (find-eev "eev.el" "ee-setenv") -;; (defun ee-setenv (envvar value) "In case the environment variable ENVVAR was not set set it to VALUE." (if (null (getenv envvar)) (setenv envvar (ee-expand value)))) -(ee-setenv "S" "~/snarf") ; for `find-psne-links' + +;; The variable $S is used by: +;; (find-psne-intro "4. The environment variable $S") +;; +(ee-setenv "S" "~/snarf") + + +;; Used by some deprecated features... compare with: +;; (find-eev "eev-code.el" "code-c-d-s") +;; (find-eev "eev-code.el" "code-c-d-s" "ee-eev-source-directory") +;; These deprecated features are (very badly) explained here: +;; (find-eev-intro "that require extra setup:") +;; (ee-setenv "EEVDIR" (let ((fname (locate-library "eev"))) (if fname (directory-file-name (file-name-directory fname)) @@ -80,7 +85,7 @@ ;;; | __/ __/_____\ V V /| | |_| | | |_____| __/ | | \ V / ;;; \___|\___| \_/\_/ |_|\__|_| |_| \___|_| |_|\_/ ;;; -;; `ee-with-env' run a sexp in a modified environment. +;; `ee-with-env' runs a sexp in a modified environment. ;; Tests: ;; ;; (ee-with-env '(("FOO" "~/foo") ("FOOL" "oo")) '(find-sh0 "set | grep -a FOO")) diff --git a/eev-tlinks.el b/eev-tlinks.el index 867726d..f18c02d 100644 --- a/eev-tlinks.el +++ b/eev-tlinks.el @@ -90,6 +90,8 @@ ;; «.find-eeit-links» (to "find-eeit-links") ;; «.find-texlive-links» (to "find-texlive-links") ;; «.find-newbrowser-links» (to "find-newbrowser-links") +;; «.ee-0x0-upload-region» (to "ee-0x0-upload-region") +;; «.find-0x0-links» (to "find-0x0-links") (require 'eev-env) @@ -2306,6 +2308,71 @@ sudo ./install-tl -select-repository +;;; ___ ___ +;;; / _ \__ __/ _ \ +;;; | | | \ \/ / | | | +;;; | |_| |> <| |_| | +;;; \___//_/\_\\___/ +;;; +;; «ee-0x0-upload-region» (to ".ee-0x0-upload-region") +;; Needs: https://melpa.org/#/0x0 +;; See: https://lists.gnu.org/archive/html/eev/2021-08/msg00000.html +;; +(defvar ee-0x0-url nil + "The last URL generated by a call to `ee-0x0-upload-region'.") + +(defun ee-0x0-upload-region (b e) + "Upload the current region to 0x0 and show some elisp hyperlinks. +I use this mainly on IRC chats, to send elisp snippets to people +who use eev. I use this function aliased to `u0', with: + + (defalias 'u0 'ee-0x0-upload-region) + +If I mark the region with the snippet and run `M-x u0', `u0' +uploads the snippet to https://0x0.st/ and shows some sexps in a +temporary buffer; the two main sexps in that temporary buffer +there will be things like: + + (find-wget \"https://0x0.st/-J1W.el\") + (find-wget-elisp \"https://0x0.st/-J1W.el\") + +The one that starts with `find-wget-elisp' downloads the URL with +wget and runs `emacs-lisp-mode' on the resulting \"*wget: URL*\" +buffer. If the other person on IRC is using some IRC client that +runs in Emacs I can send the find-wget-elisp sexp to her and she +only needs to type `M-e' on it to access the elisp code that I +sent." + (interactive "r") + (0x0-upload b e '0x0) + (setq ee-0x0-url (ee-last-kill)) + (find-0x0-links)) + + +;; «find-0x0-links» (to ".find-0x0-links") +;; Skel: (find-find-links-links-new "0x0" "url" "") +;; +(defun find-0x0-links (&optional url &rest pos-spec-list) +"Visit a temporary buffer containing hyperlinks to an upload to 0x0.st. +This function is used by `ee-0x0-upload-region'." + (interactive) + (setq url (or url ee-0x0-url)) + (apply + 'find-elinks + `((find-0x0-links ,url ,@pos-spec-list) + (find-0x0-links "{url}" ,@pos-spec-list) + ;; Convention: the first sexp always regenerates the buffer. + (find-efunction 'find-0x0-links) + "" + ,(ee-template0 "\ +(find-wget \"{url}\") +(find-wget-elisp \"{url}\") +") + ) + pos-spec-list)) + + + + (provide 'eev-tlinks)