2

Helm find files lists files of the same name alphabetically.

a.aux
a.log
a.tex
b.aux
b.log
b.tex

This is annoying as I want the .tex file 99% of the time. Is it possible to prefer certain extensions (by white- or blacklist) to either change the order for extensions only:

a.tex (prefered)
a.aux
a.log
b.tex (prefered)
b.aux
b.log

, or even "surpassing" filename priority, like so:

a.tex (prefered)
b.tex (prefered)
a.aux
a.log
b.aux
b.log

2 Answers 2

1

This is not possible with the current code AFAIK (see helm-ff-initial-sort-method). One solution that doesn't require using a sorting algorithm is to append two lists, one containing the tex files and the other one containing the non-tex files so that the tex files are always on top.

(advice-add 'helm-list-directory :filter-return
            (lambda (files)
              (let ((tex-files (cl-remove-if-not
                                (lambda (f)
                                  (string= (file-name-extension f) "tex"))
                                files))
                    (non-tex-files (cl-remove-if
                                    (lambda (f)
                                      (string= (file-name-extension f) "tex"))
                                    files)))
                (append tex-files non-tex-files))))
1
  • Very informative and provides exactly what the OP needs.
    – RichieHH
    Feb 5, 2020 at 3:47
0

When using something like helm-projectile-find-file-dwim I would just add .tex as another search seed. In Helm FF, type the ext after the trailing eg "x/y/.tex" Not quite what you want but close.

1
  • This works for searching specific extensions, yes. But I almost always want the .tex over the .aux or .log files, so want to avoid having it to type every time
    – R. Bosman
    Feb 4, 2020 at 9:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.