从项目中打开固定文件(在Emacs Projectile中)

时间:2018-11-15 11:12:25

标签: emacs projectile emacs-helm

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

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

2 个答案:

答案 0 :(得分: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"))

答案 1 :(得分:0)

也许非投射方式是使用bookmarks的{​​{1}}功能?对于已经定义的书签emacs,您将带您进入文件并在其中偏移吗?

相关问题