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

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

[nongnu] elpa/helm 87db6ba095 1/3: Make HFF consistent with buffers for


From: ELPA Syncer
Subject: [nongnu] elpa/helm 87db6ba095 1/3: Make HFF consistent with buffers for switching to tab
Date: Sun, 8 Sep 2024 01:01:15 -0400 (EDT)

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

    Make HFF consistent with buffers for switching to tab
---
 helm-buffers.el | 18 ++++--------------
 helm-files.el   | 14 ++++++++++----
 helm-utils.el   | 14 ++++++++++++++
 3 files changed, 28 insertions(+), 18 deletions(-)

diff --git a/helm-buffers.el b/helm-buffers.el
index 7997b1bcce..1852fd4ce6 100644
--- a/helm-buffers.el
+++ b/helm-buffers.el
@@ -972,20 +972,10 @@ If REGEXP-FLAG is given use `query-replace-regexp'."
   "Run switch to other frame action from `helm-source-buffers-list'."
   'helm-buffer-switch-to-buffer-other-frame)
 
-(defun helm-buffers-switch-buffers-in-tab (candidate)
-  "Switch marked buffers in a new tab.
-If no marked candidates or only one marked, try to switch to CANDIDATE in its
-tab if some, otherwise, display it in a new tab."
-  (when (fboundp 'switch-to-buffer-other-tab)
-    (let ((bufs (helm-marked-candidates)))
-      (if (cdr bufs)
-          (progn
-            (switch-to-buffer-other-tab (car bufs))
-            (helm-window-show-buffers bufs))
-        (if helm-current-prefix-arg
-            (switch-to-buffer-other-tab candidate)
-          (helm-buffers-maybe-switch-to-buffer-in-tab
-           candidate #'switch-to-buffer-other-tab))))))
+(defun helm-buffers-switch-buffers-in-tab (_candidate)
+  "Display marked buffers in a new tab.
+See `helm-buffers-switch-buffers-in-tab-1' for more infos."
+  (helm-buffers-switch-buffers-in-tab-1 (helm-marked-candidates)))
 
 (helm-make-command-from-action helm-buffers-switch-to-buffer-new-tab
   "Run switch to buffer in other tab action from `helm-source-buffers-list'."
diff --git a/helm-files.el b/helm-files.el
index d5a2858d64..17901bcd32 100644
--- a/helm-files.el
+++ b/helm-files.el
@@ -266,7 +266,7 @@ Should not be used among other sources.")
                                     ([C-c DEL] . 
helm-ff-run-toggle-auto-update))
                                   nil 'helm-ff-delete-char-backward--exit-fn)
     (when (fboundp 'tab-bar-mode)
-      (define-key map (kbd "C-c C-t")       'helm-ff-find-file-other-tab))
+      (define-key map (kbd "C-c C-t")       'helm-ff-run-find-file-other-tab))
     map)
   "Keymap for `helm-find-files'.")
 
@@ -869,7 +869,7 @@ want to use it, helm is still providing
    "Find file other frame `C-c C-o'" 'find-file-other-frame
    (lambda () (and (fboundp 'tab-bar-mode)
                    "Find file other tab `C-c C-t'"))
-   'find-file-other-tab
+   'helm-ff-find-file-other-tab
    "Print File `C-c p, C-u to refresh'" 'helm-ff-print
    "Locate `C-x C-f, C-u to specify locate db'" 'helm-ff-locate)
   "Actions for `helm-find-files'."
@@ -6438,9 +6438,15 @@ selecting them."
               ;; unspecified e.g user hit C-k foo RET.
               (t (find-file candidate)))))))
 
-(helm-make-command-from-action helm-ff-find-file-other-tab
+(defun helm-ff-find-file-other-tab (_candidate)
+  "Display marked files in a new tab.
+See `helm-buffers-switch-buffers-in-tab-1' for more infos."
+  (helm-buffers-switch-buffers-in-tab-1
+   (mapcar 'find-file-noselect (helm-marked-candidates))))
+
+(helm-make-command-from-action helm-ff-run-find-file-other-tab
     "Run find file in other tab action from `helm-find-files'."
-  'find-file-other-tab
+  'helm-ff-find-file-other-tab
   (cl-assert (fboundp 'tab-bar-mode) nil "Tab-bar-mode not available"))
 
 (defun helm-ff--new-dirs-to-update (path)
diff --git a/helm-utils.el b/helm-utils.el
index 94d32024c6..4e4b125c40 100644
--- a/helm-utils.el
+++ b/helm-utils.el
@@ -350,6 +350,20 @@ If a prefix arg is given split windows vertically."
            when (member tab-name (split-string (cdr (assq 'name tab)) ", " t))
            return tab))
 
+(defun helm-buffers-switch-buffers-in-tab-1 (buffers)
+  "Display BUFFERS in a new tab.
+If only one buffer in BUFFERS, try to switch to it in its
+tab if some, otherwise, display it in a new tab."
+  (when (fboundp 'switch-to-buffer-other-tab)
+    (if (cdr buffers)
+        (progn
+          (switch-to-buffer-other-tab (car buffers))
+          (helm-window-show-buffers buffers))
+      (if helm-current-prefix-arg
+          (switch-to-buffer-other-tab (car buffers))
+        (helm-buffers-maybe-switch-to-buffer-in-tab
+         (car buffers) #'switch-to-buffer-other-tab)))))
+
 (defun helm--get-tab-names ()
   (let ((tab-bar-tab-name-function #'tab-bar-tab-name-all))
     (mapcar (lambda (tab)



reply via email to

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