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 |
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 Action
in Automator.appLibrary -> Utilities
and double clickRun AppleScript
.files or folders
inFinder.app
.Emacs.workshop
to~/Library/Services
System Preference -> Keyboard -> Shortcut -> Services
and give theEmacs
underFiles and Folders
a shortcut.Preferences -> General -> Startup
toOnly Restore Hotkey Window
for the Window restoration policy. credit: here