help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Workshop to save M$ Windows users - help needed


From: Eduardo Ochs
Subject: Re: Workshop to save M$ Windows users - help needed
Date: Sun, 3 Oct 2021 16:15:11 -0300

On Sun, 3 Oct 2021 at 07:41, Eli Zaretskii <eliz@gnu.org> wrote:
>
> Do you really need that?  The Windows Explorer can unzip files just
> fine, and a browser or Emacs itself can be used to fetch files.


Hi Eli,

Let me start by showing some kinds of useful one-liners.


  1. (find-eev-quick-intro "2. Evaluating Lisp" "M-0 M-e")
     (find-eev-quick-intro "3.1. Non-elisp hyperlinks" "M-x brff")
     (find-emacs-keys-intro "5. Undoing")

     The first sexp above opens the sandboxed tutorial called
     `find-eev-quick-intro', searches for the first occurrence of the
     string "2. Evaluating Lisp" in it, and then searches for the
     first occurrence of the string "M-0 M-e" after that.



  2. (find-firefox-page "http://foo/bar/Coetzee99.pdf"; 4)
     (find-firefox-page              "~/Coetzee99.pdf" 4)

     The two sexps above use Firefox as a PDF viewer to open a remote
     PDF and a local PDF on page 4. In low-level terms what they do is:

     (find-bgprocess '("firefox"    "http://foo/bar/Coetzee99.pdf#page=4";))
     (find-bgprocess '("firefox" "file:///home/edrx/Coetzee99.pdf#page=4"))



  3. (find-testblsvideo "2:33" "f8 here starts a new Lua interpreter")

     This sexp plays the video about test blocks starting from 2:33.
     Let me pretend here that I would have time enough in the workshop
     to show that it has two "natural" definitions. Its first natural
     definition would use the copy of that video at youtube, and would
     use Firefox to open this URL:

        http://www.youtube.com/watch?v=fpsF_M55W4o#t=2m33s

     Its second natural definition supposes that we have downloaded
     the .mp4 file of that video, that is here,

        http://angg.twu.net/eev-videos/2021-test-blocks.mp4

     to some hardcoded location, like:

        /tmp/foo/bar/2021-test-blocks.mp4

     and it supposes that everyone in the workshop has the mpv video
     player installed. In low-level terms, what this second definition
     runs is:

       (find-bgprocess '("mpv" "/tmp/foo/bar/2021-test-blocks.mp4"
                         "--start=2:33" "--fs" "--osd-level=2"))



  4. (find-pdf-text "~/Coetzee99.pdf" (+ -110 127) "wrong thoughts")

     This is a variant of the sexps in item 2. It is not trivial to
     make `find-pdf-text' work on Windows, but that function is a
     fixture of my workshops on LaTeX. Let me pretend that I would be
     able to present it, just because it is a very nifty function and
     it will be good karma to give that function a bit more of
     visibility.

     That sexp converts the file ~/Coetzee99.pdf to text by running:

       pdftotext -layout -enc Latin1 /home/edrx/Coetzee99.pdf -

     then puts the output in a temporary buffer, finds the page 17,
     i.e., (+ -110 127), in it by counting formfeeds, and searches for
     the first occurrence of the string "wrong thoughts" in that
     buffer starting from the beginning of page 17.



So, consider again these sexps:

  (find-eev-quick-intro "2. Evaluating Lisp" "M-0 M-e")
  (find-eev-quick-intro "3.1. Non-elisp hyperlinks" "M-x brff")
  (find-emacs-keys-intro "5. Undoing")
  (find-firefox-page "http://foo/bar/Coetzee99.pdf"; 4)
  (find-firefox-page              "~/Coetzee99.pdf" 4)
  (find-testblsvideo "2:33" "f8 here starts a new Lua interpreter")
  (find-pdf-text "~/Coetzee99.pdf" (+ -110 127) "wrong thoughts")

all of them are easy to understand, easy to use - if you have the
right files and if you know how to use `M-e', that is roughly
equivalent to `C-e C-x C-e' -, easy to modify in useful ways (by
changing their arguments), easy to save in your notes with cut and
paste, and easy to share by chat.

Two of these sexps need files in hardcoded places - I used
~/Coetzee99.pdf and /tmp/foo/bar/2021-test-blocks.mp4 in the examples
above, but many functions in eev use a convention, explained here,

  http://angg.twu.net/eev-intros/find-psne-intro.html

in which the name of the local copy is derived from the URL like this,

      http://www.gnu.org/software/emacs/emacs-paper.html
  -> $S/http/www.gnu.org/software/emacs/emacs-paper.html

and the environment variable S is $HOME/snarf. Also, if we put the
point on the url below

      http://www.gnu.org/software/emacs/emacs-paper.html

and type M-x brep we get a temporary buffer containing something like
this,


• (eepitch-shell)
• (eepitch-kill)
• (eepitch-shell)
  mkdir -p $S/http/www.gnu.org/software/emacs/
  cd       $S/http/www.gnu.org/software/emacs/
  wget -nc 'http://www.gnu.org/software/emacs/emacs-paper.html'


So several things in the workshop will be much easier if everybody has
wget in the path. An un(tg)zipper is not very important - I only
realized this after my previous e-mail - but wget is.

  [[]],
    Eduardo Ochs
    http://angg.twu.net/#eev



reply via email to

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