Last active
March 22, 2021 12:18
-
-
Save imkiva/a460a57b03db591b1cda9d1fb259f1ed to your computer and use it in GitHub Desktop.
Open emacs cli editing the file selected in Finder.app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| on run {input, parameters} | |
| tell application "Finder" | |
| set flist to selection as alias list | |
| if length of flist = 0 then | |
| set fpath to "" | |
| else | |
| set fpath to quoted form of POSIX path of first item of flist | |
| end if | |
| end tell | |
| set fullCommand to "exec emacs " & fpath | |
| tell application "iTerm" | |
| set term_window to (create window with default profile) | |
| set sesh to (current session of term_window) | |
| tell sesh to write text fullCommand | |
| end tell | |
| end run |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tested on macOS Big Sur 11.2
Quick Actionin Automator.appLibrary -> Utilitiesand double clickRun AppleScript.files or foldersinFinder.app.Emacs.workshopto~/Library/ServicesSystem Preference -> Keyboard -> Shortcut -> Servicesand give theEmacsunderFiles and Foldersa shortcut.Preferences -> General -> StartuptoOnly Restore Hotkey Windowfor the Window restoration policy. credit: here