diff options
author | Thierry Volpiatto <thievol@posteo.net> | 2021-09-13 07:52:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-13 07:52:57 +0200 |
commit | c0919981511fceb0bd10d566794984b8031e8dfd (patch) | |
tree | 1ece790675342db0968973d759582faae5577dae | |
parent | d8aca8857642fe90199c9942f7ff119027dd2df4 (diff) | |
parent | 3b616ac5039e94bc33d12161a03f5a9164c73790 (diff) |
Merge pull request #2439 from taquangtrung/master
highlight filename extension when find files
-rw-r--r-- | helm-for-files.el | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/helm-for-files.el b/helm-for-files.el index a0c0f61e..d4388a60 100644 --- a/helm-for-files.el +++ b/helm-for-files.el @@ -193,11 +193,18 @@ Colorize only symlinks, directories and files." 'match-part (funcall mp-fn disp) 'help-echo (expand-file-name i)) i)) - (t (cons (propertize disp - 'face 'helm-ff-file - 'match-part (funcall mp-fn disp) - 'help-echo (expand-file-name i)) - i))))) + (t (let* ((ext (file-name-extension disp)) + (disp (propertize disp + 'face 'helm-ff-file + 'match-part (funcall mp-fn disp) + 'help-echo (expand-file-name i)))) + (when (condition-case _err + (string-match (format "\\.\\(%s\\)$" ext) disp) + (invalid-regexp nil)) + (add-face-text-property + (match-beginning 1) (match-end 1) + 'helm-ff-file-extension nil disp)) + (cons disp i)))))) (defclass helm-files-in-current-dir-source (helm-source-sync helm-type-file) ((candidates :initform (lambda () |