Subject: bug#19848: Minibuffer completion does not work with ECB package?

From: Thorsten Bonow <[email-masked]>
Date: Sun, 11 Dec 2016 22:57:51 +0100 (CET)

> It seems that minibuffer completion does not work properly if ECB
> package is installed (from MELPA, with : Options | Manage Emacs 
> Packages), and active.
 
> For example, if I want to strip the trailing withe spaces (M-x
> delete-trailing-whitespace), I try
 
>   M-x del<TAB>
 
> In the minibuffer I get
 
> Click on a completion to select it.
> In this buffer, type RET to select the completion near point.
 
> Possible completions are:
> delete-backward-char 	delete-blank-lines
> [...]
  
> but at this point, if I click on 'delete-trailing-whitespace', I get
 
>   Minibuffer is not active for completion
 
> If I try to exit with C-G, it print 'Quit', but does not exit. In short,
> whatever I do I cannot exit minibuffer if not quitting Emacs.

Hi,

I don't think it's an Emacs bug. I think ECB chokes on the Emacs 25
version of `minibuffer-completion-help' from "minibuffer.el".

Version 25 of `minibuffer-completion-help' now calls
`display-buffer-at-bottom' which appears not to be adapted to the ECB
layout. (ECB divides its frame into special ECB windows on the left or
right side of the frame and one main "edit-area". By advising the
window functions like `display-buffer', the ECB layout is left
undisturbed; window functions only act on the "edit-area". Since
`display-buffer-at-bottom' is not advised, this now fails with Emacs
25.)

As a workaround till this is fixed in ECB I wrote an advice for
`display-buffer-at-bottom', which overrides this defun in the ECB
frame and calls 'display-buffer-use-some-window' instead. A call to
`display-buffer-use-some-window' in other frames will call the
unmodified defun. The Completion buffer takes up the whole
"edit-area", but selecting a completion works for me now.

Toto

(defun display-buffer-at-bottom--display-buffer-at-bottom-around (orig-fun &rest args)
  "Bugfix for ECB: cannot use `display-buffer-at-bottom', call
`display-buffer-use-some-window' instead in ECB frame."
  (if (and ecb-minor-mode (equal (selected-frame) ecb-frame))
      (apply 'display-buffer-use-some-window args)
    (apply orig-fun args)))
(advice-add 'display-buffer-at-bottom :around #'display-buffer-at-bottom--display-buffer-at-bottom-around)