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

Open a fixed file from a project (in Emacs Projectile)

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

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

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

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

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

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

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