branch: externals/eev commit fd191a9d39007dada3ec137d40e385f11116ccc6 Author: Eduardo Ochs <eduardoo...@gmail.com> Commit: Eduardo Ochs <eduardoo...@gmail.com>
Rewrote eev-on-windows.el. --- ChangeLog | 20 +++++ VERSION | 4 +- eev-audiovideo.el | 6 +- eev-brxxx.el | 9 ++- eev-hlinks.el | 10 ++- eev-on-windows.el | 227 +++++++++++++++++++++++++++++++++++++++++++++++------- eev-plinks.el | 8 +- eev.el | 2 +- 8 files changed, 247 insertions(+), 39 deletions(-) diff --git a/ChangeLog b/ChangeLog index b65735d..906d50a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2021-10-08 Eduardo Ochs <eduardoo...@gmail.com> + + * eev-on-windows.el (ee-download-with-eww, ee-use-eshell) + (ee-use-shell, ee-use-bullets, ee-use-red-stars) + (ee-use-gnu-linux, ee-use-windows): new functions. + + * eev-audiovideo.el (ee-mpv-program): new variable. + (ee-find-mpv-video): use `ee-mpv-program'. + + * eev-brxxx.el (ee-googlechrome-program): new variable. + (ee-firefox-program): new variable. + (find-googlechrome): use `ee-googlechrome-program'. + (find-firefox): use `ee-firefox-program'. + + * eev-plinks.el (ee-wget-program): new variable. + (find-wget00): use `ee-wget-program'. + + * eev-hlinks.el (ee-find-evardescr-links): added `find-evariable'. + (ee-find-efunctiondescr-links): added `find-efunction'. + 2021-10-07 Eduardo Ochs <eduardoo...@gmail.com> * eev-blinks.el (find-eek): new function. diff --git a/VERSION b/VERSION index 0709286..02c9620 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -Thu Oct 7 10:33:36 GMT 2021 -Thu Oct 7 07:33:36 -03 2021 +Sat Oct 9 00:20:12 GMT 2021 +Fri Oct 8 21:20:12 -03 2021 diff --git a/eev-audiovideo.el b/eev-audiovideo.el index 26504b7..d42e3df 100644 --- a/eev-audiovideo.el +++ b/eev-audiovideo.el @@ -19,7 +19,7 @@ ;; ;; Author: Eduardo Ochs <eduardoo...@gmail.com> ;; Maintainer: Eduardo Ochs <eduardoo...@gmail.com> -;; Version: 20210925 +;; Version: 20211008 ;; Keywords: e-scripts ;; ;; Latest version: <http://angg.twu.net/eev-current/eev-audiovideo.el> @@ -455,13 +455,15 @@ See: (find-audiovideo-intro \"`eev-avadj-mode'\")" ;; ;; «find-mpv-video» (to ".find-mpv-video") ;; +(defvar ee-mpv-program "mpv") + (defun find-mpv-video (fname &optional pos &rest rest) "Open FNAME with mpv, with a GUI (in fullscreen mode, for video files)." (interactive "sFile name: ") (find-bgprocess (ee-find-mpv-video fname pos))) (defvar ee-mpv-video-options '("--fs" "--osd-level=2")) (defun ee-find-mpv-video (fname &optional pos &rest rest) - `("mpv" + `(,ee-mpv-program ,fname ,@(if pos (list (format "--start=%s" (ee-secs-to-mm:ss pos)))) ,@ee-mpv-video-options diff --git a/eev-brxxx.el b/eev-brxxx.el index 4bf931b..4484be4 100644 --- a/eev-brxxx.el +++ b/eev-brxxx.el @@ -19,7 +19,7 @@ ;; ;; Author: Eduardo Ochs <eduardoo...@gmail.com> ;; Maintainer: Eduardo Ochs <eduardoo...@gmail.com> -;; Version: 20210208 +;; Version: 20211008 ;; Keywords: e-scripts ;; ;; Latest version: <http://angg.twu.net/eev-current/eev-brxxx.el> @@ -366,8 +366,11 @@ This should be made smarter - file:// urls should be returned unchanged." ;; (find-eev "eev-blinks.el" "find-w3m") ;; (find-efile "net/browse-url.el") -(defun find-googlechrome (url) (find-bgprocess `("google-chrome" ,url))) -(defun find-firefox (url) (find-bgprocess `("firefox" ,url))) +(defvar ee-googlechrome-program "google-chrome") +(defvar ee-firefox-program "firefox") + +(defun find-googlechrome (url) (find-bgprocess `(,ee-googlechrome-program ,url))) +(defun find-firefox (url) (find-bgprocess `(,ee-firefox-program ,url))) ;; (find-code-brurl 'find-psne-links :remote 'brep) (code-brurl 'find-psne-links :remote 'brep) diff --git a/eev-hlinks.el b/eev-hlinks.el index 916b3c2..2183ca1 100644 --- a/eev-hlinks.el +++ b/eev-hlinks.el @@ -1,6 +1,6 @@ ;;; eev-hlinks.el --- `find-here-links' and variants. -*- lexical-binding: nil; -*- -;; Copyright (C) 2020 Free Software Foundation, Inc. +;; Copyright (C) 2020-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: 20201231 +;; Version: 20211008 ;; Keywords: e-scripts ;; ;; Latest version: <http://angg.twu.net/eev-current/eev-hlinks.el> @@ -253,14 +253,16 @@ (defun ee-find-efunctiondescr-links () (let ((f (ee-efunctiondescr-bufferp))) `((find-efunction-links ',f) - (find-efunctiondescr ',f)))) + (find-efunctiondescr ',f) + (find-efunction ',f)))) (defvar ee-evardescr-re "^\\([^ \t\n]+\\) is a variable") (defun ee-evardescr-bufferp () (ee-buffer-help ee-evardescr-re 1)) (defun ee-find-evardescr-links () (let ((v (ee-evardescr-bufferp))) `((find-evariable-links ',v) - (find-evardescr ',v)))) + (find-evardescr ',v) + (find-evariable ',v)))) (defvar ee-efacedescr-re "^Face: \\([^ \t\n]+\\)") (defun ee-efacedescr-bufferp () (ee-buffer-help ee-efacedescr-re 1)) diff --git a/eev-on-windows.el b/eev-on-windows.el index 29496e2..8fd3efa 100644 --- a/eev-on-windows.el +++ b/eev-on-windows.el @@ -1,6 +1,6 @@ ;; eev-on-windows.el - some support for M$ Windows. -*- lexical-binding: nil; -*- -;; Copyright (C) 2019 Free Software Foundation, Inc. +;; Copyright (C) 2019,2021 Free Software Foundation, Inc. ;; ;; This file is part of GNU eev. ;; @@ -30,30 +30,196 @@ ;;; Commentary: ;; -;; Experimental, undocumented, and messy. This was used in a course on -;; LaTeX and Emacs in which the students were trying to run everything -;; on Windows and I was trying to help them even though I know next to -;; nothing about Windows. +;; Experimental, undocumented, and messy. Every time that I give a +;; workshop to Windows users this file changes a lot. The most recent +;; changes in this file correspond to a workshop that I will give in +;; mid-october 2021, and that I described in this thread: +;; +;; https://lists.gnu.org/archive/html/help-gnu-emacs/2021-10/msg00037.html +;; +;; I can't test the settings for Windows myself - a friend of mine +;; called Daniel Almeida is helping me to test this me before the +;; workshop. +;; +;; This file is not loaded by default. See: +;; (find-eev "eev-load.el") +;; +;; At this moment what the Windows users need to do is: +;; (require 'eev-on-windows) +;; (mkdir "~/bin/" t) +;; (delete-file "~/bin/wget.exe") +;; (ee-download-with-eww "http://angg.twu.net/2021-oficina/wget.exe" "~/bin/") +;; (ee-use-windows) +;; and they need to run the test in: +;; (to "directories") -;; «.eev-tar» (to "eev-tar") -;; «.ee-add-to-PATH» (to "ee-add-to-PATH") -;; (find-eev "eev-plinks.el" "find-urlretrieve") -;; (find-es "emacs" "package-untar") -;; (find-es "emacs" "load-path") -;; (find-angg ".emacs.local.w32") -;; (find-angg ".emacs.local.w32" "PATH") +;; 2021: +;; «.ee-download-with-eww» (to "ee-download-with-eww") +;; «.ee-use-eshell» (to "ee-use-eshell") +;; «.ee-use-bullets» (to "ee-use-bullets") +;; «.ee-use-gnu-linux» (to "ee-use-gnu-linux") +;; «.ee-use-windows» (to "ee-use-windows") +;; «.directories» (to "directories") +;; +;; 2019: +;; «.eev-tar» (to "eev-tar") +;; «.ee-add-to-PATH» (to "ee-add-to-PATH") + + + +;;; ____ ___ ____ _ +;;; |___ \ / _ \___ \/ | +;;; __) | | | |__) | | +;;; / __/| |_| / __/| | +;;; |_____|\___/_____|_| +;;; + +(require 'eww) +(require 'eshell) +(require 'em-alias) + + +;; «ee-download-with-eww» (to ".ee-download-with-eww") +;; Test: +;; (mkdir "~/bin/" t) +;; (delete-file "~/bin/wget.exe") +;; (ee-download-with-eww "http://angg.twu.net/2021-oficina/wget.exe" "~/bin/") +;; +(defun ee-download-with-eww (url dir) + (url-retrieve url #'eww-download-callback (list url dir))) + + +;; «ee-use-eshell» (to ".ee-use-eshell") +;; TODO: define an `eepitch-eshell2'. +;; +(defun ee-use-eshell () + (interactive) + (defun eepitch-shell () (interactive) (eepitch-eshell)) + (defun eepitch-shell2 () (interactive) (eepitch-eshell)) + ) + +(defun ee-use-shell () + (interactive) + (defun eepitch-shell () (interactive) (eepitch '(shell "*shell*"))) + (defun eepitch-shell2 () (interactive) (eepitch '(shell "*shell 2*"))) + ) + + +;; «ee-use-bullets» (to ".ee-use-bullets") +;; From: (find-eepitch-bullet-links 2 "red bullets by default") +;; +(defun ee-use-bullets () + (interactive) + (eepitch-set-glyph0 ?\u2022 ?\u2022 'eepitch-star-face) + (defun eewrap-eepitch () (interactive) + (let* ((fmt "\u2022 (eepitch-%s)\n\u2022 (eepitch-kill)\n\u2022 (eepitch-%s)") + (li (ee-this-line-extract)) + (newli (format fmt li li))) + (insert newli)) + (ee-next-line 1)) + ) + +(defun ee-use-red-stars () + (interactive) + (defun eewrap-eepitch () (interactive) + (let* ((fmt " (eepitch-%s)\n (eepitch-kill)\n (eepitch-%s)") + (li (ee-this-line-extract)) + (newli (format fmt li li))) + (insert newli)) + (ee-next-line 1)) + ) + + +;; «ee-use-gnu-linux» (to ".ee-use-gnu-linux") +;; «ee-use-windows» (to ".ee-use-windows") +;; +(defun ee-use-gnu-linux () + (interactive) + (ee-use-shell) + (eshell/alias "wget" nil) + (setq ee-wget-program "wget") + (setq ee-firefox-program "firefox") + (setq ee-googlechrome-program "google-chrome") + (setq ee-mpv-program "mpv") + ) + +(defun ee-use-windows () + (interactive) + (ee-use-shell) + (eshell/alias "wget" "~/bin/wget.exe $*") + (setq ee-wget-program "~/bin/wget.exe") + (setq ee-firefox-program "$FIREFOXDIR/firefox.exe") + (setq ee-googlechrome-program "$GOOGLECHROMEDIR/chrome.exe") + (setq ee-mpv-program "$MPVDIR/mpv.exe") + (defalias 'find-pdf-page 'find-googlechrome-page) + ) + + +;; «directories» (to ".directories") +;; These directories are for Daniel Almeida's machine. +;; Most people will have to configure this. +;; +(setenv "FIREFOXDIR" "c:/Program Files/Mozilla Firefox") +(setenv "GOOGLECHROMEDIR" "c:/Program Files/Google/Chrome/Application") +(setenv "MPVDIR" "c:/Users/danie/OneDrive/Documentos/mpv") + +;; Basic tests: +;; (find-fline "~/bin/" "wget.exe") +;; (find-fline "$GOOGLECHROMEDIR/" "chrome.exe") +;; (find-fline "$FIREFOXDIR/" "firefox.exe") +;; (find-fline "$MPVDIR/" "mpv.exe") +;; (find-callprocess `("~/bin/wget.exe" "--help")) +;; (find-callprocess `("$GOOGLECHROMEDIR/chrome.exe" "--help")) +;; (find-callprocess `("$FIREFOXDIR/firefox.exe" "--help")) +;; (find-callprocess `("$MPVDIR/mpv.exe" "--help")) +;; (find-callprocess `(,ee-wget-program "--help")) +;; (find-callprocess `(,ee-googlechrome-program "--help")) +;; (find-callprocess `(,ee-firefox-program "--help")) +;; (find-callprocess `(,ee-mpv-program "--help")) +;; (find-wget "http://angg.twu.net/eev-current/eev-on-windows.el") +;; +;; For the tests for using browsers as PDF viewers you will need to +;; understand these sections of the tutorials, and will need to run +;; some of the commands in them: +;; (find-psne-intro "1. Local copies of files from the internet") +;; (find-psne-intro "3. The new way: `M-x brep'") +;; (find-pdf-like-intro "2. Preparation") +;; (find-pdf-like-intro "2. Preparation" "Coetzee99") +;; +;; Then try: +;; (find-googlechrome-page "~/Coetzee99.pdf" 3) +;; (find-firefox-page "~/Coetzee99.pdf" 3) +;; (find-pdf-page "~/Coetzee99.pdf" 3) +;; +;; The video links are explained here: +;; (find-videos-intro "2. Short links to eev video tutorials") +;; http://angg.twu.net/2021-video-links.html +;; +;; Test for the video links: +;; (delete-file (ee-expand "$S/http/angg.twu.net/eev-videos/2021-test-blocks.mp4")) +;; (brep "http://angg.twu.net/eev-videos/2021-test-blocks.mp4") +;; (find-eevvideo-links "testbls" "2021-test-blocks" "fpsF_M55W4o") +;; (find-video "$S/http/angg.twu.net/eev-videos/2021-test-blocks.mp4") +;; (find-video "$S/http/angg.twu.net/eev-videos/2021-test-blocks.mp4" "2:33") -;; «eev-tar» (to ".eev-tar") -;; This was a way to to download a very recent version of eev using -;; only Lisp. I used it a bit with the students, but then eev became a -;; part of ELPA and this became obsolete... and now I don't even -;; remember how reliable this code was. + + +;;; ____ ___ _ ___ +;;; |___ \ / _ \/ |/ _ \ +;;; __) | | | | | (_) | +;;; / __/| |_| | |\__, | +;;; |_____|\___/|_| /_/ +;;; +;; +;; «eev-tar» (to ".eev-tar") +;; This is from 2019 and is now very obsolete - +;; partially because eev is in ELPA. ;; ;; (setq eev-tar-dir "~/eev-tar/") ;; (setq eev-tar-fname "~/eev-tar/eev2.tar") @@ -68,7 +234,6 @@ ;; (eek "C-x o C-x 4 0") ;; (find-2a nil '(find-fline eev-tar-dir nil '(eek "g"))) ;; - ;; Add something like this to your .emacs: ;; ;; (add-to-list 'load-path "~/eev-tar/") @@ -79,12 +244,27 @@ ;; (find-estring (mapconcat 'identity load-path "\n")) ;; (locate-library "eejump") ;; (find-estring (list-load-path-shadows t)) - - +;; +;; See: +;; (find-eev "eev-plinks.el" "find-urlretrieve") +;; (find-es "emacs" "package-untar") +;; (find-es "emacs" "load-path") +;; (find-angg ".emacs.local.w32") +;; (find-angg ".emacs.local.w32" "PATH") ;; «ee-add-to-PATH» (to ".ee-add-to-PATH") - +;; The last time that I used these commands to change the Windows PATH +;; was in 2019. In this message Eli Zaretskii recommended not changing +;; the PATH, and he was totally right: +;; https://lists.gnu.org/archive/html/help-gnu-emacs/2021-10/msg00052.html +;; +;; OLD TODO: Rewrite some of this using: +;; (find-efunctiondescr 'parse-colon-path) +;; (find-efunction 'parse-colon-path) +;; (find-elnode "System Environment" "Variable: path-separator") +;; (find-elnode "System Environment" "Function: parse-colon-path path") +;; ;; (setq mylist '(22 33 44)) ;; (add-to-list 'mylist 44) ;; @@ -116,11 +296,6 @@ -;; TODO: Rewrite some of this using: -;; (find-efunctiondescr 'parse-colon-path) -;; (find-efunction 'parse-colon-path) -;; (find-elnode "System Environment" "Variable: path-separator") -;; (find-elnode "System Environment" "Function: parse-colon-path path") diff --git a/eev-plinks.el b/eev-plinks.el index def765e..799fbb9 100644 --- a/eev-plinks.el +++ b/eev-plinks.el @@ -288,6 +288,10 @@ If it is something else, throw an error." (url-retrieve-synchronously url 'silent 'inhibit-cookies) "\n\n")) +;; 2021oct08: The functions below are broken - they corrupt non-ascii files. +;; See: https://lists.gnu.org/archive/html/help-gnu-emacs/2021-10/msg00174.html +;; TODO: fix them. + (defun ee-urlretrieve0 (url) "Use `url-retrieve-synchronously' to download URL. When `url-retrieve-synchronously' is used for http or https it @@ -353,8 +357,10 @@ headers in case of error. This is a quick hack." ;; ;; «find-wget» (to ".find-wget") ;; +(defvar ee-wget-program "wget") + (defun find-wget00 (url) - (find-callprocess00 `("wget" "-q" "-O" "-" ,url))) + (find-callprocess00 `(,ee-wget-program "-q" "-O" "-" ,url))) (defun find-wget (url &rest pos-spec-list) "Download URL with \"wget -q -O - URL\" and display the output. diff --git a/eev.el b/eev.el index de2c089..314e390 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: 20211007 +;; Version: 20211008 ;; 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