2016-09-13 44 views
3

Mac OS X上でEmacsclientをGUIで起動するにはどうすればよいですか?Mac OS XでEmacsclientをGUIで起動する

The EmacsWiki describes Automatorを使用して "DockからEmacsを作成する"アプリケーションの作成方法。それは私のために働いたが、EmacsではなくEmacsclientを起動したい。だから、/Applications/Emacs.app/Contents/MacOS/Emacs/Applications/Emacs.app/Contents/MacOS/bin/emacsclient/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -cの両方に置き換えようとしましたが、どちらもうまくいきませんでした。

+1

ここで回答しない人はemacs stackexchangeでこの質問をしたいと思うかもしれません。ただ言って。 –

+0

emacs-macポートを使用している場合、 'emacsclient'はちょっとしたバグです:https://github.com/railwaycat/homebrew-emacsmacport/issues/52 –

答えて

1

オリジナルのポスターが望むものを何でもして、プラチナまたはオートメーターのようなものを使ってアプリケーションにラップアップすることが考えられます。 (server-start)をユーザー構成ファイル内に配置する代わりに、​​コマンドライン引数を使用するなどの追加のアイデアについては、https://superuser.com/questions/685111/basic-setup-of-emacs-server-under-osxを参照してください。ここで

は例のAppleScriptです:

# (server-start) must be inside `init.el` or `.emacs` file. 
# 
# This script can also be used in the terimal: osascript path-to-script arguments 
# Terminal Example: 
# osascript /absolute/path/to/applescript/file "-e '(progn (dired \"/Applications\") (message \"Hello-World\!\"))'" 

on run argv 
    set arg to item 1 of argv 
    set emacs to application "Emacs" 
    set appIsRunning to emacs is running 
    if appIsRunning then 
     say "Emacs is already running." 
     do shell script "/Applications/Emacs.app/Contents/MacOS/bin/emacsclient " & arg 
    else 
    tell application "/Applications/Emacs.app/Contents/MacOS/Emacs" to activate 
     say "Please wait five seconds for Emacs to load." 
     delay 5 
     do shell script "/Applications/Emacs.app/Contents/MacOS/bin/emacsclient " & arg 
    end if 
end run 
2

EDIT:KHDを使用すると、より速く、より柔軟性があるので、私は今、Automatorのアプリケーションの代わりにこれを達成するためにkhdを使用してお勧めします。 khdを使用すると、指定されたキーシーケンスに対して$SHELL(デフォルトのシェル)コマンドをモーダルな方法で実行できます。 コントロール後 - O 電子を押すと、emacsclient -n -c -a ""(または、例えば、を実行することができます:ちょうど開くアプリケーションのために、 oを- たとえば、のは、コントロールを言わせて、任意のキーにグローバルプレフィックスを作ることができますf新しいFinderウィンドウ用)。

で次のようになりますそのビットあなた.khdrc

khd mode openapp color 0xFF932092 
khd mode openapp prefix on 
khd mode openapp timeout 5 

# from default mode, press ctrl - o to enter openapp mode 
ctrl - o : khd -e "mode activate openapp" 

# then press e to open emacs and return to normal operation 
openapp - e : khd -e "mode activate default";\ 
       emacsclient -n -c -a "" 

# or f to open Finder and return to normal operation 
openapp - f : khd -e "mode activate default";\ 
       open -a Finder 

# or--in case we change our mind--press escape to return directly 
# to normal operation instead of opening an application 
openapp - escape  : khd -e "mode activate default" 

の.appファイルは、ファイルの種類を開くためのデフォルトのアプリケーションの設定のような(便利です、私はまだかかわらず、他の状況のた​​めのAutomatorアプリケーションを持っていますemacsclientであるかもしれません。この種のものを直接シェルコマンドに設定する方が良いかもしれませんが、Automatorアプリで十分です。


のAutomatorアプリケーション:

$ which emacsclient 
/usr/local/bin/emacsclient 

上記のパスを使用して(といくつか:

あなたは(言ったシェルからemacsclient -c作品を仮定して)自分の殻にwhichを使用してのemacsclientするために、適切なパスを見つけることができますemacsclientフラグについては$ man emacsclientを参照してください)。

/usr/local/bin/emacsclient -n -c -a "" -- "[email protected]" 
関連する問題