如何设置所有.rb文件或所有.py文件在emacs中打开,如果我双击它们;说,从桌面?直接打开一个文件到emacs(通过双击)
我在OS X 10.6.2上。
我有脚本:
on open of finderObjects
repeat with currFile in finderObjects
set unixPath to POSIX path of currFile
set base to do shell script "dirname " & unixPath
set fname to do shell script "basename " & unixPath
do shell script "cd '" & base & "';" & " emacs " & fname
end repeat
end open
但是,如果我将文件拖到 - 它(text.py只是打印一条线),我得到: emacs的:标准输入是不是tty
而我不确定如何解决这个问题。
谢谢!
编辑:以链接解决:http://www.macosxhints.com/article.php?story=20031027142625782
set filecount to 0
on open filelist
repeat with i in filelist
set filecount to 1
tell application "Terminal"
set filename to do shell script ¬
"perl -e \"print quotemeta ('" & POSIX path of i & "');\""
do script "emacs " & filename & "; exit"
end tell
end repeat
end open
if filecount < 1 then
tell application "Terminal"
do script "emacs; exit"
end tell
end if
我认为这将属于superuser.com – 2010-02-02 18:24:39
我没有发布它的原因是我假设它会涉及一个bash脚本 - 这对我来说似乎是对的。但如果它不属于它,就移动它! – Isaac 2010-02-02 18:25:20
在理想的世界里,它会去那里。可悲的是,我还没有在开发人员不希望自己设置emacs的环境中工作(或者更可能的是,使用一些低级编辑器......并*喜欢它*)。 – 2010-02-02 18:48:36