branch: externals/mct
commit 251528e20ab4d1ca4100c0dc83c10baebf1e3e3c
Author: Protesilaos Stavrou <i...@protesilaos.com>
Commit: Protesilaos Stavrou <i...@protesilaos.com>

    Make mct-sort-by-directory-then-by-file remove the implicit directories
---
 mct.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mct.el b/mct.el
index 6a4644a2b4..d9fd6926f3 100644
--- a/mct.el
+++ b/mct.el
@@ -317,9 +317,10 @@ This function can be used as the value of the user option
        alphabetized))))
 
 (defun mct-sort-by-directory-then-by-file (completions)
-  "Sort COMPLETIONS with `mct-sort-by-alpha-then-by-length' with directories 
first."
+  "Sort COMPLETIONS with `mct-sort-by-alpha-then-by-length' with directories 
first.
+Also remove the implicit directories . and .. from the COMPLETIONS."
+  (setq completions (seq-remove (lambda (x) (or (string= "./" x) (string= 
"../" x))) completions))
   (setq completions (mct-sort-by-alpha completions))
-  ;; But then move directories first
   (nconc (seq-filter (lambda (x) (string-suffix-p "/" x)) completions)
          (seq-remove (lambda (x) (string-suffix-p "/" x)) completions)))
 

Reply via email to