-
Notifications
You must be signed in to change notification settings - Fork 161
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
Don't resolve symlinks in path #51
Comments
Well, I have to say it's as designed. You need this config. (setq find-file-visit-truename t) If the file is controlled by vc, refer to |
Thank you for the help! |
I realize that this issue was closed and that the solution |
@CeleritasCelery Well, thank you for the comments. Can you please share your codes? PR is always welcome as long as it makes sense. I need to think over it and any ideas are also welcome. |
@CeleritasCelery Thanks for sharing! But I don't think it's the solution. The change may impact other scenarios. If you just want to visit the symlink while not the true files, why should show file true name in modeline? It doesn't make sense. My suggestion is change More thoughts? |
If you visit the true name it changes your The whole point of symlinks is to have a pointer to a remote file but have it act as though is is integrated into your file system. visiting the true name breaks that utility. |
I fully agree with what @CeleritasCelery has to say above. I marked this as resolved as it was partially resolved with the above. It shortened my path a little, but it's still a mess. Again the point of having symlinks for me is to shorten a long path. Not resolve it. Also using them with a NFS share. |
Can you try this on your env? (defun doom-modeline-buffer-file-name ()
"Propertized variable `buffer-file-name' based on `doom-modeline-buffer-file-name-style'."
(let* ((buffer-file-name (file-local-name (or (buffer-file-name (buffer-base-buffer)) "")))
(buffer-file-truename (file-local-name (or buffer-file-truename (file-truename buffer-file-name) "")))
(buffer-file-name (expand-file-name buffer-file-truename)))
(propertize
(pcase doom-modeline-buffer-file-name-style
(`truncate-upto-project
(doom-modeline--buffer-file-name buffer-file-name buffer-file-truename 'shrink))
(`truncate-from-project
(doom-modeline--buffer-file-name buffer-file-name buffer-file-truename nil 'shrink))
(`truncate-with-project
(doom-modeline--buffer-file-name buffer-file-name buffer-file-truename 'shrink 'shink 'hide))
(`truncate-except-project
(doom-modeline--buffer-file-name buffer-file-name buffer-file-truename 'shrink 'shink))
(`truncate-upto-root
(doom-modeline--buffer-file-name-truncate buffer-file-name buffer-file-truename))
(`truncate-all
(doom-modeline--buffer-file-name-truncate buffer-file-name buffer-file-truename t))
(`relative-to-project
(doom-modeline--buffer-file-name-relative buffer-file-name buffer-file-truename))
(`relative-from-project
(doom-modeline--buffer-file-name-relative buffer-file-name buffer-file-truename 'include-project))
(style
(propertize
(pcase style
(`file-name (file-name-nondirectory buffer-file-name))
(`buffer-name (buffer-name)))
'face
(let ((face (or (and (buffer-modified-p)
'doom-modeline-buffer-modified)
(and (doom-modeline--active)
'doom-modeline-buffer-file))))
(when face `(:inherit ,face))))))
'help-echo (concat buffer-file-truename
(unless (string= (file-name-nondirectory buffer-file-truename)
(buffer-name))
(concat "\n" (buffer-name)))
"\nmouse-1: Previous buffer\nmouse-3: Next buffer")
'local-map mode-line-buffer-identification-keymap))) |
That did not make any difference for me. However this code worked (defun doom-modeline-buffer-file-name ()
"Propertized variable `buffer-file-name' based on `doom-modeline-buffer-file-name-style'."
(let* ((buffer-file-name (file-local-name (or (buffer-file-name (buffer-base-buffer)) "")))
(buffer-file-truename buffer-file-name))
(propertize
(pcase doom-modeline-buffer-file-name-style
(`truncate-upto-project
(doom-modeline--buffer-file-name buffer-file-name buffer-file-truename 'shrink))
(`truncate-from-project
(doom-modeline--buffer-file-name buffer-file-name buffer-file-truename nil 'shrink))
(`truncate-with-project
(doom-modeline--buffer-file-name buffer-file-name buffer-file-truename 'shrink 'shink 'hide))
(`truncate-except-project
(doom-modeline--buffer-file-name buffer-file-name buffer-file-truename 'shrink 'shink))
(`truncate-upto-root
(doom-modeline--buffer-file-name-truncate buffer-file-name buffer-file-truename))
(`truncate-all
(doom-modeline--buffer-file-name-truncate buffer-file-name buffer-file-truename t))
(`relative-to-project
(doom-modeline--buffer-file-name-relative buffer-file-name buffer-file-truename))
(`relative-from-project
(doom-modeline--buffer-file-name-relative buffer-file-name buffer-file-truename 'include-project))
(style
(propertize
(pcase style
(`file-name (file-name-nondirectory buffer-file-name))
(`buffer-name (buffer-name)))
'face
(let ((face (or (and (buffer-modified-p)
'doom-modeline-buffer-modified)
(and (doom-modeline--active)
'doom-modeline-buffer-file))))
(when face `(:inherit ,face))))))
'help-echo (concat buffer-file-truename
(unless (string= (file-name-nondirectory buffer-file-truename)
(buffer-name))
(concat "\n" (buffer-name)))
"\nmouse-1: Previous buffer\nmouse-3: Next buffer")
'local-map mode-line-buffer-identification-keymap))) |
I put @seagle0128 's code into my config.org after I loaded doom-mode line in my config and this is what my bar looks like currently. config.org is in in ~/org/config.org and the ~org dir is a symlink to ~/dev/active/dotfiles/emacs/.emacs.d/ which I manage with gnu stow. I'm also on Freebsd which has /home sym linked to /usr/home in the base system. So theirs a lot going on there. |
@gregf how about using the latest version without any changes? what does it look like? |
This is how I have doom-modeline configured btw. (use-package doom-modeline |
I realize that I did not start emacs, so perhaps the reason mine did change would be because the cached root value was unchanged. |
@seagle0128 one thing I want to point out about the code snippet you provided, is that although it makes the path look much cleaner, it is still using the truename, which does not match the |
@CeleritasCelery Can you provide the detailed steps to reproduce your issue? I could't reproduce in my env. I need more info, e.g. which style of In #51 (comment), you can see all look fine in my env. |
Is that a symlink in your example? |
Of course. |
Fix #51 and #209. Root cause: bbatsov/projectile#1387.
I think this issue has been resolved. |
Resolving symlinks is causing doom-mode line to display a ridiculous path for a file that lives in my home directory.
The text was updated successfully, but these errors were encountered: