【问题标题】:Open a fixed file from a project (in Emacs Projectile)从项目中打开一个固定文件(在 Emacs Projectile 中)
【发布时间】:2018-11-15 11:12:24
【问题描述】:

如何编写函数以从项目中打开相同的相关文件(例如,server/logfile.txt)?所以,这应该和我所在的项目有关。

projectile-find-file 列出所有这些,而不仅仅是我们有兴趣打开的那个...

【问题讨论】:

    标签: emacs projectile emacs-helm


    【解决方案1】:

    您可以使用projectile-project-root 函数来扩展相对于您的射弹项目的基本目录的路径,例如。

    (when-let ((root (projectile-project-root)))
      (find-file-other-window (expand-file-name "server/logfile.txt" root)))
    

    或(when-letif-let 宏来自最近的 emacses 中包含的 subr-x

    (if-let ((root (projectile-project-root)))
        (find-file-other-window (expand-file-name "server/logfilt.txt" root))
      (user-error "not projectile project found"))
    

    【讨论】:

      【解决方案2】:

      也许一种非抛射方式是使用emacsbookmarks 功能?对于已经定义的书签C-x r b 会带您到文件并在其中偏移吗?

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2010-09-10
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-06-04
        • 2020-12-05
        相关资源
        最近更新 更多