[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/helm e1e8b8540b 2/3: Use helm-acase in some places
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/helm e1e8b8540b 2/3: Use helm-acase in some places |
Date: |
Mon, 19 Feb 2024 13:00:13 -0500 (EST) |
branch: elpa/helm
commit e1e8b8540b173de70e9a0c187a8c9dc96d230042
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>
Use helm-acase in some places
where code is simple for testing purpose.
---
helm-core.el | 13 ++++++-------
helm-grep.el | 10 +++++-----
helm-ring.el | 10 +++++-----
3 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/helm-core.el b/helm-core.el
index debeceb1d5..7bdc2c7b66 100644
--- a/helm-core.el
+++ b/helm-core.el
@@ -3774,13 +3774,12 @@ See :after-init-hook and :before-init-hook in
`helm-source'."
(cl-loop for s in sources
for hv = (assoc-default hook s)
when hv
- do (pcase hv
- ((and (pred (functionp))
- (guard (not (symbolp hv))))
- (funcall hv))
- ((and hook (pred (listp)))
- (dolist (h hook) (funcall h)))
- (_ (helm-log-run-hook "helm--run-init-hooks" hv)))))
+ do (helm-acase hv
+ ((guard (and (functionp it) (not (symbolp it))))
+ (funcall it))
+ ((guard (listp it))
+ (dolist (h it) (funcall h)))
+ (t (helm-log-run-hook "helm--run-init-hooks" it)))))
(defun helm-restore-position-on-quit ()
"Restore position in `helm-current-buffer' when quitting."
diff --git a/helm-grep.el b/helm-grep.el
index 8aabe81279..f514e95e1b 100644
--- a/helm-grep.el
+++ b/helm-grep.el
@@ -533,16 +533,16 @@ Have no effect when grep backend use \"--color=\"."
(and rec-com rec-com-ack-p)))))))
(defun helm-grep--pipe-command-for-grep-command (smartcase pipe-switches
&optional grep-cmd)
- (pcase (or grep-cmd (helm-grep-command))
+ (helm-acase (or grep-cmd (helm-grep-command))
;; Use grep for GNU regexp based tools.
- ((or "grep" "zgrep" "git-grep")
+ (("grep" "zgrep" "git-grep")
(format "grep --color=always%s %s"
(if smartcase " -i" "")
pipe-switches))
;; Use ack-grep for PCRE based tools.
- ;; Sometimes ack-grep cmd is ack only.
- ((and (pred (string-match-p "ack")) ack)
- (format "%s --smart-case --color %s" ack pipe-switches))))
+ ;; Sometimes ack-grep cmd is ack only so compare by matching ack.
+ ((guard (string-match-p "ack" it))
+ (format "%s --smart-case --color %s" it pipe-switches))))
(defun helm-grep--prepare-cmd-line (only-files &optional include zgrep)
(let* ((default-directory (or helm-ff-default-directory
diff --git a/helm-ring.el b/helm-ring.el
index 49a782050a..2b16124eb7 100644
--- a/helm-ring.el
+++ b/helm-ring.el
@@ -322,11 +322,11 @@ yanked string."
(with-current-buffer (marker-buffer marker)
(goto-char marker)
(forward-line 0)
- (let ((line (pcase (thing-at-point 'line)
- ((and line (pred stringp)
- (guard (not (string-match-p "\\`\n?\\'" line))))
- (car (split-string line "[\n\r]")))
- (_ "<EMPTY LINE>"))))
+ (let ((line (helm-acase (thing-at-point 'line)
+ ((guard (and (stringp it)
+ (not (string-match-p "\\`\n?\\'" it))))
+ (car (split-string it "[\n\r]")))
+ (t "<EMPTY LINE>"))))
(remove-text-properties 0 (length line) '(read-only) line)
(format "%7d:%s: %s"
(line-number-at-pos) (marker-buffer marker) line))))