-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Remove . and .. entires in helm-find-files #1863
Comments
👍 to that! |
Apparently it's not recommended, and in fact explicitly worked around in Helm, although the maintainer seems unable to explain why, precisely. emacs-helm/helm#924 Can we advice |
I agree, if these entries are mandatory then at least we can try put them out of the way for quicker navigation. Other possibility instead of sorting could be to automatically select the 3rd entry. I think this is the behavior of dired, I cannot check for now. |
Oh I agreed with myself it seems :-D |
I hacked helm files to allow ignoring /. /.. after all and now find-files is sooo much nicer! :-) |
cool @Peaker could you send a PR? |
Yes, please share how you did it. |
I can't make a PR because I did it as a complete hack:
|
Thanks @Peaker, even if you can't make a PR doesn't mean it's not helpful. It's actually possible to do with function advice without hacking Helm (or rather, the Helm source). I made a layer for it. If desired I can put together a PR for Spacemacs. I didn't because I'm not sure how serious emacs-helm/helm#924 is, even though I haven't come across that problem myself yet. |
As nobody asked for this functionality last 4 months, upstream are not going to do anything on this, and the only existing solution is too hacky, it's a wontfix. People really wanting this can try @TheBB solution. I'm closing this issue then. |
@TheBB your link for the layer that addresses this is broken. Could you provide an updated one? I would love to address this issue. |
I have been messing around with this and made a solution that keeps the current directory hardlink at the bottom and removes the parent directory hardlink. Based on @TheBB's solution. (defun cel/helm-ff-not-hardlink-p (file)
(not (s-ends-with? ".." file)))
(defun cel/helm-ff-up-one-level (fcn &rest args)
(flet ((helm-file-completion-source-p (&rest _) t))
(apply fcn args)))
(defun cel/helm-ff-dots-at-bottom (ret-val)
(if (listp ret-val)
(-rotate (- (--count (s-ends-with? "." it) (-take 2 ret-val)))
ret-val)
ret-val))
(with-eval-after-load 'helm-files
(advice-add 'helm-ff-filter-candidate-one-by-one
:before-while 'cel/helm-ff-not-hardlink-p)
(advice-add 'helm-find-files-up-one-level
:around 'cel/helm-ff-up-one-level)
(advice-add 'helm-find-files-get-candidates
:filter-return 'cel/helm-ff-dots-at-bottom)) |
Or put them at the end.
It prevents quick navigation in a tree where there are some directories with only one sub-directory.
The text was updated successfully, but these errors were encountered: