Browse Source

Call fallback function on original arguments

The advice to "ido-completing-read" can fall back to non-ido completion
if the setup fails. However, the setup code modifies the arguments, and
if it fails those arguments may not be set properly. So now we save the
initial argument list and use that for the fallback case.
Ryan C. Thompson 10 years ago
parent
commit
01222e7c56
1 changed files with 5 additions and 5 deletions
  1. 5 5
      ido-ubiquitous.el

+ 5 - 5
ido-ubiquitous.el

@@ -470,7 +470,9 @@ This advice implements the logic required for
 `ido-completing-read' is called through
 `ido-completing-read' is called through
 `ido-ubiquitous-completing-read', so other packages that use
 `ido-ubiquitous-completing-read', so other packages that use
 `ido-completing-read', such as `smex', will not be affected."
 `ido-completing-read', such as `smex', will not be affected."
-  (let* ((ido-ubiquitous-this-call-replaces-completing-read ido-ubiquitous-next-call-replaces-completing-read)
+  (let* ((orig-args (ad-get-args 0))
+         (ido-ubiquitous-this-call-replaces-completing-read
+          ido-ubiquitous-next-call-replaces-completing-read)
          (ido-ubiquitous-next-call-replaces-completing-read nil)
          (ido-ubiquitous-next-call-replaces-completing-read nil)
          (error-during-setup nil))
          (error-during-setup nil))
     (when ido-ubiquitous-this-call-replaces-completing-read
     (when ido-ubiquitous-this-call-replaces-completing-read
@@ -509,10 +511,8 @@ This advice implements the logic required for
     (if (not error-during-setup)
     (if (not error-during-setup)
         ad-do-it
         ad-do-it
       (setq ad-return-value
       (setq ad-return-value
-            (funcall
-             ido-ubiquitous-fallback-completing-read-function
-             prompt choices predicate require-match initial-input
-             hist def inherit-input-method)))))
+            (apply ido-ubiquitous-fallback-completing-read-function
+                   orig-args)))))
 
 
 (defun completing-read-ido (prompt collection &optional predicate
 (defun completing-read-ido (prompt collection &optional predicate
                                    require-match initial-input
                                    require-match initial-input