Browse Source

Avoid spurious warning when loaded before ido.

Normally ido-ubiquitous warns you if you enable it without first
enabling ido. However, this can cause spurious warnings during init if
ido-ubiquitous is loaded first. As a solution, during init we now use
"after-init-hook" to only warn if ido still isn't enabled when init is
complete. After init, behavior is unchanged.
Ryan C. Thompson 12 years ago
parent
commit
f7bbe8f3b3
1 changed files with 9 additions and 1 deletions
  1. 9 1
      ido-ubiquitous.el

+ 9 - 1
ido-ubiquitous.el

@@ -69,6 +69,12 @@ detects something that ido cannot handle.")
   "Use ido for (almost) all completion."
   :group 'ido)
 
+(defun ido-ubiquitous-warn-about-ido-disabled ()
+  "Warn if ido-ubiquitous is enabled without ido."
+  (if (and after-init-time
+	   (not (bound-and-true-p ido-mode)))
+      (warn "Ido-ubiquitous-mode enabled without ido mode.")))
+
 ;;;###autoload
 (define-minor-mode ido-ubiquitous-mode
   "Use `ido-completing-read' instead of `completing-read' almost everywhere.
@@ -88,7 +94,9 @@ detects something that ido cannot handle.")
   :group 'ido-ubiquitous
   (when ido-ubiquitous-mode
     (unless (bound-and-true-p ido-mode)
-      (warn "Ido-ubiquitous-mode enabled without ido mode.")))
+      (if after-init-time
+	  (ido-ubiquitous-warn-about-ido-disabled)
+	(add-hook 'after-init-hook 'ido-ubiquitous-warn-about-ido-disabled))))
   (if (and (boundp 'completing-read-function)
            ido-ubiquitous-orig-completing-read-function)
       ;; Emacs 24 and later