Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
####### # # E-scripts on porting stuff to the MacOS (formerly OSX and MacOSX) # # 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://anggtwu.net/e/osx.e> # or at <http://anggtwu.net/e/osx.e.html>. # See also <http://anggtwu.net/emacs.html>, # <http://anggtwu.net/.emacs[.html]>, # <http://anggtwu.net/.zshrc[.html]>, # <http://anggtwu.net/escripts.html>, # and <http://anggtwu.net/>. # ####### # «.name» (to "name") # «.find-pdf-page» (to "find-pdf-page") # «.firefox-wrapper» (to "firefox-wrapper") # «.find-pdf-text» (to "find-pdf-text") # «.vlc-as-mpv» (to "vlc-as-mpv") # «.vlc-wrapper» (to "vlc-wrapper") # «.lua51manual» (to "lua51manual") # «.Vivaldi-a» (to "Vivaldi-a") # «.Halian» (to "Halian") # «.Halian-dot-emacs» (to "Halian-dot-emacs") # «.emacs-plus» (to "emacs-plus") 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/") ##### # # name # 2023dec19 # ##### # «name» (to ".name") [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] ##### # # 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) ##### # # firefox-wrapper # 2024feb05 # ##### # «firefox-wrapper» (to ".firefox-wrapper") * (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") ##### # # vlc-wrapper # 2024feb05 # ##### # «vlc-wrapper» (to ".vlc-wrapper") * (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") # (find-telegachat "1487862914#223264" "port contents all | grep lua | grep /manual.html") # (find-telegachatm "1487862914#223264" "port contents all | grep lua | grep /manual.html") # (find-telegachat "1487862914#223169" "port contents lua51-lpeg") # (find-telegachatm "1487862914#223169" "port contents lua51-lpeg") ;; 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 "")))) ##### # # open -a Vivaldi # 2023dec20 # ##### # «Vivaldi-a» (to ".Vivaldi-a") # (find-telegachat "1487862914#223301") # (find-telegachatm "1487862914#223301") # (find-telegachat "1487862914#223311") # (find-telegachatm "1487862914#223311") (defun find-googlechrome (url &rest rest) (find-bgprocess `("/Applications/Vivaldi.app/Contents/MacOS/Vivaldi" ,url))) (defun find-googlechrome (url &rest rest) ;; (find-bgprocess `("open" "-a" "Firefox" ,url))) (find-bgprocess `("open" "-a" "Vivaldi" ,url))) ##### # # Halian # 2024aug03 # ##### # «Halian» (to ".Halian") # (find-telegachat "-1002188044240#2292" "brave") # (find-telegachat "-1002188044240#2312" "tem como ser C-<return>") # (find-telegachat "-1002188044240#2334" "find-bgprocess") # (find-telegachat "-1002188044240#2407" "mpv" "E me diz qual dos dois funciona") # (find-telegachat "-1002188044240#2447" "(defalias 'find-pdf-page 'find-googlechrome-page)") # (find-telegachat "-1002188044240#2424" "<C-return>") # (find-altbrowser-links "{binary}") # (find-altbrowser-links "Brave Browser") # https://nootrix.com/tutorials/mac-open-file-url-parameters-command-line/ "file:///home/edrx/Coetzee99.pdf#page=3" "file:///Users/aurus/Coetzee99.pdf#page=3" • (eepitch-shell) • (eepitch-kill) • (eepitch-shell) open -a "Brave Browser" "file:///Users/aurus/Coetzee99.pdf#page=3" & /Applications/Brave\ Browser.app/Contents/MacOS/Brave\ Browser \ "file:///Users/aurus/Coetzee99.pdf#page=3" (find-bgprocess '( "/Applications/Brave\ Browser.app/Contents/MacOS/Brave Browser" "file:///Users/aurus/Coetzee99.pdf#page=3" )) "mpv" "/tmp/emacsconf2021.mp4")) (defalias 'find-pdf-page 'find-googlechrome-page) (defun ee-find-googlechrome-page (fname &optional page) `(,ee-brave-program ,(ee-fname-page-to-url fname page))) ;; Test: (find-pdf-page "~/Coetzee99.pdf" 3) (find-bgprocess `("open" "-a" "Brave Browser" ,url))) wget -nc http://anggtwu.net/eev-videos/emacsconf2021.mp4 wget -N http://anggtwu.net/eev-videos/emacsconf2021.vtt mpv emacsconf2021.mp4 (find-bgprocess `("mpv" "/tmp/emacsconf2021.mp4")) (find-bgprocess `("open" "-a" "mpv" "/tmp/emacsconf2021.mp4")) ##### # # Halian-dot-emacs # 2024aug04 # ##### # «Halian-dot-emacs» (to ".Halian-dot-emacs") # (find-angg ".emacs.local.mac-halian") # (find-wget-elisp "http://anggtwu.net/.emacs.local.mac-halian") ;; From: (find-es "osx" "Halian-dot-emacs") ;; See: (find-eev-quick-intro "6.1. The main key: <F8>") ;; From: (find-esetkey-links (kbd "<C-return>") 'eepitch-this-line) (define-key eev-mode-map (kbd "<C-return>") 'eepitch-this-line) ;; Based on: (find-altbrowser-links "Brave Browser") ;; Tests: (find-bgprocess '("open" "-a" "Brave Browser" "https://www.lua.org/")) ;; (find-googlechrome "https://www.lua.org/") ;; (defun find-googlechrome (url) (find-bgprocess `("open" "-a" "Brave Browser" ,url))) ;; See: (find-eev "eev-pdflike.el" "find-googlechrome-page") ;; Tests: (find-pdf-like-intro) ;; (ee-find-googlechrome-page "~/Coetzee99.pdf" 3) ;; (find-googlechrome-page "~/Coetzee99.pdf" 3) ;; (find-pdf-page "~/Coetzee99.pdf" 3) ;; (defalias 'find-pdf-page 'find-googlechrome-page) (defun ee-find-googlechrome-page (fname &optional page) `(,ee-brave-program ,(ee-fname-page-to-url fname page))) (setq ee-brave-program "/Applications/Brave Browser.app/Contents/MacOS/Brave Browser") ##### # # emacs-plus # 2024sep07 # ##### # «emacs-plus» (to ".emacs-plus") # https://xenodium.com/my-emacs-eye-candy/ # https://github.com/d12frosted/homebrew-emacs-plus # (find-es "lpeg" "lpeg-debug-mode") # (find-lpegsrcfile "makefile" "macosx:") # (find-lpegsrcfile "makefile" "macosx:" "-undefined dynamic_lookup") # (find-telegachat "1487862914#225679") # (find-telegachatm "1487862914#225679" "-undefined dynamic_lookup") # (find-telegachat "1487862914#223165" "sudo port install lua51-lpeg") • (eepitch-shell) • (eepitch-kill) • (eepitch-shell) port echo all | grep /lpeg.html | sort port echo all | grep /re.html | sort port echo all | grep lua | grep /manual.html | sort • (eepitch-shell) • (eepitch-kill) • (eepitch-shell) port contents all | grep /lpeg.html | sort port contents all | grep /re.html | sort port contents all | grep lua | grep /manual.html | sort # (find-fline "~/LOGS/2023dec19.emacs" "https://formulae.brew.sh/") https://lldb.llvm.org/use/symbols.html On macOS, debug symbols are often in stand alone bundles called dSYM files https://notes.billmill.org/blog/2024/02/How_to_love_homebrew.html https://blog.trailofbits.com/2024/07/30/our-audit-of-homebrew/ # Local Variables: # coding: utf-8-unix # End: