Просмотр исходного кода

Don't rely on `featurep` to choose which completion backend to use.

Damien Merenne 5 лет назад
Родитель
Сommit
ec499adb1f
2 измененных файлов с 2 добавлено и 19 удалено
  1. 0 10
      test/xwwp-follow-link-test.el
  2. 2 9
      xwwp-follow-link.el

+ 0 - 10
test/xwwp-follow-link-test.el

@@ -198,16 +198,6 @@ return '' + window.location;
     `(cl-letf (((symbol-function 'require) (lambda (f &optional filename no-errors) (eq (quote ,fsym) f))))
        ,@body)))
 
-(ert-deftest test-xwwp-follow-link-make-backend-use-feature ()
-  (with-feature nil
-    (should (eq #'xwwp-follow-link-completion-backend-default (xwwp-follow-link-make-backend))))
-  (with-feature ido
-    (should (eq #'xwwp-follow-link-completion-backend-ido (xwwp-follow-link-make-backend))))
-  (with-feature ivy
-    (should (eq #'xwwp-follow-link-completion-backend-ivy (xwwp-follow-link-make-backend))))
-  (with-feature helm
-    (should (eq #'xwwp-follow-link-completion-backend-helm (xwwp-follow-link-make-backend)))))
-
 (ert-deftest test-xwwp-follow-link-make-backend-use-custom ()
   (let ((xwwp-follow-link-completion-system 'default))
     (with-feature nil

+ 2 - 9
xwwp-follow-link.el

@@ -175,13 +175,7 @@ browser."
 (defun xwwp-follow-link-make-backend ()
   "Instanciate a completion backend."
   (cond ((eq xwwp-follow-link-completion-system 'default)
-         (cond ((require 'xwwp-follow-link-ivy nil t)
-                #'xwwp-follow-link-completion-backend-ivy)
-               ((require 'xwwp-follow-link-helm nil t)
-                #'xwwp-follow-link-completion-backend-helm)
-               ((require 'xwwp-follow-link-ido nil t)
-                #'xwwp-follow-link-completion-backend-ido)
-               (t #'xwwp-follow-link-completion-backend-default)))
+         #'xwwp-follow-link-completion-backend-default)
         ((eq xwwp-follow-link-completion-system 'ivy)
          (unless (require 'xwwp-follow-link-ivy nil t)
            (user-error "Install the `xwwp-follow-link-ivy' package to use `xwwp-follow-link' with `ivy'"))
@@ -191,8 +185,7 @@ browser."
            (user-error "Install the `xwwp-follow-link-helm' package to use `xwwp-follow-link' with `helm'"))
          #'xwwp-follow-link-completion-backend-helm)
         ((eq xwwp-follow-link-completion-system 'ido)
-         (unless (require 'xwwp-follow-link-ido nil t)
-           (user-error "Install the `xwwp-follow-link-ido' package to use `xwwp-follow-link' with `ido'"))
+         (require 'xwwp-follow-link-ido)
          #'xwwp-follow-link-completion-backend-ido)
         ((eq xwwp-follow-link-completion-system 'default)
          #'xwwp-follow-link-completion-backend-default)