Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
####### # # E-scripts on porting stuff to the Mac OS X. # # Note 1: use the eev command (defined in eev.el) and the # ee alias (in my .zshrc) to execute parts of this file. # Executing this file as a whole makes no sense. # An introduction to eev can be found here: # # (find-eev-quick-intro) # http://angg.twu.net/eev-intros/find-eev-quick-intro.html # # Note 2: be VERY careful and make sure you understand what # you're doing. # # Note 3: If you use a shell other than zsh things like |& # and the for loops may not work. # # Note 4: I always run as root. # # Note 5: some parts are too old and don't work anymore. Some # never worked. # # Note 6: the definitions for the find-xxxfile commands are on my # .emacs. # # Note 7: if you see a strange command check my .zshrc -- it may # be defined there as a function or an alias. # # Note 8: the sections without dates are always older than the # sections with dates. # # This file is at <http://angg.twu.net/e/osx.e> # or at <http://angg.twu.net/e/osx.e.html>. # See also <http://angg.twu.net/emacs.html>, # <http://angg.twu.net/.emacs[.html]>, # <http://angg.twu.net/.zshrc[.html]>, # <http://angg.twu.net/escripts.html>, # and <http://angg.twu.net/>. # ####### # «.find-pdf-page» (to "find-pdf-page") # «.find-pdf-text» (to "find-pdf-text") # «.vlc-as-mpv» (to "vlc-as-mpv") # «.lua51manual» (to "lua51manual") https://www.reddit.com/r/emacs/comments/lijn31/best_emacs_port_for_mac_early_2021_edition/ https://www.emacswiki.org/emacs/EmacsForMacOS http://emacsformacosx.com http://www.mplayer2.org/downloads/ https://code.google.com/p/mplayerosx-builds/ https://github.com/pigoz/mplayerosx-builds https://en.wikipedia.org/wiki/MacOS https://discussions.apple.com/thread/8235766 AppleScript, Preview, and PDF Page access https://discussions.apple.com/thread/8235766?answerId=8235766021#8235766021 https://en.wikipedia.org/wiki/Homebrew_(package_management_software) https://en.wikipedia.org/wiki/MacPorts # (find-status "poppler-utils") # (find-vldifile "poppler-utils.list") # (find-vldifile "poppler-utils.list" "/usr/bin/pdftotext") # (find-udfile "poppler-utils/") ##### # # find-pdf-page # 2019oct01 / 2021jan21 # ##### # «find-pdf-page» (to ".find-pdf-page") ;; These are the obvious (?) ways to define `ee-find-opera-page' and ;; `ee-find-firefox-page'... ;; (defun ee-find-opera-page (fname &optional page) `("opera" ,(ee-fname-page-to-url fname page))) (defun ee-find-firefox-page (fname &optional page) `("firefox" ,(ee-fname-page-to-url fname page))) ;; Define `find-opera-page' and friends: ;; (find-code-pdfbackend "opera-page") (code-pdfbackend "opera-page") ;; Define `find-firefox-page' and friends: ;; (find-code-pdfbackend "firefox-page") (code-pdfbackend "firefox-page") ;; My default for `find-pdf-page' on GNU/Linux: ;; (find-code-pdfbackendalias "pdf-page" "xpdf-page") (code-pdfbackendalias "pdf-page" "xpdf-page") ;; Override it with Opera: ;; (find-code-pdfbackendalias "pdf-page" "opera-page") (code-pdfbackendalias "pdf-page" "opera-page") ;; Override it with Firefox: ;; (find-code-pdfbackendalias "pdf-page" "firefox-page") (code-pdfbackendalias "pdf-page" "firefox-page") ;; Override it with pdftools: ;; (find-code-pdfbackendalias "pdf-page" "pdftools-page") (code-pdfbackendalias "pdf-page" "pdftools-page") ;; Download ~/Coetzee99.pdf for tests: ;; (find-pdf-like-intro "2. Preparation") ;; Low-level tests: ;; (ee-fname-page-to-url "~/Coetzee99.pdf" 3) ;; `("opera" ,(ee-fname-page-to-url "~/Coetzee99.pdf" 3)) ;; (find-bgprocess `("opera" ,(ee-fname-page-to-url "~/Coetzee99.pdf" 3))) ;; (find-bgprocess `("firefox" ,(ee-fname-page-to-url "~/Coetzee99.pdf" 3))) ;; (find-bgprocess `("open" ,(ee-fname-page-to-url "~/Coetzee99.pdf" 3))) ;; ;; A high-level test: ;; (find-pdf-page "~/Coetzee99.pdf" 3) * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) # Marc's wrapper script: # (find-fline "~/bin/firefox") cat > ~/bin/firefox <<'%%%' #!/bin/sh /Applications/Firefox.app/Contents/MacOS/firefox "$@" %%% chmod 755 ~/bin/firefox ##### # # find-pdf-text # 2021jan22 # ##### # «find-pdf-text» (to ".find-pdf-text") ##### # # Use vlc instead of mpv # 2021jan22 # ##### # «vlc-as-mpv» (to ".vlc-as-mpv") # (find-eev "eev-audiovideo.el" "find-vlc-video") ;; Hack: make find-mpv-video use vlc. ;; See: (find-audiovideo-intro "4.3. A demo") ;; This is a copy of the standard `ee-find-mpv-video', from: ;; (find-efunction 'ee-find-mpv-video) ;; (defun ee-find-mpv-video (fname &optional pos &rest rest) `("mpv" ,fname ,@(if pos (list (format "--start=%s" (ee-secs-to-mm:ss pos)))) ,@ee-mpv-video-options )) ;; This is a quick-hack-ish modified version that uses vlc instead of ;; mpv, _without changing the name of the function_... ;; (defun ee-find-mpv-video (fname &optional pos &rest rest) `("vlc" ,@(if pos (list "--start-time" (format "%s" (ee-time-to-seconds pos)))) ,fname ;; ,@ee-mpv-video-options )) ;; Tests: ;; (find-bgprocess "vlc ~/eev-videos/Punch_and_Judy_Mark_Poulton-K6LmZ0A1s9U.mp4") ;; (find-bgprocess "vlc --start-time 1:33 ~/eev-videos/Punch_and_Judy_Mark_Poulton-K6LmZ0A1s9U.mp4") ;; (find-bgprocess "vlc --start-time 93 ~/eev-videos/Punch_and_Judy_Mark_Poulton-K6LmZ0A1s9U.mp4") ;; (ee-find-mpv-video "~/eev-videos/Punch_and_Judy_Mark_Poulton-K6LmZ0A1s9U.mp4" "1:33") ;; (find-mpv-video "~/eev-videos/Punch_and_Judy_Mark_Poulton-K6LmZ0A1s9U.mp4" "1:33") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) # Marc's wrapper script: # (find-fline "~/bin/vlc") cat ~/bin/vlc <<'%%%' #!/bin/sh /Applications/VLC.app/Contents/MacOS/VLC "$@" %%% chmod 755 ~/bin/vlc ##### # # lua51manual # 2021jan22 # ##### # «lua51manual» (to ".lua51manual") ;; Test: (find-lua51manual "#6" "LUA_INIT" "@filename") (defun find-lua51manual (&optional anchor &rest rest) (interactive) (brff (format "file:///opt/local/share/doc/lua51/manual.html%s" (or anchor "")))) [parsnip pulls #emacs aside and explains in excruciating detail that the name is macOS, and hasn't been OS X since 2016, and wasn't Mac OS X since 2011] # Local Variables: # coding: utf-8-unix # End: