[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/helm e7ea896a7c 1/3: Add helm-string-numberp and use it
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/helm e7ea896a7c 1/3: Add helm-string-numberp and use it |
Date: |
Mon, 10 Oct 2022 01:58:40 -0400 (EDT) |
branch: elpa/helm
commit e7ea896a7c0ef6804eb4fde4764b4022c54e1a56
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>
Add helm-string-numberp and use it
---
helm-lib.el | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/helm-lib.el b/helm-lib.el
index 56a824f1f6..0d464c4521 100644
--- a/helm-lib.el
+++ b/helm-lib.el
@@ -1248,6 +1248,12 @@ differently depending of answer:
(funcall action elm)
(setq dont-ask t)))
("q" (throw 'break nil))))))))
+
+(defsubst helm-string-numberp (str)
+ "Return non nil if string STR represent a number."
+ (cl-assert (stringp str) t)
+ (or (cl-loop for c across str always (char-equal c ?0))
+ (not (zerop (string-to-number str)))))
;;; Symbols routines
;;
@@ -1485,9 +1491,7 @@ with current candidate as arg."
(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)))
+ (and (not (helm-string-numberp it)) it)))
(defun helm-basename (fname &optional ext)
"Print FNAME with any leading directory components removed.