使用Atom作为Factor侦听器的默认编辑器

时间:2015-03-18 22:42:22

标签: atom-editor factor-lang

我想使用Atom作为Factor侦听器的默认编辑器,因此键入\ foo edit将在Atom中打开foo的定义。但是当我尝试它时,我得到了这个:

Launching failed with error:
Win32 error 0x2: The system cannot find the file specified.
Launch descriptor:

T{ process
    { command
        {
            "atom"
            "C:\\path\\to\\factor_directory\\Factor/work/file_directory/filename.factor:1"
        }
    }
    { detached t }
    { environment H{ } }
    { environment-mode +append-environment+ }
    { group +same-group+ }
}

但是如果我进入目录并从powershell执行atom filename.factor(我在Windows 8.1上),它运行正常,这表明Factor生成的命令有问题。所以我打开了C:\path\to\factor_directory\Factor\basis\editors\atom并找到了

! Copyright (C) 2014 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: editors kernel make math.parser namespaces sequences ;
IN: editors.atom

SINGLETON: atom-editor
atom-editor \ editor-class set-global

SYMBOL: atom-path

M: atom-editor editor-command ( file line -- command )
    [
        atom-path get "atom" or ,
        number>string ":" glue ,
    ] { } make ;

我对这是如何运作有一个最模糊的想法。我想我应该以某种方式更改editor-command的定义,但我不确定它有什么问题。

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

原子可执行文件可能不在您的路径中。如果你看下面一行:

atom-path get "atom" or ,

or单词从堆栈中获取2个项目,如果其中一个为真,则输出第一个,否则返回f(false)(如果使用的话)在GUI监听器中,您可以通过单击单词本身以交互方式查找帮助浏览器中特定单词的文档!因此,您可以单击or并阅读文档以了解其工作原理。

查看错误消息,正在返回"atom",因此我们可以推断出

atom-path get

必须已返回f(false)。因此,您需要做的是在执行atom-path字之前将编辑器的可执行路径设置为edit

"C:/path/to/atom.exe" \ atom-path set-global

现在我不确定我使用的路径分隔符是否可以在Windows中按原样运行,但是你明白了。