diff options
| author | Bozhidar Batsov <bozhidar@batsov.dev> | 2026-02-15 00:14:54 +0200 |
|---|---|---|
| committer | Bozhidar Batsov <bozhidar@batsov.dev> | 2026-02-15 00:14:54 +0200 |
| commit | b53336e3c5343a59f54bcfadf18bb1e5ad41f58b (patch) | |
| tree | a08494d83a980d33f1d0a83860c5bd99e6db5501 | |
| parent | f52777c0a6d2dff175b4224f4bdc105834c05677 (diff) | |
Replace (delq nil (mapcar ...)) with seq-keep
Use seq-keep (available via compat 30) for the filter-map pattern
in projectile-normalise-paths, projectile-rgrep-default-command,
and projectile-open-projects.
| -rw-r--r-- | projectile.el | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/projectile.el b/projectile.el index a185653..bd16cf4 100644 --- a/projectile.el +++ b/projectile.el @@ -1919,10 +1919,10 @@ With a prefix argument, show NLINES of context." (defun projectile-normalise-paths (patterns) "Remove leading `/' from the elements of PATTERNS." - (delq nil (mapcar (lambda (pat) (and (string-prefix-p "/" pat) - ;; remove the leading / - (substring pat 1))) - patterns))) + (seq-keep (lambda (pat) (and (string-prefix-p "/" pat) + ;; remove the leading / + (substring pat 1))) + patterns)) (defun projectile-expand-paths (paths) "Expand the elements of PATHS. @@ -4348,17 +4348,16 @@ which it shares its arglist." " -path " (mapconcat #'identity - (delq nil (mapcar - #'(lambda (ignore) - (cond ((stringp ignore) - (shell-quote-argument - (concat "*/" ignore))) - ((consp ignore) - (and (funcall (car ignore) dir) - (shell-quote-argument - (concat "*/" - (cdr ignore))))))) - grep-find-ignored-directories)) + (seq-keep (lambda (ignore) + (cond ((stringp ignore) + (shell-quote-argument + (concat "*/" ignore))) + ((consp ignore) + (and (funcall (car ignore) dir) + (shell-quote-argument + (concat "*/" + (cdr ignore))))))) + grep-find-ignored-directories) " -o -path ") " " (shell-quote-argument ")") @@ -5629,13 +5628,12 @@ directories." "Return a list of all open projects. An open project is a project with any open buffers." (seq-uniq - (delq nil - (mapcar (lambda (buffer) - (with-current-buffer buffer - (when-let* ((project-root (projectile-project-root))) - (when (projectile-project-buffer-p buffer project-root) - (abbreviate-file-name project-root))))) - (buffer-list))))) + (seq-keep (lambda (buffer) + (with-current-buffer buffer + (when-let* ((project-root (projectile-project-root))) + (when (projectile-project-buffer-p buffer project-root) + (abbreviate-file-name project-root))))) + (buffer-list)))) (defun projectile--remove-current-project (projects) "Remove the current project (if any) from the list of PROJECTS." |
