diff --git a/CHANGELOG.md b/CHANGELOG.md index 0146f55..3358cf9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,7 @@ ### Internal +* Tidy up top-level dependencies: `require` `grep` from the helpers that actually use `grep-find-ignored-files`/`-directories` (`helm-projectile--ignored-files`/`-directories`) instead of relying on it being pulled in transitively, and drop the unused `helm-locate` and `helm-global-bindings` requires. (No startup-time change - Helm loads all three transitively anyway; this just makes the dependencies honest.) * Drive `helm-projectile-toggle`'s command remaps from a single table (`helm-projectile--command-remaps`) instead of two hand-maintained copies of ~20 `define-key` calls. * Extract the remote virtual-Dired guard duplicated across the three Dired file actions into a `helm-projectile--with-virtual-dired` macro. * Sharp-quote (`#'`) function references so the byte-compiler can catch typos in them. diff --git a/helm-projectile.el b/helm-projectile.el index ee526b4..dd257e3 100644 --- a/helm-projectile.el +++ b/helm-projectile.el @@ -43,12 +43,11 @@ ;; built-in libraries (require 'subr-x) (require 'cl-lib) -(require 'grep) ;; TODO: Probably we should defer this require +;; `grep' is loaded lazily (only when computing ignores for a search); see +;; `helm-projectile--ignored-files'. (require 'helm-core) -(require 'helm-global-bindings) (require 'helm-types) -(require 'helm-locate) (require 'helm-buffers) (require 'helm-files) (require 'helm-grep) @@ -1441,11 +1440,15 @@ When set to `search-tool', the above does not happen." (defun helm-projectile--ignored-files () "Compute ignored files." + ;; `grep' provides `grep-find-ignored-files'; load it on demand rather than + ;; at startup, since it is only needed when a search computes ignores. + (require 'grep) (cl-union (projectile-ignored-files-rel) grep-find-ignored-files :test #'equal)) (defun helm-projectile--ignored-directories () "Compute ignored directories." + (require 'grep) (cl-union (mapcar #'file-name-as-directory (projectile-ignored-directories-rel)) (mapcar #'file-name-as-directory grep-find-ignored-directories) :test #'equal))