commit 684877ad0b2fb383ac9942af057b3e1dc5b46944 from: Lukas Henkel date: Sun Aug 13 11:16:56 2023 UTC Fix ordering of files when flex completing commit - edc686b3eb52155eb4bd7e89a083a60d51831578 commit + 684877ad0b2fb383ac9942af057b3e1dc5b46944 blob - 6b4ba0e44deae86e8143032f6455fd847073f902 blob + 776f4c1f7733c3fa6b6fbb45897923d1f8bd3536 --- init.el +++ init.el @@ -266,6 +266,15 @@ (advice-add #'completion--replace :around #'lh/advice-fix-minibuffer-consult) +;; file-name-all-completions seems to return file names in whatever order the +;; filesystem feels like returning. This is super annoying with the flex +;; completion style. If the FS returns "barfoo" before "foobar", flex completion +;; will match "barfoo" first. This advice sorts the file name list. +(defun lh/advice-sort-file-name-all-completions (files) + (sort files #'string<)) + +(advice-add 'file-name-all-completions :filter-return 'lh/advice-sort-file-name-all-completions) + (setq completion-ignore-case t) (custom-set-variables