【问题标题】:Using Atom as default editor for Factor listener使用 Atom 作为 Factor 监听器的默认编辑器
【发布时间】:2015-03-18 22:42:21
【问题描述】:

我想使用 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+ }
}

但是,如果我 cd 进入目录并从 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 的定义,但我不确定它有什么问题。

有什么想法吗?

【问题讨论】:

    标签: atom-editor factor-lang


    【解决方案1】:

    atom 可执行文件可能不在您的路径中。如果您查看以下行:

    atom-path get "atom" or ,
    

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

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

    atom-path get
    

    必须返回f (false)。所以你需要做的是在执行edit这个词之前,将编辑器的可执行路径设置为atom-path

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

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

    【讨论】:

    • 您可以使用“/”或“\\”作为路径分隔符,它们都可以在 Windows 中使用,我认为其他操作系统也可以。
    猜你喜欢
    • 1970-01-01
    • 2012-03-16
    • 2011-07-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-13
    相关资源
    最近更新 更多