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

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

[nongnu] elpa/helm 267dec7ccf: Allow helm-follow in HFF for only some ki


From: ELPA Syncer
Subject: [nongnu] elpa/helm 267dec7ccf: Allow helm-follow in HFF for only some kind of files (#2546)
Date: Tue, 6 Sep 2022 11:58:46 -0400 (EDT)

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

    Allow helm-follow in HFF for only some kind of files (#2546)
---
 helm-files.el | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/helm-files.el b/helm-files.el
index 475ac5990b..a68bb88fe8 100644
--- a/helm-files.el
+++ b/helm-files.el
@@ -803,6 +803,10 @@ to nil to avoid error messages when using 
`helm-find-files'."
 This can be toggled at any time from `helm-ff-file-name-history' with \
 \\<helm-file-name-history-map>\\[helm-file-name-history-show-or-hide-deleted]."
   :type 'boolean)
+
+(defcustom helm-ff-follow-blacklist-file-exts '("gpg" "doc" "docx" "mp3" "ogg")
+  "File extensions we don't want to follow when helm-follow-mode is enabled."
+  :type '(repeat string))
 
 ;;; Faces
 ;;
@@ -4510,6 +4514,13 @@ This affects directly file CANDIDATE."
 
 (defvar helm-ff-sound-file-extensions '("wav" "au"))
 
+(defun helm-ff--maybe-follow (candidate)
+  (let ((file  (file-regular-p candidate))
+        (image (string-match-p (image-file-name-regexp) candidate))
+        (ext   (file-name-extension candidate)))
+    (and file
+         (or image (not (member ext helm-ff-follow-blacklist-file-exts))))))
+    
 (cl-defun helm-find-files-persistent-action-if (candidate)
   "Open subtree CANDIDATE without quitting helm.
 If CANDIDATE is not a directory expand CANDIDATE filename.
@@ -4533,7 +4544,7 @@ file."
                                                             nil fname)
                                        (insert fname))))))
     (helm-set-attr 'candidate-number-limit helm-ff-candidate-number-limit)
-    (unless image-cand
+    (unless (helm-ff--maybe-follow candidate)
       (when follow
         (helm-follow-mode -1)
         (cl-return-from helm-find-files-persistent-action-if



reply via email to

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