ソースを参照

Make memoize an optional dependency

Memoize is still listed as a dependency in the Package-Requires
header, since if you're installing via package.el, you may as well get
the optimization as well. But for people installing it manually,
ido-cr+ should still load and run without memoize available.

Fixes #154.
Ryan C. Thompson 7 年 前
コミット
88d1d44345
1 ファイル変更5 行追加3 行削除
  1. 5 3
      ido-completing-read+.el

+ 5 - 3
ido-completing-read+.el

@@ -88,7 +88,9 @@ not be updated until you restart Emacs.")
 (require 'cl-lib)
 (require 'cus-edit)
 (require 's)
-(require 'memoize)
+
+;; Optional dependency, only needed for optimization
+(require 'memoize nil t)
 
 ;; Silence some byte-compiler warnings
 (eval-when-compile
@@ -517,11 +519,11 @@ completion for them."
          (ido-cr+-last-dynamic-update-text nil)
          ;; Only memoize if the collection is dynamic.
          (ido-cr+-all-prefix-completions-memoized
-          (if ido-cr+-dynamic-collection
+          (if (and ido-cr+-dynamic-collection (featurep 'memoize))
               (memoize (indirect-function 'ido-cr+-all-prefix-completions))
             'ido-cr+-all-prefix-completions))
          (ido-cr+-all-completions-memoized
-          (if ido-cr+-dynamic-collection
+          (if (and ido-cr+-dynamic-collection (featurep 'memoize))
               (memoize (indirect-function 'all-completions))
             'all-completions))
          ;; If the whitelist is empty, everything is whitelisted