Subject: Re: bug#5849: 23.1.95; completion-auto-help blocks icomplete-mode

From: Johan Bockgård <[email-masked]>
Date: Sat, 09 Jul 2011 17:00:13 +0200

Chong Yidong <[email-masked]> writes:

> I have checked in the patch that I posted earlier for this bug into the
> emacs-23 branch, and a more complete fix into the trunk.  The latter
> involves a new variable completion-show-inline-help, which
> icomplete-mode binds to nil.

The fix in the trunk sets completion-show-inline-help globally which is
not quite right:

emacs -Q
M-x icomplete-mode RET
C-x C-f nonexistingfile TAB
=> no message
Expected: "[No match]"

This patch to the current trunk sets completion-show-inline-help locally
when icomplete is actually being used (simple completion).

2011-07-09  Johan Bockgård  <[email-masked]>

        Fix previous fix of Bug#5849.

	* icomplete.el (icomplete-mode): Don't set
	completion-show-inline-help.
	(icomplete-minibuffer-setup): Set completion-show-inline-help
	locally during icompletion.

=== modified file 'lisp/icomplete.el'
--- lisp/icomplete.el	2011-05-31 03:03:38 +0000
+++ lisp/icomplete.el	2011-07-09 14:01:48 +0000
@@ -179,11 +179,8 @@
   (if icomplete-mode
       ;; The following is not really necessary after first time -
       ;; no great loss.
-      (progn
-	(setq completion-show-inline-help nil)
-	(add-hook 'minibuffer-setup-hook 'icomplete-minibuffer-setup))
-    (remove-hook 'minibuffer-setup-hook 'icomplete-minibuffer-setup)
-    (setq completion-show-inline-help t)))
+      (add-hook 'minibuffer-setup-hook 'icomplete-minibuffer-setup)
+    (remove-hook 'minibuffer-setup-hook 'icomplete-minibuffer-setup)))
 
 ;;;_ > icomplete-simple-completing-p ()
 (defun icomplete-simple-completing-p ()
@@ -209,6 +206,7 @@
   "Run in minibuffer on activation to establish incremental completion.
 Usually run by inclusion in `minibuffer-setup-hook'."
   (when (and icomplete-mode (icomplete-simple-completing-p))
+    (set (make-local-variable 'completion-show-inline-help) nil)
     (add-hook 'pre-command-hook
 	      (lambda () (run-hooks 'icomplete-pre-command-hook))
 	      nil t)