seagle0128/doom-modeline

Disabling symbolic links expanding

Opened this issue · 11 comments

From doomemacs/doomemacs#1660

Describe
I was trying to disable symbolic links expanding and ended up with this mess
Screenshot
It affects directories with git, and works without problems in normal dirs.

Steps and Expected
(setq-default find-file-visit-truename nil) in doom/config.el, then open any file in directory with git and symbolic link in path.

Environment:

  • OS: Archlinux
  • Version: latest
  • Package version: 20190812.1448

It seems duplicate with #51 .

That's right I guess. But still, I don't see any clean solution, should I use this snippet somewhere?

Yes, please try it and let me know the results.

Using this snippet directory with git shows resolved path, which is not what I expect, but still better than before:
shot
But it broke in normal directories without git:
shot

This snippet has the same problem as unmodified modeline, except that it shows unresolved path with mouseover:
screens

I am afraid it's as designed. I am curious why you use (setq-default find-file-visit-truename nil) for symlinks. I suggest you use (setq doom-modeline-buffer-file-name-style 'buffer-name).

Too bad. I use (setq-default find-file-visit-truename nil) for the same reason as described in this post. Some directories in my home dir are linked to directories on separate hdd, which is mounted to /mnt. So when I open a file in symlinked dir and workdir changes to resolved path, there's no easy way to return to previous context which is really annoying.

Maybe at least this snippet can get into upstream so that mouseover would work?

Well, I reproduced the issue and found the root cause finally.
It seems the issue of projectile.

Please try this snippet and let me know the result. Thanks!

(defun doom-modeline-project-root ()
  "Get the path to the root of your project.
  Return `default-directory' if no project was found."
  (or doom-modeline-project-root
      (setq doom-modeline-project-root
            (or (and (fboundp 'project-current)
                     (ignore-errors
                       (when-let ((project (project-current)))
                         (expand-file-name (car (project-roots project))))))
                (and (bound-and-true-p projectile-mode)
                     (ignore-errors (projectile-project-root)))
                default-directory))))

It works now, thank you!

@Svadkos Can you take a look at #224 (comment) , and let me know your opinion?

I add a new option (doom-modeline-project-detection). Since the issue in projectile isn't fixed yet (and I don't think they want to fix...), you should use ffip or project while using with symlink folders.

Please refer to item 7 in FAQ

So far, everything works well, thanks again.