emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/helm 21c578aea8: Fix helm-common-dir when FILES has no cdr


From: ELPA Syncer
Subject: [nongnu] elpa/helm 21c578aea8: Fix helm-common-dir when FILES has no cdr or is nil
Date: Wed, 24 Jul 2024 01:00:07 -0400 (EDT)

branch: elpa/helm
commit 21c578aea8fc9cf99c760013c2072f584d35c329
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>

    Fix helm-common-dir when FILES has no cdr or is nil
---
 helm-lib.el | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/helm-lib.el b/helm-lib.el
index 31d276b87f..fd809d4074 100644
--- a/helm-lib.el
+++ b/helm-lib.el
@@ -1897,17 +1897,19 @@ Take same args as `directory-files'."
 
 (defun helm-common-dir-1 (files)
   "Find the common directories of FILES."
-  (cl-loop with base = (car files)
-           with others = nil
-           for file in files
-           for cpart = (fill-common-string-prefix base file)
-           if cpart
-           do (setq base cpart)
-           else do (push file others)
-           finally return (if (and others base)
-                              (append (list (directory-file-name base))
-                                      (helm-common-dir-1 others))
-                            (list (and base (directory-file-name base))))))
+  (if (cdr files)
+      (cl-loop with base = (car files)
+               with others = nil
+               for file in files
+               for cpart = (fill-common-string-prefix base file)
+               if cpart
+               do (setq base cpart)
+               else do (push file others)
+               finally return (if (and others base)
+                                  (nconc (list (directory-file-name base))
+                                         (helm-common-dir-1 others))
+                                (list (and base (directory-file-name base)))))
+    (and files (list (file-name-directory (car files))))))
 
 (defun helm-common-dir (files)
   "Return the longest common directory path of FILES list.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]