Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabling symbolic links expanding #209

Closed
ghost opened this issue Aug 16, 2019 · 11 comments
Closed

Disabling symbolic links expanding #209

ghost opened this issue Aug 16, 2019 · 11 comments
Labels
good first issue Good for newcomers

Comments

@ghost
Copy link

ghost commented Aug 16, 2019

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
@seagle0128
Copy link
Owner

It seems duplicate with #51 .

@ghost
Copy link
Author

ghost commented Aug 16, 2019

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

@seagle0128
Copy link
Owner

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

@ghost
Copy link
Author

ghost commented Aug 16, 2019

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

@seagle0128
Copy link
Owner

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).

@ghost
Copy link
Author

ghost commented Aug 16, 2019

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?

@seagle0128
Copy link
Owner

seagle0128 commented Aug 19, 2019

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))))

@ghost
Copy link
Author

ghost commented Aug 19, 2019

It works now, thank you!

@seagle0128
Copy link
Owner

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

seagle0128 added a commit that referenced this issue Oct 16, 2019
How to detect the project root.
The default priority of detection is `ffip' > `projectile' > `project'.
nil means to use `default-directory'.
The project management packages have some issues on detecting project root.
e.g. `projectile' doesn't handle symlink folders well, while `project' is unable
to hanle sub-projects.
You can specify one if you encounter the issue.

For more details, refer to #209.

Close #224.
@seagle0128
Copy link
Owner

seagle0128 commented Oct 16, 2019

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

@seagle0128 seagle0128 added enhancement New feature or request good first issue Good for newcomers and removed enhancement New feature or request labels Oct 23, 2019
@ghost
Copy link
Author

ghost commented Oct 26, 2019

So far, everything works well, thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant