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

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

[nongnu] elpa/helm e402aa7114 6/6: Merge pull request #2723 from taquang


From: ELPA Syncer
Subject: [nongnu] elpa/helm e402aa7114 6/6: Merge pull request #2723 from taquangtrung/helm-browse-project
Date: Thu, 26 Jun 2025 07:00:38 -0400 (EDT)

branch: elpa/helm
commit e402aa7114f690b4268d4d3013d1c7dbcf54ea79
Merge: f7e0184c58 903f99bffd
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: GitHub <noreply@github.com>

    Merge pull request #2723 from taquangtrung/helm-browse-project
    
    helm-browse-project: handle nested projects (Hg inside Git or vice versa)
---
 helm-files.el | 35 ++++++++++++++++++++++-------------
 1 file changed, 22 insertions(+), 13 deletions(-)

diff --git a/helm-files.el b/helm-files.el
index 9fa4a40e76..b971c0bce0 100644
--- a/helm-files.el
+++ b/helm-files.el
@@ -7098,22 +7098,31 @@ and
 <https://github.com/emacs-helm/helm-ls-hg>."
   (interactive "P")
   (require 'helm-x-files)
-  (let ((helm-type-buffer-actions
-         (remove (assoc "Browse project from buffer"
-                        helm-type-buffer-actions)
-                 helm-type-buffer-actions))
-        (helm-buffers-in-project-p t))
+  (let* ((helm-type-buffer-actions
+          (remove (assoc "Browse project from buffer"
+                         helm-type-buffer-actions)
+                  helm-type-buffer-actions))
+         (helm-buffers-in-project-p t)
+         (git-project (helm-aif (and (require 'helm-ls-git nil t)
+                                     (fboundp 'helm-ls-git-root-dir)
+                                     (helm-ls-git-root-dir))
+                          (expand-file-name it)))
+         (hg-project (helm-aif (and (require 'helm-ls-hg nil t)
+                                    (fboundp 'helm-hg-root)
+                                    (helm-hg-root))
+                         (expand-file-name it)))
+         (project-type (cond ((and git-project (not hg-project)) 'Git)
+                             ((and hg-project (not git-project)) 'Hg)
+                             ((and hg-project git-project)
+                              (if (string-prefix-p git-project hg-project) 'Hg 
'Git))
+                             (t nil))))
     (cl-flet ((push-to-hist (root)
                 (setq helm-browse-project-history
                       (cons root (delete root helm-browse-project-history)))))
-      (helm-acond ((and (require 'helm-ls-git nil t)
-                        (fboundp 'helm-ls-git-root-dir)
-                        (helm-ls-git-root-dir))
+      (helm-acond ((equal project-type 'Git)
                    (push-to-hist it)
                    (helm-ls-git))
-                  ((and (require 'helm-ls-hg nil t)
-                        (fboundp 'helm-hg-root)
-                        (helm-hg-root))
+                  ((equal project-type 'Hg)
                    (push-to-hist it)
                    (helm-hg-find-files-in-project))
                   ((helm-browse-project-get--root-dir (helm-current-directory))
@@ -7121,8 +7130,8 @@ and
                        (progn
                          (push-to-hist it)
                          (helm-browse-project-find-files it (equal arg '(16))))
-                       (helm :sources 
(helm-browse-project-build-buffers-source it)
-                             :buffer "*helm browse project*")))))))
+                     (helm :sources (helm-browse-project-build-buffers-source 
it)
+                           :buffer "*helm browse project*")))))))
 
 (defun helm-browse-project-get--root-dir (directory)
   (cl-loop with dname = (file-name-as-directory directory)



reply via email to

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