Finderで選択したorg-modeファイルをダブルクリックして開きたいとします。しかし、私はデーモンモードでEmacsを使用しているので、そのためにemacsclient
コマンドを使用したいと思います。Emacsclientコマンドを使用してOS XでEMACSファイルをダブルクリックする方法
したがって、コマンドemacsclient -c posixPathToFile
をAppleScript アプリケーションにラップして開きます。
tell application "Finder"
set fileAlias to the selection as alias
set fileName to name of fileAlias
set posixPath to POSIX path of fileAlias
end tell
-- tell application "Emacs" to activate
try
do shell script "/usr/local/bin/emacsclient -c " & quoted form of posixPath
end try
私はいくつかのset
コマンドは必要ありません知っています。このスクリプトがXemacs.app
という名前で保存されており、このアプリケーションを常に.org
ファイルを開くように関連付けると仮定しましょう。
このアプリケーションを使用するとファイルをダブルクリックすることはできませんが、Finderでファイルを選択してからXemacs.appを単独で呼び出すと動作します。どうして ?私は、何が起こるかを理解するためにAppleScriptに十分な自信がありません。
だからこの問題を回避するには、サービスが今ファイル、右クリックしてcalligサービスを選択>「開く「Emacsで開く」として保存され
on run {input, parameters}
set posixPath to POSIX path of input
tell application "iTerm" to do shell script "/usr/local/bin/emacsclient -c " & quoted form of posixPath
return input
end run
Automatorのサービスを使用していましたin Emacs "が動作し、ファイルが開きます。
最初のアプローチで何が問題になっていますか?
、そのカモノハシのアプリケーションに関連付けられている、お気に入りのファイルタイプを作りますか? – lawlist
アイデアは、ここでサードパーティ製のツール – m0ll3art
を使用していなかったいくつかの例を持っている「マック*上* Emacsdaemonとのemacsclient」と題する関連スレッドです:https://emacs.stackexchange.com/questions/141/emacsdaemon-and- https://www.reddit.com/r/emacs/comments/1wu2ja/a_tip_for_os_x_users_using_emacs_daemon/?st=j639vmk6&sh=8bb51e73、Googleのキーワード:「**のemacsclientのAutomatorアプリをemacsのreddit上の別の関連スレッドがあり、ここでのemacsclient-MAC-上とファインダー** " – lawlist