summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThierry Volpiatto <thievol@posteo.net>2021-09-14 09:49:51 +0200
committerThierry Volpiatto <thievol@posteo.net>2021-09-14 09:49:51 +0200
commit4fcb36f1b9ecb540422223479aa81579139e0b95 (patch)
tree0f7b680d05a1309cedc64cd3629a7a4bdab4046a
parent6897420d2905b333722f454b7b3bc57b751a61c3 (diff)
Use helm-file-name-extension instead of file-name-extension
helm-file-name-extension have been renamed from helm-ff-file-extension and moved to helm-lib.el. Using it instead of file-name-extension prevent highlighting extensions ending with a number e.g. Changelog.1.
-rw-r--r--helm-buffers.el2
-rw-r--r--helm-files.el11
-rw-r--r--helm-for-files.el2
-rw-r--r--helm-lib.el7
4 files changed, 11 insertions, 11 deletions
diff --git a/helm-buffers.el b/helm-buffers.el
index 3e8521e8..2fe616dc 100644
--- a/helm-buffers.el
+++ b/helm-buffers.el
@@ -432,7 +432,7 @@ The list is reordered with `helm-buffer-list-reorder-fn'."
(list
(concat prefix
(let* ((buf-fname (buffer-file-name (get-buffer buf-name)))
- (ext (if buf-fname (file-name-extension buf-fname) ""))
+ (ext (if buf-fname (helm-file-name-extension buf-fname) ""))
(buf-name (propertize buf-name 'face face1
'help-echo help-echo
'type type)))
diff --git a/helm-files.el b/helm-files.el
index d750ba82..129585d9 100644
--- a/helm-files.el
+++ b/helm-files.el
@@ -3756,13 +3756,6 @@ return directly CANDIDATES."
when fc collect fc)
candidates))
-(defsubst helm-ff-file-extension (file)
- "Returns FILE extension if it is not a number."
- (helm-aif (file-name-extension file)
- (and (not (string-match "\\`0+\\'" it))
- (zerop (string-to-number it))
- it)))
-
(defun helm-ff-filter-candidate-one-by-one (file &optional reverse skip-boring-check)
"Transform file in a cons cell like (DISPLAY . REAL).
DISPLAY is shown as basename of FILE and REAL as full path of FILE.
@@ -3787,7 +3780,7 @@ If SKIP-BORING-CHECK is non nil don't filter boring files."
;; Highlight extensions.
(helm-aif (and (not backup)
(not urlp)
- (helm-ff-file-extension disp))
+ (helm-file-name-extension disp))
(when (condition-case _err
(string-match (format "\\.\\(%s\\)\\'" it) disp)
(invalid-regexp nil))
@@ -3863,7 +3856,7 @@ If SKIP-BORING-CHECK is non nil don't filter boring files."
((stringp type)
(let* ((abbrev (abbreviate-file-name type))
(len-abbrev (length abbrev)))
- (helm-aif (helm-ff-file-extension abbrev)
+ (helm-aif (helm-file-name-extension abbrev)
(when (string-match (format "\\.\\(%s\\)\\'" it) abbrev)
(add-face-text-property
(match-beginning 1) (match-end 1)
diff --git a/helm-for-files.el b/helm-for-files.el
index d4388a60..6f2e09f7 100644
--- a/helm-for-files.el
+++ b/helm-for-files.el
@@ -193,7 +193,7 @@ Colorize only symlinks, directories and files."
'match-part (funcall mp-fn disp)
'help-echo (expand-file-name i))
i))
- (t (let* ((ext (file-name-extension disp))
+ (t (let* ((ext (helm-file-name-extension disp))
(disp (propertize disp
'face 'helm-ff-file
'match-part (funcall mp-fn disp)
diff --git a/helm-lib.el b/helm-lib.el
index 1da4e990..fc3e34a6 100644
--- a/helm-lib.el
+++ b/helm-lib.el
@@ -1348,6 +1348,13 @@ Argument ALIST is an alist of associated major modes."
(helm-file-name-sans-extension it)
it)))
+(defsubst helm-file-name-extension (file)
+ "Returns FILE extension if it is not a number."
+ (helm-aif (file-name-extension file)
+ (and (not (string-match "\\`0+\\'" it))
+ (zerop (string-to-number it))
+ it)))
+
(defun helm-basename (fname &optional ext)
"Print FNAME with any leading directory components removed.
If specified, also remove filename extension EXT.