浏览代码

Supress error in advice to ido-exit-minibuffer

If the old-style-default advice on ido-exit-minibuffer encounters an
error, the advice will be "skipped" and the function will be run
anyway.
Ryan C. Thompson 11 年之前
父节点
当前提交
c4e8e27834
共有 1 个文件被更改,包括 26 次插入26 次删除
  1. 26 26
      ido-ubiquitous.el

+ 26 - 26
ido-ubiquitous.el

@@ -527,32 +527,32 @@ the list.")
 
 
 See `ido-ubiquitous-enable-old-style-default', which
 See `ido-ubiquitous-enable-old-style-default', which
 controls whether this advice has any effect."
 controls whether this advice has any effect."
-
-  (not current-prefix-arg)
-  (let* ((enable-oldstyle
-          (and
-           ;; Completing a list, not a buffer or file
-           (eq ido-cur-item 'list)
-           ;; Only enable if we are replacing `completing-read'
-           ido-ubiquitous-this-call-replaces-completing-read
-           ;; Default is nil
-           (null ido-default-item)
-           ;; Input is empty
-           (string= ido-text "")
-           ;; Old-style default enabled
-           (if ido-ubiquitous-active-override
-               (eq ido-ubiquitous-active-override 'enable-old)
-             ido-ubiquitous-enable-old-style-default)
-           ;; First item on the list hasn't changed
-           (string= (car ido-cur-list)
-                    ido-ubiquitous-initial-item)))
-         ;; Prefix inverts oldstyle behavior
-         (should-invert current-prefix-arg)
-         (actually-enable-oldstyle
-          (if should-invert (not enable-oldstyle) enable-oldstyle)))
-    (if actually-enable-oldstyle
-        (ido-select-text)
-      ad-do-it))
+  (condition-case nil
+      (let* ((enable-oldstyle
+              (and
+               ;; Completing a list, not a buffer or file
+               (eq ido-cur-item 'list)
+               ;; Only enable if we are replacing `completing-read'
+               ido-ubiquitous-this-call-replaces-completing-read
+               ;; Default is nil
+               (null ido-default-item)
+               ;; Input is empty
+               (string= ido-text "")
+               ;; Old-style default enabled
+               (if ido-ubiquitous-active-override
+                   (eq ido-ubiquitous-active-override 'enable-old)
+                 ido-ubiquitous-enable-old-style-default)
+               ;; First item on the list hasn't changed
+               (string= (car ido-cur-list)
+                        ido-ubiquitous-initial-item)))
+             ;; Prefix inverts oldstyle behavior
+             (should-invert current-prefix-arg)
+             (actually-enable-oldstyle
+              (if should-invert (not enable-oldstyle) enable-oldstyle)))
+        (if actually-enable-oldstyle
+            (ido-select-text)
+          ad-do-it))
+    (error ad-do-it))
   (setq ido-ubiquitous-initial-item nil))
   (setq ido-ubiquitous-initial-item nil))
 
 
 ;;; Overrides
 ;;; Overrides