5 コミット 5480414f08 ... ffa1e4b7ae

作者 SHA1 メッセージ 日付
  Ryan C. Thompson ffa1e4b7ae Declare obsolete aliases before the new name 4 年 前
  Ryan C. Thompson fbd5b3b366 Re-enable flx-ido testing 4 年 前
  Ryan C. Thompson a2626c6d82 Switch coveralls testing to latest Emacs release 27.2 4 年 前
  Ryan C. Thompson 2dd4650b87 Fix a test that was failing on Emacs 28 (snapshot) 4 年 前
  Ryan C. Thompson 50c0a1fc3d Fix some typos in the tests 4 年 前
4 ファイル変更54 行追加46 行削除
  1. 6 1
      .github/workflows/test.yml
  2. 1 1
      Eldev-flx-ido
  3. 36 36
      ido-completing-read+.el
  4. 11 8
      tests/test-ido-completing-read+.el

+ 6 - 1
.github/workflows/test.yml

@@ -32,7 +32,7 @@ jobs:
       # We only generate a coverage report for one Emacs version
       # (generally the latest release version) in order to avoid
       # duplicate reports.
-      coveralls_emacs_version: 27.1
+      coveralls_emacs_version: 27.2
     steps:
     - name: Set up Emacs
       uses: purcell/setup-emacs@master
@@ -52,9 +52,14 @@ jobs:
       run: |
         eldev -p -dtT test
 
+    - name: Run the test suite with flx-ido
+      run: |
+        eldev -p -S '(load-file "./Eldev-flx-ido")' -dtT test
+
     - name: Run the test suite in source mode (for undercover)
       if: ${{ matrix.emacs_version == env.coveralls_emacs_version }}
       env:
         COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
       run: |
         eldev -s -dtT test
+        eldev -s -S '(load-file "./Eldev-flx-ido")' -dtT test

+ 1 - 1
Eldev-flx-ido

@@ -2,4 +2,4 @@
 
 ;; This file is meant to be loaded with `eldev -S' to run the flx-ido
 ;; tests instead of the regular ones.
-(setq eldev-test-fileset '("./001-setup-undercover.el" "./tests-with-flx-ido/" "./tests/"))
+(setq eldev-test-fileset '("./tests-with-flx-ido/" "./tests/"))

+ 36 - 36
ido-completing-read+.el

@@ -307,6 +307,11 @@ disable fallback based on collection size, set this to nil."
                         widget)))))
   :group 'ido-completing-read-plus)
 
+(define-obsolete-variable-alias
+  'ido-cr+-function-blacklist
+  'ido-cr+-disable-list
+  "ido-completing-read+ 4.14")
+
 (defcustom ido-cr+-disable-list
   '(read-file-name-internal
     read-buffer
@@ -356,8 +361,8 @@ regular expressions, only name-based matching is possible."
                          (string :tag "Regexp"))))
 
 (define-obsolete-variable-alias
-  'ido-cr+-function-blacklist
-  'ido-cr+-disable-list
+  'ido-cr+-function-whitelist
+  'ido-cr+-allow-list
   "ido-completing-read+ 4.14")
 
 (defcustom ido-cr+-allow-list
@@ -377,10 +382,21 @@ list also takes precedence over the allow list."
   :type '(repeat (choice (symbol :tag "Function or command name")
                          (string :tag "Regexp"))))
 
-(define-obsolete-variable-alias
-  'ido-cr+-function-whitelist
-  'ido-cr+-allow-list
-  "ido-completing-read+ 4.14")
+(defvaralias 'ido-cr+-nil-def-wall-of-shame 'ido-cr+-nil-def-alternate-behavior-list
+  "Functions and commands whose authors need to read the docstring for `completing-read'.
+
+Many functions that call `completing-read' are written with the
+assumption that the setting the REQUIRE-MATCH argument of
+`completing-read' to t means it is required to return a match.
+While that would make logical sense, it's wrong. the docstring
+for `completing-read' describes the correct behavior.
+
+> If the input is null, ‘completing-read’ returns DEF, or the
+> first element of the list of default values, or an empty string
+> if DEF is nil, regardless of the value of REQUIRE-MATCH.
+
+This can be avoided by passing an element of COLLECTION as DEF
+instead of leaving it as nil.")
 
 (defcustom ido-cr+-nil-def-alternate-behavior-list
   '("\\`describe-\\(function\\|variable\\)\\'"
@@ -418,22 +434,6 @@ means that a match is required."
   :type '(repeat (choice (symbol :tag "Function or command name")
                          (string :tag "Regexp"))))
 
-(defvaralias 'ido-cr+-nil-def-wall-of-shame 'ido-cr+-nil-def-alternate-behavior-list
-  "Functions and commands whose authors need to read the docstring for `completing-read'.
-
-Many functions that call `completing-read' are written with the
-assumption that the setting the REQUIRE-MATCH argument of
-`completing-read' to t means it is required to return a match.
-While that would make logical sense, it's wrong. the docstring
-for `completing-read' describes the correct behavior.
-
-> If the input is null, ‘completing-read’ returns DEF, or the
-> first element of the list of default values, or an empty string
-> if DEF is nil, regardless of the value of REQUIRE-MATCH.
-
-This can be avoided by passing an element of COLLECTION as DEF
-instead of leaving it as nil.")
-
 ;;;###autoload
 (defcustom ido-cr+-replace-completely nil
   "If non-nil, replace `ido-completeing-read' completely with ido-cr+.
@@ -518,6 +518,11 @@ information manually if it is known."
     ;; If no list entry matches, return nil
     finally return nil))
 
+(define-obsolete-function-alias
+  'ido-cr+-function-is-blacklisted
+  'ido-cr+-disabled-in-function-p
+  "ido-completing-read+ 4.14")
+
 (defsubst ido-cr+-disabled-in-function-p (fun)
   "Return non-nil if ido-cr+ is disabled for FUN.
 
@@ -525,8 +530,8 @@ See `ido-cr+-disable-list'."
   (ido-cr+-function-is-in-list fun ido-cr+-disable-list))
 
 (define-obsolete-function-alias
-  'ido-cr+-function-is-blacklisted
-  'ido-cr+-disabled-in-function-p
+  'ido-cr+-function-is-whitelisted
+  'ido-cr+-allowed-in-function-p
   "ido-completing-read+ 4.14")
 
 (defsubst ido-cr+-allowed-in-function-p (fun)
@@ -536,11 +541,6 @@ See `ido-cr+-allow-list'."
   (or (null ido-cr+-allow-list)
       (ido-cr+-function-is-in-list fun ido-cr+-allow-list)))
 
-(define-obsolete-function-alias
-  'ido-cr+-function-is-whitelisted
-  'ido-cr+-allowed-in-function-p
-  "ido-completing-read+ 4.14")
-
 ;;;###autoload
 (defun ido-completing-read+ (prompt collection &optional predicate
                                     require-match initial-input
@@ -1181,6 +1181,11 @@ will simply be re-added the next time Emacs starts.)"
                         nil))
   :group 'ido-completing-read-plus)
 
+(define-obsolete-function-alias
+  'ido-cr+-update-blacklist
+  'ido-cr+-update-disable-list
+  "ido-completing-read+ 4.14")
+
 (defun ido-cr+-update-disable-list (&optional save quiet)
   "Re-add any missing default entries to `ido-cr+-disable-list'.
 
@@ -1240,8 +1245,8 @@ disable list was modified."
     modified))
 
 (define-obsolete-function-alias
-  'ido-cr+-update-blacklist
-  'ido-cr+-update-disable-list
+  'ido-cr+-maybe-update-blacklist
+  'ido-cr+-maybe-update-disable-list
   "ido-completing-read+ 4.14")
 
 (defun ido-cr+-maybe-update-disable-list ()
@@ -1260,11 +1265,6 @@ disable list was modified."
           (ido-cr+--debug-message "No disable list updates available.")))
     (ido-cr+--debug-message "Skipping disable list update by user request.")))
 
-(define-obsolete-function-alias
-  'ido-cr+-maybe-update-blacklist
-  'ido-cr+-maybe-update-disable-list
-  "ido-completing-read+ 4.14")
-
 (ido-cr+-maybe-update-disable-list)
 
 (provide 'ido-completing-read+)

+ 11 - 8
tests/test-ido-completing-read+.el

@@ -315,24 +315,27 @@ also accept a quoted list for the sake of convenience."
          (with-simulated-input "C-j"
            (ido-completing-read+
             "Prompt: "
-            '("bluebird" "blues" "bluegrass" "blueberry" "yellow ""green") nil t))
+            '("bluebird" "blues" "bluegrass" "blueberry" "yellow" "green") nil t))
          :to-equal ""))
       ;; "C-j" should NOT be allowed to return an empty string if
       ;; require-match and default are both non-nil.
-      (it "should not alow exiting with an empty string if DEF is non-nil"
+      (it "should not allow exiting with an empty string if DEF is non-nil"
         (expect
          (with-simulated-input "C-j"
            (ido-completing-read+
             "Prompt: "
-            '("bluebird" "blues" "bluegrass" "blueberry" "yellow ""green") nil t nil nil "yellow"))
+            '("bluebird" "blues" "bluegrass" "blueberry" "yellow" "green") nil t nil nil "yellow"))
          :to-throw))
 
       (it "shouldn't allow C-j to select an ambiguous match"
+        ;; Make this a no-op to avoid end-of-buffer errors, which are
+        ;; irrelevant to this test.
+        (spy-on 'scroll-other-window)
         (expect
          (with-simulated-input "b C-j C-j C-j"
            (ido-completing-read+
             "Prompt: "
-            '("bluebird" "blues" "bluegrass" "blueberry" "yellow ""green") nil t))
+            '("bluebird" "blues" "bluegrass" "blueberry" "yellow" "green") nil t))
          :to-throw)
         ;; First press of C-j should complete to "blue" after the
         ;; first b, but then get stuck on the choice for the second b.
@@ -356,7 +359,7 @@ also accept a quoted list for the sake of convenience."
          (with-simulated-input "b l u e g C-j"
            (ido-completing-read+
             "Prompt: "
-            '("bluebird" "blues" "bluegrass" "blueberry" "yellow ""green") nil t))
+            '("bluebird" "blues" "bluegrass" "blueberry" "yellow" "green") nil t))
          :to-equal "bluegrass"))
 
       (it "should require an extra C-j to exit when `ido-confirm-unique-completion' is non-nil"
@@ -367,7 +370,7 @@ also accept a quoted list for the sake of convenience."
          (with-simulated-input "b l u e g C-j"
            (ido-completing-read+
             "Prompt: "
-            '("bluebird" "blues" "bluegrass" "blueberry" "yellow ""green") nil t))
+            '("bluebird" "blues" "bluegrass" "blueberry" "yellow" "green") nil t))
          :to-throw)
         ;; The first "C-j" should complete to "bluegrass", and the second
         ;; should return.
@@ -375,7 +378,7 @@ also accept a quoted list for the sake of convenience."
          (with-simulated-input "b l u e g C-j C-j"
            (ido-completing-read+
             "Prompt: "
-            '("bluebird" "blues" "bluegrass" "blueberry" "yellow ""green") nil t))
+            '("bluebird" "blues" "bluegrass" "blueberry" "yellow" "green") nil t))
          :to-equal "bluegrass"))
 
       ;; Finally, a test for the expected wrong behavior without
@@ -386,7 +389,7 @@ also accept a quoted list for the sake of convenience."
          (with-simulated-input "b C-j"
            (ido-completing-read
             "Prompt: "
-            '("bluebird" "blues" "bluegrass" "blueberry" "yellow ""green") nil t))
+            '("bluebird" "blues" "bluegrass" "blueberry" "yellow" "green") nil t))
          :to-equal "b")))
 
     (describe "when INHERIT-INPUT-METHOD is non-nil"